From 1638f89e8920798a731be6efec61e69dec5f74ac Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Wed, 30 Jan 2019 16:28:47 +0100 Subject: Don't call apc_delete_file and apc_clear_cache anymore There is no apc for PHP7+ so there is no need to check if exist. accelerator_reset looks even more ancient. Signed-off-by: Daniel Kesselberg --- lib/private/legacy/util.php | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'lib/private/legacy') diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index a94ced8bb1f..cd6ce0b64ae 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -1334,19 +1334,11 @@ class OC_Util { * @param string $path the path of the file to clear from the cache * @return bool true if underlying function returns true, otherwise false */ - public static function deleteFromOpcodeCache($path) { - $ret = false; - if ($path) { - // APC >= 3.1.1 - if (function_exists('apc_delete_file')) { - $ret = @apc_delete_file($path); - } - // Zend OpCache >= 7.0.0, PHP >= 5.5.0 - if (function_exists('opcache_invalidate')) { - $ret = @opcache_invalidate($path); - } + public static function deleteFromOpcodeCache($path): bool { + if (!empty($path) && function_exists('opcache_invalidate')) { + return @opcache_invalidate($path); // Zend OpCache >= 7.0.0, PHP >= 5.5.0 } - return $ret; + return false; } /** @@ -1355,21 +1347,10 @@ class OC_Util { * in case the opcode cache does not re-validate files * * @return void - * @suppress PhanDeprecatedFunction - * @suppress PhanUndeclaredConstant */ - public static function clearOpcodeCache() { - // APC - if (function_exists('apc_clear_cache')) { - apc_clear_cache(); - } - // Zend Opcache - if (function_exists('accelerator_reset')) { - accelerator_reset(); - } - // Opcache (PHP >= 5.5) + public static function clearOpcodeCache(): void { if (function_exists('opcache_reset')) { - @opcache_reset(); + @opcache_reset(); // Opcache (PHP >= 5.5) } } -- cgit v1.2.3