summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-07-30 10:02:45 +0200
committerAleksander Machniak <alec@alec.pl>2012-07-30 10:02:45 +0200
commitc2d19b7f2439c250b4f6d4edca4840df2982973a (patch)
tree38b164710fd874a04ad1aa4740e061409a22b1a6
parent00f6457703e02b07c1a116143ed2565ee71aca8b (diff)
Fix so memcache hostname starting with "unix" isn't handled as socket file
-rw-r--r--program/include/rcmail.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index e77942e63..9fdd33bf3 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -344,11 +344,11 @@ class rcmail
$this->memcache = new Memcache;
$this->mc_available = 0;
-
- // add alll configured hosts to pool
+
+ // add all configured hosts to pool
$pconnect = $this->config->get('memcache_pconnect', true);
foreach ($this->config->get('memcache_hosts', array()) as $host) {
- if (substr($host, 0, 4) != 'unix') {
+ if (substr($host, 0, 7) != 'unix://') {
list($host, $port) = explode(':', $host);
if (!$port) $port = 11211;
}
@@ -357,7 +357,7 @@ class rcmail
}
$this->mc_available += intval($this->memcache->addServer($host, $port, $pconnect, 1, 1, 15, false, array($this, 'memcache_failure')));
}
-
+
// test connection and failover (will result in $this->mc_available == 0 on complete failure)
$this->memcache->increment('__CONNECTIONTEST__', 1); // NOP if key doesn't exist
@@ -367,14 +367,14 @@ class rcmail
return $this->memcache;
}
-
+
/**
* Callback for memcache failure
*/
public function memcache_failure($host, $port)
{
static $seen = array();
-
+
// only report once
if (!$seen["$host:$port"]++) {
$this->mc_available--;