From 70d9c46cf863ec5473d7284ad663048e3f820a51 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 31 Jan 2020 18:14:02 +0100 Subject: [PATCH] Added check for disabled opcache functions --- wcfsetup/test.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/wcfsetup/test.php b/wcfsetup/test.php index 53b75450bb..a2bf23784e 100644 --- a/wcfsetup/test.php +++ b/wcfsetup/test.php @@ -255,6 +255,10 @@ $phrases = [ 'de' => 'Arbeitsspeicher-Limit %s ist nicht ausreichend. 128M oder mehr wird benötigt.', 'en' => 'Memory limit %s is too low. It needs to be set to 128M or more.', ], + 'php_opcache_failure' => [ + 'de' => 'OPcache ist aktiviert aber die erforderlichen Verwaltungsfunktionen (opcache_reset, opcache_invalidate) sind deaktiviert.', + 'en' => 'OPcache is enabled but the required management functions (opcache_reset, opcache_invalidate) are disabled.', + ], 'mysql_requirements' => [ 'de' => 'MySQL', 'en' => 'MySQL Requirements' @@ -335,7 +339,7 @@ function checkHashAlgorithms() { function checkResult() { global $requiredExtensions; - if (!checkPHPVersion() || !checkHashAlgorithms() || !checkMemoryLimit()) return false; + if (!checkPHPVersion() || !checkHashAlgorithms() || !checkMemoryLimit() || !checkOpcache()) return false; foreach ($requiredExtensions as $extension) { if (!extension_loaded($extension)) return false; @@ -348,6 +352,16 @@ function checkResult() { function checkInstallFile() { return @file_exists('install.php'); } +function checkOpcache() { + if (extension_loaded('Zend Opcache') && @ini_get('opcache.enable')) { + $disabledFunctions = explode(',', @ini_get('disable_functions')); + if (in_array('opcache_reset', $disabledFunctions) || in_array('opcache_invalidate', $disabledFunctions)) { + return false; + } + } + + return true; +} ?>

WoltLab Suite System Requirements Test

@@ -387,6 +401,10 @@ function checkInstallFile() {
  • + + +
  • +

    -- 2.20.1