Commits

Phil Sturgeon committed 60c36d1

Added CI_ Prefix to the Cache driver.

Comments (0)

Files changed (7)

system/libraries/Cache/Cache.php

  * @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';

system/libraries/Cache/drivers/Cache_apc.php

  * @link		
  */
 
-class Cache_apc extends CI_Driver {
+class CI_Cache_apc extends CI_Driver {
 
 	/**
 	 * Get 

system/libraries/Cache/drivers/Cache_dummy.php

  * @link		
  */
 
-class Cache_dummy extends CI_Driver {
+class CI_Cache_dummy extends CI_Driver {
 
 	/**
 	 * Get 

system/libraries/Cache/drivers/Cache_file.php

  * @link		
  */
 
-class Cache_file extends CI_Driver {
+class CI_Cache_file extends CI_Driver {
 
 	protected $_cache_path;
 

system/libraries/Cache/drivers/Cache_memcached.php

  * @link		
  */
 
-class Cache_memcached extends CI_Driver {
+class CI_Cache_memcached extends CI_Driver {
 
 	private $_memcached;	// Holds the memcached object
 

system/libraries/Driver.php

 		// 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))
 				// 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/'.$lib_name.'/drivers/'.$class.EXT;
+
+						if (file_exists($filepath))
 						{
-							$filepath = $path.'libraries/'.$this->lib_name.'/drivers/'.$child_class.EXT;
-
-							if (file_exists($filepath))
-							{
-								include_once $filepath;
-								break;
-							}
+							include_once $filepath;
+							break;
 						}
 					}
 				}

user_guide/changelog.html

 			<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
 	<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>