]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Better handling for combined memcache identifiers
authorEvan Prodromou <evan@status.net>
Fri, 10 Jun 2011 23:13:33 +0000 (19:13 -0400)
committerEvan Prodromou <evan@status.net>
Fri, 10 Jun 2011 23:13:33 +0000 (19:13 -0400)
classes/Status_network.php

index c1d4cd26f389ce46df146bc4110e1f47ab6eafb4..b7a7e1c0a7de0ae09a7a8cabaede07c0041fff2f 100644 (file)
@@ -92,12 +92,18 @@ class Status_network extends Safe_DataObject
             // or a single-process script which is switching
             // configurations.
             $persist = php_sapi_name() != 'cli' || self::$cacheInitialized;
-            if (is_array($servers)) {
-                foreach($servers as $server) {
-                    self::$cache->addServer($server, 11211, $persist);
+            if (!is_array($servers)) {
+                $servers = array($servers);
+            } 
+            foreach($servers as $server) {
+                $parts = explode(':', $server);
+                $server = $parts[0];
+                if (count($parts) > 1) {
+                    $port = $parts[1];
+                } else {
+                    $port = 11211;
                 }
-            } else {
-                self::$cache->addServer($servers, 11211, $persist);
+                self::$cache->addServer($server, $port, $persist);
             }
             self::$cacheInitialized = true;
         }