From: Alexander Ebert Date: Thu, 14 Feb 2013 20:11:40 +0000 (+0100) Subject: Added IPv6 support for Memcached X-Git-Tag: 2.0.0_Beta_1~479 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=85833ebb5d802e604395ab0a5a30c95992802900;p=GitHub%2FWoltLab%2FWCF.git Added IPv6 support for Memcached Fixes #1140 --- diff --git a/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php index a7b27a71cc..6e66505ff1 100644 --- a/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php @@ -1,6 +1,7 @@ match($host)) { + $matches = $regex->getMatches(); + $host = $matches[1]; + if (isset($matches[2])) { + $port = $matches[2]; + } + if (isset($matches[3])) { + $weight = $matches[3]; + } + } + else { + // IPv4, try to get port and weight + if (strpos($host, ':')) { + $parsedHost = explode(':', $host); + $host = $parsedHost[0]; + $port = $parsedHost[1]; + + if (isset($parsedHost[2])) { + $weight = $parsedHost[2]; + } } }