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/libraries/Cache/Cache.php | |
parent | 39b1c11f5976104dce30fe83e1d3c6f9ed616122 (diff) | |
parent | 3fa2b6117ed8082439834870ddd52d700e2ad60b (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/libraries/Cache/Cache.php')
-rw-r--r-- | system/libraries/Cache/Cache.php | 38 |
1 files changed, 17 insertions, 21 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 */ |