summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-06-04 23:30:39 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-06-04 23:30:39 +0200
commit3fa2b6117ed8082439834870ddd52d700e2ad60b (patch)
treeb69fdc375bfe406a698cf3b235e6bbe0316ef554 /system/libraries
parent005dd437c506706f3f277eac76eb1b4a3bbc1b2d (diff)
parentbf50a3b15c70441a72ec3012319cd63425ba4d20 (diff)
Merge pull request #1403 from cryode/bug/cache_backup
Fix issue where cache backup is ignored on first call.
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Cache/Cache.php38
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 */