diff options
author | Andrey Andreev <narf@devilix.net> | 2016-03-11 17:12:57 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-03-11 17:12:57 +0100 |
commit | 1be8987176ad422ae6bc8af5c8f148eba9b5dff1 (patch) | |
tree | 66dc8c484270427a1c0972b8fa0dbc9790c61c71 /system/libraries/Cache/drivers/Cache_apc.php | |
parent | f56068bfd34e3ebc1325b049bf33901d855c7321 (diff) |
Fix a number of CI_Cache bugs
Fixes #4277
Supersedes #4474
Really fixes #4066
Diffstat (limited to 'system/libraries/Cache/drivers/Cache_apc.php')
-rw-r--r-- | system/libraries/Cache/drivers/Cache_apc.php | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index dd18e7bc8..07ea8f474 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -49,6 +49,24 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class CI_Cache_apc extends CI_Driver { /** + * Class constructor + * + * Only present so that an error message is logged + * if APC is not available. + * + * @return void + */ + public function __construct() + { + if ( ! $this->is_supported()) + { + log_message('error', 'Cache: Failed to initialize APC; extension not loaded/enabled?'); + } + } + + // ------------------------------------------------------------------------ + + /** * Get * * Look for a value in the cache. If it exists, return the data @@ -198,13 +216,6 @@ class CI_Cache_apc extends CI_Driver { */ public function is_supported() { - if ( ! extension_loaded('apc') OR ! ini_get('apc.enabled')) - { - log_message('debug', 'The APC PHP extension must be loaded to use APC Cache.'); - return FALSE; - } - - return TRUE; + return (extension_loaded('apc') && ini_get('apc.enabled')); } - } |