diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-04-02 15:44:58 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-04-02 15:44:58 +0200 |
commit | eb2dcda02cd338f3230161b03ac4a55956b31bf9 (patch) | |
tree | 352de0920d310e2c8ff8a8c415d45e8f74c17d9a | |
parent | 9d0e61768acc8eb6adfd032cdc6fbeac4c024598 (diff) |
Added CI_ Prefix to the Cache driver.
-rw-r--r-- | system/libraries/Cache/Cache.php | 6 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_apc.php | 2 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_dummy.php | 2 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_file.php | 2 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_memcached.php | 2 | ||||
-rw-r--r-- | system/libraries/Driver.php | 24 | ||||
-rw-r--r-- | user_guide/changelog.html | 2 |
7 files changed, 21 insertions, 19 deletions
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index d3f6105ea..61e7aa761 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -24,11 +24,11 @@ * @author ExpressionEngine Dev Team * @link */ -class Cache extends CI_Driver_Library { +class CI_Cache extends CI_Driver_Library { protected $valid_drivers = array( - 'cache_apc', 'cache_file', 'cache_memcached', 'cache_dummy' - ); + 'cache_apc', 'cache_file', 'cache_memcached', 'cache_dummy' + ); protected $_cache_path = NULL; // Path of cache files (if file-based cache) protected $_adapter = 'dummy'; diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index 4b995c793..de75719c4 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -25,7 +25,7 @@ * @link */ -class Cache_apc extends CI_Driver { +class CI_Cache_apc extends CI_Driver { /** * Get diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php index 74f689241..de47acb43 100644 --- a/system/libraries/Cache/drivers/Cache_dummy.php +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -25,7 +25,7 @@ * @link */ -class Cache_dummy extends CI_Driver { +class CI_Cache_dummy extends CI_Driver { /** * Get diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 86d1a3b6a..13e2d1af6 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -25,7 +25,7 @@ * @link */ -class Cache_file extends CI_Driver { +class CI_Cache_file extends CI_Driver { protected $_cache_path; diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 5f5a31591..ec2fd216a 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -25,7 +25,7 @@ * @link */ -class Cache_memcached extends CI_Driver { +class CI_Cache_memcached extends CI_Driver { private $_memcached; // Holds the memcached object diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 02e093d7e..d1838f2c1 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -44,7 +44,11 @@ class CI_Driver_Library { // The class will be prefixed with the parent lib $child_class = $this->lib_name.'_'.$child; - if (in_array(strtolower($child_class), array_map('strtolower', $this->valid_drivers))) + // Remove the CI_ prefix and lowercase + $lib_name = strtolower(preg_replace('/^CI_/', '', $this->lib_name)); + $driver_name = strtolower(preg_replace('/^CI_/', '', $child_class)); + + if (in_array($driver_name, array_map('strtolower', $this->valid_drivers))) { // check and see if the driver is in a separate file if ( ! class_exists($child_class)) @@ -52,19 +56,15 @@ class CI_Driver_Library { // check application path first foreach (array(APPPATH, BASEPATH) as $path) { - // and check for case sensitivity of both the parent and child libs - foreach (array(ucfirst($this->lib_name), strtolower($this->lib_name)) as $lib) + // loves me some nesting! + foreach (array(ucfirst($driver_name), $driver_name) as $class) { - // loves me some nesting! - foreach (array(ucfirst($child_class), strtolower($child_class)) as $class) - { - $filepath = $path.'libraries/'.$this->lib_name.'/drivers/'.$child_class.EXT; + $filepath = $path.'libraries/'.$lib_name.'/drivers/'.$class.EXT; - if (file_exists($filepath)) - { - include_once $filepath; - break; - } + if (file_exists($filepath)) + { + include_once $filepath; + break; } } } diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 8335822b0..013c55766 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -69,6 +69,7 @@ Hg Tag: n/a</p> <li class="reactor"><kbd>constants.php</kbd> will now be loaded from the environment folder if available.</li> <li class="reactor">Added language key error logging</li> <li class="reactor">Added Environment Support for Hooks.</li> + <li class="reactor">Added CI_ Prefix to the <a href="libraries/caching.html">Cache driver</a>.</li> </ul> </li> <li>Database @@ -87,6 +88,7 @@ Hg Tag: n/a</p> <li class="reactor">Added form_validation_lang entries for <kbd>decimal</kbd>, <kbd>less_than</kbd> and <kbd>greater_than</kbd>.</li> <li class="reactor"><a href="https://bitbucket.org/ellislab/codeigniter-reactor/issue/153/escape-str-bug-in-mssql-driver">Fixed issue #153</a> Escape Str Bug in MSSQL driver.</li> <li class="reactor"><a href="https://bitbucket.org/ellislab/codeigniter-reactor/issue/172/bug-in-chrome-and-form_open-in-201">Fixed issue #172</a> Google Chrome 11 posts incorrectly when action is empty.</li> + </ul> <h2>Version 2.0.1</h2> |