From: Brion Vibber Date: Thu, 14 Jan 2010 22:07:24 +0000 (-0800) Subject: Clean up host/port separation in memcached plugin -- use : not ; as separator and... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5783874cc20ab0f856ea6b3f41510a303a8bd3a2;p=quix0rs-gnu-social.git Clean up host/port separation in memcached plugin -- use : not ; as separator and clean up some warnings --- diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php index bc7fd90765..5214ab9c89 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); }