|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2009-06-18 19:09 UTC] s dot loeuillet at gmail dot com
 Description: ------------ "Attached" is a patch against 1.1.2.3 (latest version from 3.04) that makes it support TCP sockets as well as Unix domain sockets. Find it there : http://new.leroutier.net/memcache.php_unixsocket_support.patch A full version with this change + an additional merge from APC page : http://new.leroutier.net/memcache.php-sl Reproduce code: --------------- http://new.leroutier.net/memcache.php_unixsocket_support.patch http://new.leroutier.net/memcache.php-sl PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Thu Oct 30 23:00:01 2025 UTC | 
Index: memcache.php =================================================================== --- memcache.php (r?vision 300461) +++ memcache.php (copie de travail) @@ -48,12 +48,24 @@ ///////////MEMCACHE FUNCTIONS ///////////////////////////////////////////////////////////////////// +function get_host_port_from_server($server){ + $values = explode( ':', $server ); + if ( ($values[0] == 'unix' ) && ( !is_numeric( $values[1] ) ) ) + { + return Array( $server, 0 ); + } + else + { + return values; + } +} + function sendMemcacheCommands($command){ global $MEMCACHE_SERVERS; $result = array(); foreach($MEMCACHE_SERVERS as $server){ - $strs = explode(':',$server); + $strs = get_host_port_from_server($server); $host = $strs[0]; $port = $strs[1]; $result[$server] = sendMemcacheCommand($host,$port,$command); @@ -110,7 +122,7 @@ } function dumpCacheSlab($server,$slabId,$limit){ - list($host,$port) = explode(':',$server); + list($host,$port) = get_host_port_from_server($server); $resp = sendMemcacheCommand($host,$port,'stats cachedump '.$slabId.' '.$limit); return $resp; @@ -118,7 +130,7 @@ } function flushServer($server){ - list($host,$port) = explode(':',$server); + list($host,$port) = get_host_port_from_server($server); $resp = sendMemcacheCommand($host,$port,'flush_all'); return $resp; } @@ -842,7 +854,7 @@ $theKey = htmlentities(base64_decode($_GET['key'])); $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']]; - list($h,$p) = explode(':',$theserver); + list($h,$p) = get_host_port_from_server($theserver); $r = sendMemcacheCommand($h,$p,'get '.$theKey); echo <<<EOB <div class="info"><table cellspacing=0><tbody> @@ -865,7 +877,7 @@ } $theKey = htmlentities(base64_decode($_GET['key'])); $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']]; - list($h,$p) = explode(':',$theserver); + list($h,$p) = get_host_port_from_server($theserver); $r = sendMemcacheCommand($h,$p,'delete '.$theKey); echo 'Deleting '.$theKey.':'.$r; break;function get_host_port_from_server($server){ $values = explode( ':', $server ); if ( ($values[0] == 'unix' ) && ( !is_numeric( $values[1] ) ) ) { return Array( $server, 0 ); } else { ! return values; } } This code contents an error. "return values;" => "return $values;"