From cd94dd7e1d8969658810ccc4158a75d2936d0a44 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 9 Dec 2014 17:38:56 +0200 Subject: #3073 (feature/session): Allow custom drivers without the CI_ or MY_ prefix --- system/libraries/Session/Session.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'system/libraries') 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; -- cgit v1.2.3-24-g4f1b