Accessing Admin Performance Page Issue on Nginx

Issue Description

If you try to access Performance page from Admin it will abend on Nginx powered Elgg installation.

Reason

Below piece of code in file elgg\vendor\elgg\elgg\views\default\admin\performance is causing the issue. I think this piece of code should check if server is Nginx or Apache and based on that should execute. The server determination code is already present in elgg\vendor\elgg\elgg\views\default\admin\server

Hope to get it fixed in upcoming release. As of now I am commenting it.

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);
}
  • I just solved this by wrapping above code in IF statement to check if Server is Apache Server. I tried creating a plugin but failed. If someone can point me one of my query it would help.

    I tried to create plugin and override the view by creating file in my-plugin/views/default/admin/performance/generic.php but it did not work.

    if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) {
        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);
        }   
    }