summaryrefslogtreecommitdiffstats
path: root/system/libraries/Session
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-25 14:07:35 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-25 14:07:35 +0100
commit89ecc8a1c69bed3451d43d3f0a367f4e498d1b80 (patch)
tree91abfa8346b81a3b98ae567f5c7c608b1dc3394d /system/libraries/Session
parentade05b40714070bcda7ab32187068e95b98c8cf8 (diff)
parent6262d053db57957c4445ef7fce76070854c3e30d (diff)
Merge pull request #2029 from dchill42/driver_ext
Added driver extension support
Diffstat (limited to 'system/libraries/Session')
-rw-r--r--system/libraries/Session/Session.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index 96e65f154..b6c862dae 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -107,17 +107,15 @@ class CI_Session extends CI_Driver_Library {
// Get valid drivers list
$this->valid_drivers = array(
- 'Session_native',
- 'Session_cookie'
+ 'native',
+ 'cookie'
);
$key = 'sess_valid_drivers';
$drivers = isset($params[$key]) ? $params[$key] : $CI->config->item($key);
if ($drivers)
{
- is_array($drivers) OR $drivers = array($drivers);
-
// Add driver names to valid list
- foreach ($drivers as $driver)
+ foreach ((array) $drivers as $driver)
{
if ( ! in_array(strtolower($driver), array_map('strtolower', $this->valid_drivers)))
{
@@ -134,9 +132,9 @@ class CI_Session extends CI_Driver_Library {
$driver = 'cookie';
}
- if ( ! in_array('session_'.strtolower($driver), array_map('strtolower', $this->valid_drivers)))
+ if ( ! in_array(strtolower($driver), array_map('strtolower', $this->valid_drivers)))
{
- $this->valid_drivers[] = 'Session_'.$driver;
+ $this->valid_drivers[] = $driver;
}
// Save a copy of parameters in case drivers need access
@@ -178,17 +176,17 @@ class CI_Session extends CI_Driver_Library {
/**
* Select default session storage driver
*
- * @param string Driver classname
+ * @param string Driver name
* @return void
*/
public function select_driver($driver)
{
// Validate driver name
- $lowername = strtolower(str_replace('CI_', '', $driver));
- if (in_array($lowername, array_map('strtolower', $this->valid_drivers)))
+ $prefix = (string) get_instance()->config->item('subclass_prefix');
+ $child = strtolower(str_replace(array('CI_', $prefix, $this->lib_name.'_'), '', $driver));
+ if (in_array($child, array_map('strtolower', $this->valid_drivers)))
{
// See if driver is loaded
- $child = str_replace($this->lib_name.'_', '', $driver);
if (isset($this->$child))
{
// See if driver is already current