summaryrefslogtreecommitdiffstats
path: root/system/core/Loader.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/core/Loader.php')
-rw-r--r--system/core/Loader.php31
1 files changed, 15 insertions, 16 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 70a6b6fa6..535c9e4db 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -261,33 +261,32 @@ class CI_Loader {
show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
}
- $model = strtolower($model);
-
- foreach ($this->_ci_model_paths as $mod_path)
+ if ($db_conn !== FALSE && ! class_exists('CI_DB', FALSE))
{
- if ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))
+ if ($db_conn === TRUE)
{
- continue;
+ $db_conn = '';
}
- if ($db_conn !== FALSE && ! class_exists('CI_DB', FALSE))
- {
- if ($db_conn === TRUE)
- {
- $db_conn = '';
- }
+ $CI->load->database($db_conn, FALSE, TRUE);
+ }
- $CI->load->database($db_conn, FALSE, TRUE);
- }
+ if ( ! class_exists('CI_Model', FALSE))
+ {
+ load_class('Model', 'core');
+ }
+
+ $model = ucfirst(strtolower($model));
- if ( ! class_exists('CI_Model', FALSE))
+ foreach ($this->_ci_model_paths as $mod_path)
+ {
+ if ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))
{
- load_class('Model', 'core');
+ continue;
}
require_once($mod_path.'models/'.$path.$model.'.php');
- $model = ucfirst($model);
$CI->$name = new $model();
$this->_ci_models[] = $name;
return;