From 4933c16efd7bad7353877910b7d43d0b5a87735e Mon Sep 17 00:00:00 2001 From: Masterklavi Date: Sat, 12 Mar 2016 11:26:28 +0500 Subject: Renamed $this->_memcache_conf to $this->_config --- system/libraries/Cache/drivers/Cache_memcached.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_memcached.php') diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index c44958b97..09dc7b0de 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -60,7 +60,7 @@ class CI_Cache_memcached extends CI_Driver { * * @var array */ - protected $_memcache_conf = array( + protected $_config = array( 'default' => array( 'host' => '127.0.0.1', 'port' => 11211, @@ -81,17 +81,17 @@ class CI_Cache_memcached extends CI_Driver { { // Try to load memcached server info from the config file. $CI =& get_instance(); - $defaults = $this->_memcache_conf['default']; + $defaults = $this->_config['default']; if ($CI->config->load('memcached', TRUE, TRUE)) { if (is_array($CI->config->config['memcached'])) { - $this->_memcache_conf = array(); + $this->_config = array(); foreach ($CI->config->config['memcached'] as $name => $conf) { - $this->_memcache_conf[$name] = $conf; + $this->_config[$name] = $conf; } } } @@ -109,7 +109,7 @@ class CI_Cache_memcached extends CI_Driver { log_message('error', 'Cache: Failed to create Memcache(d) object; extension not loaded?'); } - foreach ($this->_memcache_conf as $cache_server) + foreach ($this->_config as $cache_server) { isset($cache_server['hostname']) OR $cache_server['hostname'] = $defaults['host']; isset($cache_server['port']) OR $cache_server['port'] = $defaults['port']; -- cgit v1.2.3-24-g4f1b From 2f10aebf8ca7d650ecf7614e8d5e3455c88f96d9 Mon Sep 17 00:00:00 2001 From: Masterklavi Date: Sat, 12 Mar 2016 11:28:57 +0500 Subject: Reduction of constructions --- system/libraries/Cache/drivers/Cache_memcached.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_memcached.php') diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 09dc7b0de..7a3267a1e 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -87,12 +87,7 @@ class CI_Cache_memcached extends CI_Driver { { if (is_array($CI->config->config['memcached'])) { - $this->_config = array(); - - foreach ($CI->config->config['memcached'] as $name => $conf) - { - $this->_config[$name] = $conf; - } + $this->_config = $CI->config->config['memcached']; } } -- cgit v1.2.3-24-g4f1b From d03832c6ee27ac1dcf3c5bff3831fcfdd35765f6 Mon Sep 17 00:00:00 2001 From: Masterklavi Date: Sat, 12 Mar 2016 11:31:16 +0500 Subject: Combined two "if" conditions to one --- system/libraries/Cache/drivers/Cache_memcached.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_memcached.php') diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 7a3267a1e..02b2d438e 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -83,12 +83,9 @@ class CI_Cache_memcached extends CI_Driver { $CI =& get_instance(); $defaults = $this->_config['default']; - if ($CI->config->load('memcached', TRUE, TRUE)) + if ($CI->config->load('memcached', TRUE, TRUE) && is_array($CI->config->config['memcached'])) { - if (is_array($CI->config->config['memcached'])) - { - $this->_config = $CI->config->config['memcached']; - } + $this->_config = $CI->config->config['memcached']; } if (class_exists('Memcached', FALSE)) -- cgit v1.2.3-24-g4f1b From a604554c592c090334b3a57d41e498d6f03fd1e4 Mon Sep 17 00:00:00 2001 From: Masterklavi Date: Sat, 12 Mar 2016 15:27:58 +0500 Subject: Removed an unnecessary is_array() check. --- system/libraries/Cache/drivers/Cache_memcached.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Cache/drivers/Cache_memcached.php') diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 02b2d438e..2d6236a6f 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -83,7 +83,7 @@ class CI_Cache_memcached extends CI_Driver { $CI =& get_instance(); $defaults = $this->_config['default']; - if ($CI->config->load('memcached', TRUE, TRUE) && is_array($CI->config->config['memcached'])) + if ($CI->config->load('memcached', TRUE, TRUE)) { $this->_config = $CI->config->config['memcached']; } -- cgit v1.2.3-24-g4f1b