Skip to content

Commit c081b69

Browse files
committed
Admin: Add info on OPcache and APCu in system_status.php
1 parent 0f7abf6 commit c081b69

1 file changed

Lines changed: 49 additions & 1 deletion

File tree

public/main/inc/lib/diagnoser.lib.php

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ public function get_php_data()
715715
'zlib' => ['link' => 'https://php.net/zlib', 'expected' => 1, 'comment' => get_lang('This extension must be loaded.')],
716716
'apcu' => ['link' => 'https://php.net/apcu', 'expected' => 2, 'comment' => get_lang('This extension should be loaded.')],
717717
'bcmath' => ['link' => 'https://php.net/bcmath', 'expected' => 2, 'comment' => get_lang('This extension should be loaded.')],
718-
'OPcache' => ['link' => 'https://php.net/opcache', 'expected' => 2, 'comment' => get_lang('This extension should be loaded.')],
718+
'Zend OPcache' => ['link' => 'https://php.net/opcache', 'expected' => 2, 'comment' => get_lang('This extension should be loaded.')],
719719
'openssl' => ['link' => 'https://php.net/openssl', 'expected' => 2, 'comment' => get_lang('This extension should be loaded.')],
720720
'xsl' => ['link' => 'https://php.net/xsl', 'expected' => 2, 'comment' => get_lang('This extension should be loaded.')],
721721
'xapian' => ['link' => 'https://xapian.org/docs/bindings/php/', 'expected' => 2, 'comment' => get_lang('This extension should be loaded.')],
@@ -740,6 +740,54 @@ public function get_php_data()
740740
);
741741
}
742742

743+
$setting = ini_get('opcache.enable');
744+
$req_setting = '1';
745+
$status = $setting == $req_setting ? self::STATUS_OK : self::STATUS_WARNING;
746+
$array[] = $this->build_setting(
747+
$status,
748+
'[opcache]',
749+
'opcache.enable',
750+
'https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.enable',
751+
$setting,
752+
$req_setting,
753+
null,
754+
get_lang('The OPcache module needs to be both installed and enabled in order to be used.')
755+
);
756+
757+
$setting = ini_get('opcache.memory_consumption');
758+
$req_setting = '>= 128M';
759+
$status = self::STATUS_INFORMATION;
760+
if ((int) $setting >= 128) {
761+
$status = self::STATUS_OK;
762+
}
763+
$array[] = $this->build_setting(
764+
$status,
765+
'[opcache]',
766+
'opcache.memory_consumption',
767+
'https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.memory-consumption',
768+
$setting,
769+
$req_setting,
770+
null,
771+
get_lang('Allowing OPCache memory_consumption to reach 128MB of RAM at least is recommended.')
772+
);
773+
774+
$setting = 0;
775+
if (function_exists('apcu_enabled')) {
776+
$setting = (int) apcu_enabled();
777+
}
778+
$req_setting = 1;
779+
$status = $setting == $req_setting ? self::STATUS_OK : self::STATUS_INFORMATION;
780+
$array[] = $this->build_setting(
781+
$status,
782+
'[apcu]',
783+
'apc.enabled',
784+
'https://www.php.net/manual/en/function.apcu-enabled.php',
785+
$setting,
786+
$req_setting,
787+
null,
788+
get_lang('The APCu extension needs to be both installed and enabled in order to be used.')
789+
);
790+
743791
return $array;
744792
}
745793

0 commit comments

Comments
 (0)