-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check for problematic modules reqtimeout, deflate and pagespeed #14699
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -574,6 +574,7 @@ public static function checkServer(\OCP\IConfig $config) { | |
// functions = function_exists | ||
// defined = defined | ||
// ini = ini_get | ||
// module = apacheModuleEnabled | ||
// If the dependency is not found the missing module name is shown to the EndUser | ||
// When adding new checks always verify that they pass on Travis as well | ||
// for ini settings, see https://github.com/owncloud/administration/blob/master/travis-ci/custom.ini | ||
|
@@ -602,8 +603,14 @@ public static function checkServer(\OCP\IConfig $config) { | |
'output_buffering' => false, | ||
'default_charset' => 'UTF-8', | ||
], | ||
'modules' => array( | ||
'mod_pagespeed' => 'mod_pagespeed', | ||
'mod_reqtimeout' => 'mod_reqtimeout', | ||
'mod_deflate' => 'mod_deflate' | ||
), | ||
); | ||
$missingDependencies = array(); | ||
$problematicModules = array(); | ||
$invalidIniSettings = []; | ||
$moduleHint = $l->t('Please ask your server administrator to install the module.'); | ||
|
||
|
@@ -647,6 +654,11 @@ public static function checkServer(\OCP\IConfig $config) { | |
} | ||
} | ||
} | ||
foreach ($dependencies['modules'] as $checkModule => $module) { | ||
if (self::apacheModuleEnabled($checkModule)) { | ||
$problematicModules[] = $module; | ||
} | ||
} | ||
} | ||
|
||
foreach($missingDependencies as $missingDependency) { | ||
|
@@ -675,6 +687,14 @@ public static function checkServer(\OCP\IConfig $config) { | |
); | ||
$webServerRestart = true; | ||
} | ||
foreach($problematicModules as $problematicModule) { | ||
$errors[] = array( | ||
'error' => $l->t('The Apache module %s is enabled.', array($problematicModule)), | ||
'hint' => $l->t('This module can cause various issues when enabled.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no string concat please - translation extraction will fail - thx There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, then you might want to fix the whole util.php as this is used on several places. But i will just close the PR as the module check is not very reliable. |
||
. ' Please ask your server administrator to disable it.') | ||
); | ||
$webServerRestart = true; | ||
} | ||
|
||
/** | ||
* PHP 5.6 ships with a PHP setting which throws notices by default for a | ||
|
@@ -1464,4 +1484,17 @@ public static function needUpgrade(\OCP\IConfig $config) { | |
} | ||
} | ||
|
||
/** | ||
* Check if an apache module is enabled. | ||
* | ||
* @param string $module The module to check | ||
* @return bool true if the module is enabled, false otherwise | ||
*/ | ||
private static function apacheModuleEnabled($module) { | ||
if (function_exists('apache_get_modules')) { | ||
return in_array($module, apache_get_modules()); | ||
} else { | ||
return false; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New array annotation please while at it :)
['foo']