summaryrefslogtreecommitdiffstats
path: root/system/libraries/Session
diff options
context:
space:
mode:
authorkemeng <kemeng@autohello.com>2015-11-16 13:03:24 +0100
committerkemeng <kemeng@autohello.com>2015-11-16 13:03:24 +0100
commite9e4ab00991343ba94f9542c1a6f18a42b559257 (patch)
treee0e3a823fcef84be85446053dede809812996c5c /system/libraries/Session
parent47c37de5ec5f673b9db13a3c0f4d899fd651d703 (diff)
do not try to auth/select db on redis connect failure
Diffstat (limited to 'system/libraries/Session')
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index 44ffddc4b..8f9bcce24 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -141,31 +141,37 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
return FALSE;
}
+ $connected = TRUE;
$redis = new Redis();
if ($this->_config['save_path']['type'] == 'unix')
{
if ( ! $redis->connect($this->_config['save_path']['path']))
{
log_message('error', 'Session: Unable to connect to Redis with the configured settings.');
+ $connected = FALSE;
}
}
elseif ( ! $redis->connect($this->_config['save_path']['host'], $this->_config['save_path']['port'], $this->_config['save_path']['timeout']))
{
log_message('error', 'Session: Unable to connect to Redis with the configured settings.');
+ $connected = FALSE;
}
- if (isset($this->_config['save_path']['password']) && ! $redis->auth($this->_config['save_path']['password']))
+ if ($connected)
{
- log_message('error', 'Session: Unable to authenticate to Redis instance.');
- }
- elseif (isset($this->_config['save_path']['database']) && ! $redis->select($this->_config['save_path']['database']))
- {
- log_message('error', 'Session: Unable to select Redis database with index '.$this->_config['save_path']['database']);
- }
- else
- {
- $this->_redis = $redis;
- return TRUE;
+ if (isset($this->_config['save_path']['password']) && ! $redis->auth($this->_config['save_path']['password']))
+ {
+ log_message('error', 'Session: Unable to authenticate to Redis instance.');
+ }
+ elseif (isset($this->_config['save_path']['database']) && ! $redis->select($this->_config['save_path']['database']))
+ {
+ log_message('error', 'Session: Unable to select Redis database with index '.$this->_config['save_path']['database']);
+ }
+ else
+ {
+ $this->_redis = $redis;
+ return TRUE;
+ }
}
return FALSE;