]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Clean up host/port separation in memcached plugin -- use : not ; as separator and...
authorBrion Vibber <brion@pobox.com>
Thu, 14 Jan 2010 22:07:24 +0000 (14:07 -0800)
committerBrion Vibber <brion@pobox.com>
Thu, 14 Jan 2010 22:14:32 +0000 (14:14 -0800)
plugins/MemcachePlugin.php

index bc7fd907655d7279f72677eb4309e3b631d29a0c..5214ab9c8983329aa0fa10e909910b24d41663e3 100644 (file)
@@ -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);
             }