fix commented out reuse of already instanciated provider, and fix PHP Notice in memcache provider

This commit is contained in:
Ralf Becker 2015-09-14 13:48:58 +00:00
parent 598afb0dae
commit ff036416bf
2 changed files with 4 additions and 3 deletions

View File

@ -497,7 +497,7 @@ class egw_cache
if ($level != self::TREE) $level = self::INSTANCE; if ($level != self::TREE) $level = self::INSTANCE;
//if (!isset($providers[$level])) if (!isset($providers[$level]))
{ {
$params = $GLOBALS['egw_info']['server']['cache_provider_'.strtolower($level)]; $params = $GLOBALS['egw_info']['server']['cache_provider_'.strtolower($level)];
if (!isset($params) && $level == self::INSTANCE && isset(self::$default_provider)) if (!isset($params) && $level == self::INSTANCE && isset(self::$default_provider))

View File

@ -62,8 +62,9 @@ class egw_cache_memcache extends egw_cache_provider_check implements egw_cache_p
$ok = false; $ok = false;
foreach($params as $host_port) foreach($params as $host_port)
{ {
list($host,$port) = explode(':',$host_port); $parts = explode(':',$host_port);
if (!$port) $port = 11211; // default port $host = array_shift($parts);
$port = $parts ? array_shift($parts) : 11211; // default port
$ok = $this->memcache->addServer($host,$port) || $ok; $ok = $this->memcache->addServer($host,$port) || $ok;
//error_log(__METHOD__."(".array2string($params).") memcache->addServer('$host',$port) = ".(int)$ok); //error_log(__METHOD__."(".array2string($params).") memcache->addServer('$host',$port) = ".(int)$ok);