diff options
author | Brion Vibber <brion@pobox.com> | 2010-01-14 14:07:24 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-01-14 14:14:32 -0800 |
commit | 5783874cc20ab0f856ea6b3f41510a303a8bd3a2 (patch) | |
tree | 973bac7f059b37b4fc5cb2f5eb56da99b5a924e4 | |
parent | 2f32181c930afbbfad7986f84df908cac4ef182d (diff) |
Clean up host/port separation in memcached plugin -- use : not ; as separator and clean up some warnings
-rw-r--r-- | plugins/MemcachePlugin.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php index bc7fd9076..5214ab9c8 100644 --- a/plugins/MemcachePlugin.php +++ b/plugins/MemcachePlugin.php @@ -165,20 +165,18 @@ class MemcachePlugin extends Plugin $this->_conn = new Memcache(); if (is_array($this->servers)) { - foreach ($this->servers as $server) { - list($host, $port) = @explode(';', $server); - if (empty($port)) { - $port = 11211; - } - - $this->_conn->addServer($host, $port, $this->persistent); - } + $servers = $this->servers; } else { - $this->_conn->addServer($this->servers, $this->persistent); - list($host, $port) = explode(';', $this->servers); - if (empty($port)) { + $servers = array($this->servers); + } + foreach ($servers as $server) { + if (strpos($server, ':') !== false) { + list($host, $port) = explode(':', $server); + } else { + $host = $server; $port = 11211; } + $this->_conn->addServer($host, $port, $this->persistent); } |