diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-02-24 13:10:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-24 13:10:47 -0600 |
commit | 8a7b8f966e476173416cdd5fd7fc0e01de34aa1f (patch) | |
tree | 415e3add747e2bff7ea534d956c050dfddad2377 /settings | |
parent | dd6d2893a66f68157c2fab4deb06f336642c6a02 (diff) | |
parent | cee8853658703358a8e564c414807c632ee0d5ea (diff) | |
download | nextcloud-server-8a7b8f966e476173416cdd5fd7fc0e01de34aa1f.tar.gz nextcloud-server-8a7b8f966e476173416cdd5fd7fc0e01de34aa1f.zip |
Merge pull request #3489 from nextcloud/give-hint-about-opcache
Show info in admin settings about PHP opcache if disabled
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/CheckSetupController.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index d9e4846672c..016f6a1dab2 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -26,6 +26,7 @@ namespace OC\Settings\Controller; +use bantu\IniGetWrapper\IniGetWrapper; use GuzzleHttp\Exception\ClientException; use OC\AppFramework\Http; use OC\IntegrityCheck\Checker; @@ -355,6 +356,42 @@ Raw output } /** + * Checks whether a PHP opcache is properly set up + * @return bool + */ + private function isOpcacheProperlySetup() { + $iniWrapper = new IniGetWrapper(); + + $isOpcacheProperlySetUp = true; + + if(!$iniWrapper->getBool('opcache.enable')) { + $isOpcacheProperlySetUp = false; + } + + if(!$iniWrapper->getBool('opcache.save_comments')) { + $isOpcacheProperlySetUp = false; + } + + if(!$iniWrapper->getBool('opcache.enable_cli')) { + $isOpcacheProperlySetUp = false; + } + + if($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { + $isOpcacheProperlySetUp = false; + } + + if($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { + $isOpcacheProperlySetUp = false; + } + + if($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { + $isOpcacheProperlySetUp = false; + } + + return $isOpcacheProperlySetUp; + } + + /** * @return DataResponse */ public function check() { @@ -372,6 +409,8 @@ Raw output 'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(), 'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(), 'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'), + 'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(), + 'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'), ] ); } |