diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-06-04 23:51:29 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-06-04 23:51:29 +0200 |
commit | 8fe766dcd4251070c4b9dc52e882b14189e3df66 (patch) | |
tree | e7bff469416adb5de74b7491afe0be316287e227 /system | |
parent | 39b1c11f5976104dce30fe83e1d3c6f9ed616122 (diff) | |
parent | 3fa2b6117ed8082439834870ddd52d700e2ad60b (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/Cache/Cache.php | 38 | ||||
-rw-r--r-- | system/libraries/Driver.php | 2 |
2 files changed, 18 insertions, 22 deletions
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index ba732ee8e..53f9f81a7 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -68,7 +68,7 @@ class CI_Cache extends CI_Driver_Library { * * @param string */ - protected $_backup_driver; + protected $_backup_driver = 'dummy'; /** * Constructor @@ -102,6 +102,22 @@ class CI_Cache extends CI_Driver_Library { $this->_backup_driver = $config['backup']; } } + + // If the specified adapter isn't available, check the backup. + if ( ! $this->is_supported($this->_adapter)) + { + if ( ! $this->is_supported($this->_backup_driver)) + { + // Backup isn't supported either. Default to 'Dummy' driver. + log_message('error', 'Cache adapter "'.$this->_adapter.'" and backup "'.$this->_backup_driver.'" are both unavailable. Cache is now using "Dummy" adapter.'); + $this->_adapter = 'dummy'; + } + else + { + // Backup is supported. Set it to primary. + $this->_adapter = $this->_backup_driver; + } + } } // ------------------------------------------------------------------------ @@ -206,26 +222,6 @@ class CI_Cache extends CI_Driver_Library { return $support[$driver]; } - // ------------------------------------------------------------------------ - - /** - * __get() - * - * @param child - * @return object - */ - public function __get($child) - { - $obj = parent::__get($child); - - if ( ! $this->is_supported($child)) - { - $this->_adapter = $this->_backup_driver; - } - - return $obj; - } - } /* End of file Cache.php */ diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index c79698c7b..d67ee2549 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -51,7 +51,7 @@ class CI_Driver_Library { * * @var string */ - protected static $lib_name; + protected $lib_name; /** * The first time a child is used it won't exist, so we instantiate it |