James Sanderson avatar James Sanderson committed 0fdbd04

Proposed fix for issue #19 part two: Allow autoloader to correctly re-run

Comments (0)

Files changed (1)

system/core/Loader.php

 	var $_ci_models			= array();
 	var $_ci_helpers		= array();
 	var $_ci_varmap			= array('unit_test' => 'unit', 'user_agent' => 'agent');
+	var $_ci_autoload;
 
 
 	/**
 	 */
 	function _ci_autoloader()
 	{
-		if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT))
+		if( is_null($this->_ci_autoload))
 		{
-			include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT);
-		}
-		else
-		{
-			include_once(APPPATH.'config/autoload'.EXT);
+			if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT))
+			{
+				include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT);
+			}
+			else
+			{
+				include_once(APPPATH.'config/autoload'.EXT);
+			}
+			
+	
+			if ( ! isset($autoload))
+			{
+				return FALSE;
+			}
+			
+			$this->_ci_autoload = &$autoload;
 		}
 		
-
-		if ( ! isset($autoload))
-		{
-			return FALSE;
-		}
+		$autoload = &$this->_ci_autoload;
 
 		// Autoload packages
 		if (isset($autoload['packages']))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.