summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-12-09 16:38:56 +0100
committerAndrey Andreev <narf@devilix.net>2014-12-09 16:38:56 +0100
commitcd94dd7e1d8969658810ccc4158a75d2936d0a44 (patch)
treea1b0975039010a4848fb92e5589721585835a32f
parent562e39bab43181fb709aeaf4dee14bf481a2cc6a (diff)
#3073 (feature/session): Allow custom drivers without the CI_ or MY_ prefix
-rw-r--r--system/libraries/Session/Session.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index 1d93cb1c8..4fa9fd248 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -194,6 +194,17 @@ class CI_Session {
}
$class = 'Session_'.$driver.'_driver';
+
+ // Allow custom drivers without the CI_ or MY_ prefix
+ if ( ! class_exists($class, FALSE) && file_exists($file_path = APPPATH.'libraries/Session/drivers/'.$class.'.php'))
+ {
+ require_once($file_path);
+ if (class_exists($class, FALSE))
+ {
+ return $class;
+ }
+ }
+
if ( ! class_exists('CI_'.$class, FALSE))
{
if (file_exists($file_path = APPPATH.'libraries/Session/drivers/'.$class.'.php') OR file_exists($file_path = BASEPATH.'libraries/Session/drivers/'.$class.'.php'))
@@ -201,7 +212,7 @@ class CI_Session {
require_once($file_path);
}
- if ( ! class_exists('CI_'.$class, FALSE))
+ if ( ! class_exists('CI_'.$class, FALSE) && ! class_exists($class, FALSE))
{
log_message('error', "Session: Configured driver '".$driver."' was not found. Aborting.");
return FALSE;