MDL-56675 cachestore_memcached: Check all connected servers for support
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 4 May 2017 05:09:13 +0000 (13:09 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 4 May 2017 05:11:07 +0000 (13:11 +0800)
cache/stores/memcached/lib.php

index ba7a6d5..17389e1 100644 (file)
@@ -261,9 +261,13 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
                 $safecombination = true;
             }
 
-            if (!$safecombination && (version_compare($this->connection->getVersion(), '1.4.22') <= 0)) {
-                // This is memcached server version <= 1.4.22 which is a safe combination.
-                $safecombination = true;
+            if (!$safecombination) {
+                $allsafe = true;
+                foreach ($this->connection->getVersion() as $version) {
+                    $allsafe = $allsafe && (version_compare($version, '1.4.22') <= 0);
+                }
+                // All memcached servers connected are version <= 1.4.22 which is a safe combination.
+                $safecombination = $allsafe;
             }
 
             if (!$safecombination) {