diff options
author | Markus <markus@schramm.ws> | 2022-04-29 01:27:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 01:27:19 +0300 |
commit | 0d38978f262fe60e49fd746af2334a027f1d2bae (patch) | |
tree | 1e8a6169b43a449426cd16457b23aea58376c7bd /plugins | |
parent | c5d0f1e41651c1ea9ef29dd6efbe19a6cbe3fbaa (diff) |
Respect enable_required_directories_diagnostic option in server info diagnostics (#19137)
* Respect enable_required_directories_diagnostic option in server info diagnostics
* Add missing use statement
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Diagnostics/Diagnostic/ServerInformational.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/Diagnostics/Diagnostic/ServerInformational.php b/plugins/Diagnostics/Diagnostic/ServerInformational.php index 27475089e6..5b20b7f735 100644 --- a/plugins/Diagnostics/Diagnostic/ServerInformational.php +++ b/plugins/Diagnostics/Diagnostic/ServerInformational.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\Diagnostics\Diagnostic; use Piwik\Translation\Translator; +use Piwik\Config\GeneralConfig; use Piwik\SettingsPiwik; /** @@ -32,13 +33,18 @@ class ServerInformational implements Diagnostic if (!empty($_SERVER['SERVER_SOFTWARE'])) { $isGlobalConfigIniAccessible = true; // Assume true if not installed yet - - if (SettingsPiwik::isMatomoInstalled()) { - $rpd = new RequiredPrivateDirectories($this->translator); - $isGlobalConfigIniAccessible = $rpd->isGlobalConfigIniAccessible(); + + // Only attempt to check file accessibility if the config setting allows it + $disableFileAccessCheck = (GeneralConfig::getConfigValue('enable_required_directories_diagnostic') == 0); + + if(!$disableFileAccessCheck) { + if (SettingsPiwik::isMatomoInstalled()) { + $rpd = new RequiredPrivateDirectories($this->translator); + $isGlobalConfigIniAccessible = $rpd->isGlobalConfigIniAccessible(); + } } - if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'nginx') !== false && $isGlobalConfigIniAccessible) { + if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'nginx') !== false && $isGlobalConfigIniAccessible && !$disableFileAccessCheck) { $comment = $_SERVER['SERVER_SOFTWARE']."<br><br>"; $comment .= $this->translator->translate('Diagnostics_HtaccessWarningNginx', [ |