Permalink
Browse files

Added support to load drivers as libraries

  • Loading branch information...
1 parent 242b1f2 commit 8f498dbbf8aca9df2769c3f7bf6d0a49e0e79015 @dchill42 committed Dec 8, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 system/core/Loader.php
View
@@ -800,7 +800,7 @@ public function driver($library = '', $params = NULL, $object_name = NULL)
{
if ( ! class_exists('CI_Driver_Library'))
{
- // we aren't instantiating an object here, that'll be done by the Library itself
+ // We aren't instantiating an object here, that'll be done by the Library itself
require BASEPATH.'libraries/Driver.php';
}
@@ -1198,11 +1198,17 @@ protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
return;
}
+ // If this looks like a driver, make sure the base class is loaded
+ if (strtolower($subdir) == strtolower($class).'/' && !class_exists('CI_Driver_Library'))
+ {
+ // We aren't instantiating an object here, that'll be done by the Library itself
+ require BASEPATH.'libraries/Driver.php';
+ }
+
include_once($filepath);
$this->_ci_loaded_files[] = $filepath;
return $this->_ci_init_class($class, '', $params, $object_name);
}
-
} // END FOREACH
// One last attempt. Maybe the library is in a subdirectory, but it wasn't specified?

0 comments on commit 8f498db

Please sign in to comment.