Skip to content

Commit

Permalink
Merge pull request #12803 from jeabakker/apache-stats
Browse files Browse the repository at this point in the history
fix(admin): prevent fatal error on non Apache servers
  • Loading branch information
jeabakker committed Aug 28, 2019
2 parents 719b7b0 + 3da3034 commit fe1f1ed
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions views/default/admin/performance/generic.php
Expand Up @@ -26,19 +26,22 @@
};

// apache version
if (apache_get_version() !== false) {
$icon = $icon_warning;
$title = elgg_echo('admin:performance:apache:mod_cache');
$value = elgg_echo('status:unavailable');
$subtext = '';

if (in_array('mod_cache', apache_get_modules())) {
$value = elgg_echo('status:enabled');
} else {
$subtext = elgg_echo('admin:performance:apache:mod_cache:warning');
// Check if the function exists before callling it else it may fail in case of Nginx or other Non Apache servers
if (function_exists('apache_get_version')) {
if (apache_get_version() !== false) {
$icon = $icon_warning;
$title = elgg_echo('admin:performance:apache:mod_cache');
$value = elgg_echo('status:unavailable');
$subtext = '';

if (in_array('mod_cache', apache_get_modules())) {
$value = elgg_echo('status:enabled');
} else {
$subtext = elgg_echo('admin:performance:apache:mod_cache:warning');
}

echo $view_module($icon, $title, $value, $subtext);
}

echo $view_module($icon, $title, $value, $subtext);
}

// open_basedir
Expand Down

0 comments on commit fe1f1ed

Please sign in to comment.