fix "PHP Fatal error: APCuIterator::__construct(): APC must be enabled to use" in setup-cli

This commit is contained in:
Ralf Becker 2016-08-02 11:42:05 +02:00
parent 0dce66e4a0
commit a2439dec02

View File

@ -151,6 +151,11 @@ class Apcu extends Base implements Provider
*/ */
function flush(array $keys) function flush(array $keys)
{ {
// do NOT try instanciating APCuIterator, if APCu is not enabled, as it gives a PHP Fatal Error
if (!ini_get('apc.enabled') || php_sapi_name() === 'cli' && !ini_get('apc.cli_enabled'))
{
return false;
}
if (!$keys && function_exists('apcu_clear_cache')) if (!$keys && function_exists('apcu_clear_cache'))
{ {
apcu_clear_cache(); apcu_clear_cache();