Commits

Joël Cox  committed 7549003

Fixed bug that prevented global config from loading on error

  • Participants
  • Parent commits 26b18a1

Comments (0)

Files changed (1)

File system/core/Config.php

 				continue;
 			}
 
-			if ( ! $file_path)
+			if ( ! file_exists($file_path))
 			{
-				if ( ! file_exists($path.'config/'.$file.EXT))
+				log_message('debug', 'Config for '.ENVIRONMENT.' environment is not found. Trying global config.');
+				$file_path = $path.'config/'.$file.EXT;
+				
+				if ( ! file_exists($file_path))
 				{
-					$file_path = $path.'config/'.$file.EXT;
+					continue;
 				}
 			}
-
+			
 			include($file_path);
 
 			if ( ! isset($config) OR ! is_array($config))
 			{
 				return FALSE;
 			}
-			show_error('The configuration file '.$environment.'/'.$file.EXT.' does not exist.');
+			show_error('The configuration file '.ENVIRONMENT.'/'.$file.EXT.' and '.$file.EXT.' do not exist.');
 		}
 		
 		return TRUE;