@mattmary opened this Issue on December 22nd 2022 Contributor

In the WordPress plugin, some of our users have in their log files something like:

2022/12/22 11:24:55 [error] 9314<a href='/9314'>#9314</a>: *432825 FastCGI sent in stderr: "PHP message: [xxxxxx.de] Error in Matomo: This feature is not available" while reading response header from upstream, client: 157.90.0.0, server: xxxxxx.de, request: "GET /wp-content/plugins/matomo/app/?module=Installation&action=getEmptyPageForSystemCheck HTTP/1.1", upstream: "fastcgi://unix:/var/run/wordpress.php-fpm.sock:", host: "xxxxxx.de", referrer: "https://xxxxxxx.de/wp-content/plugins/matomo/app/?module=Installation&action=getEmptyPageForSystemCheck"

Expected Behavior

Do not have any error.

Current Behavior

Error in the webserver log file.

Possible Solution

This call is made here: https://github.com/matomo-org/matomo/blob/702018832517a64837d256875a64e0039b37ac0f/plugins/Diagnostics/Diagnostic/PageSpeedCheck.php#L54-L87
Unfortunately, the Installation plugin is disabled in the WordPress plugin: all Installation plugin requests throw an exception: https://github.com/matomo-org/matomo-for-wordpress/blob/03db1ea2f16073c0d6a2c09b17a3953985a39b57/plugins/WordPress/WordPress.php#L337-L341
So this isPageSpeedEnabled will always fail in an error.
Can you add in the check a constant verification to check if we can process this check? We could then disable it in the plugin and avoid this error.

Steps to Reproduce (for Bugs)

1.
2.

Context

Your Environment

  • Matomo Version: 4.13.0
  • PHP Version: 8.1
  • Server Operating System: Apache
  • Additionally installed plugins:
  • Browser:
  • Operating System:
@sgiehl commented on December 23rd 2022 Member

@mattmary It might be enough to not perform the check if the Installation plugin is not enabled. Feel free to test that and provide a PR for that.

@mattmary commented on January 10th 2023 Contributor

Hello @sgiehl

Sorry, my sentence was not really accurate: by disabled, I meant that all these requests will fail (but the plugin is not disabled): some of the natives actions lead to an exception:
https://github.com/matomo-org/matomo-for-wordpress/blob/34baa9e901f7481bbd82e019ef2cae1d061b57a6/plugins/WordPress/WordPress.php#L330-L362

So I was wondering if we could use a constant to bypass this test? For example, testing if MATOMO_DISABLE_PAGE_TESTSPEED and define it in the WordPress plugin?
Would it be acceptable for you?
Is it a standard way to process in Matomo? If yes, do you have a constant naming convention?

Otherwise, we could also disable this plugin when creating the WordPress plugin release and test like you said if the plugin is enabled? Maybe this second solution is more elegant and would also manage the case that this plugin would have been disabled in Matomo on premise.
Do you have an example of plugin deactivation?

Please share your thoughts

Matthieu

@sgiehl commented on January 12th 2023 Member

@mattmary You can easily disable certain diagnostic checks using DI by adding something like below to a config.php:

return [
    'diagnostics.disabled'  => \DI\add([
        \DI\get(\Piwik\Plugins\Diagnostics\Diagnostic\PageSpeedCheck::class),
    ]),
];
@mattmary commented on January 12th 2023 Contributor

Thank you, @sgiehl !
@tsteur, I can see in the plugin config.php file there are some instructions for the diagnostic plugin: https://github.com/matomo-org/matomo-for-wordpress/blob/34baa9e901f7481bbd82e019ef2cae1d061b57a6/config/config.php#L119
Does it mean we can't disable it? (Additionally, can you explain to me where it is used in the plugin?)

@tsteur commented on January 12th 2023 Member

Yes, you can disable it there as well. Either same way as @sgiehl mentioned or similarly to the existing logic.

This Issue was closed on January 13th 2023
Powered by GitHub Issue Mirror