From eca7dd65ade31198449b4c9c26e1acc808baa180 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Fri, 7 Oct 2016 10:28:23 +1100 Subject: [PATCH] MDL-56308 cache: Fix APC ready rules for CLI scripts When APCu is enabled, but the CLI is not it's possible for calls to enable APCu to fail because it's not configured on the command line. --- cache/stores/apcu/lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cache/stores/apcu/lib.php b/cache/stores/apcu/lib.php index a0dd6b8fced..27cd2e65371 100644 --- a/cache/stores/apcu/lib.php +++ b/cache/stores/apcu/lib.php @@ -69,7 +69,8 @@ class cachestore_apcu extends cache_store implements cache_is_key_aware, cache_i * @return bool True if the stores software/hardware requirements have been met and it can be used. False otherwise. */ public static function are_requirements_met() { - if (!extension_loaded('apcu') || !ini_get('apc.enabled')) { + $enabled = ini_get('apc.enabled') && (php_sapi_name() != "cli" || ini_get('apc.enable_cli')); + if (!extension_loaded('apcu') || !$enabled) { return false; }