new wfMsg* functions to use the wgContLang object for translating content related...
[lhc/web/wiklou.git] / includes / memcached-client.php
index 6a21542..17d9ecb 100644 (file)
@@ -221,11 +221,11 @@ class memcached
     */
    function memcached ($args)
    {
-      $this->set_servers($args['servers']);
-      $this->_debug = $args['debug'];
+      $this->set_servers(@$args['servers']);
+      $this->_debug = @$args['debug'];
       $this->stats = array();
-      $this->_compress_threshold = $args['compress_threshold'];
-      $this->_persistant = isset($args['persistant']) ? $args['persistant'] : false;
+      $this->_compress_threshold = @$args['compress_threshold'];
+      $this->_persistant = array_key_exists('persistant', $args) ? (@$args['persistant']) : false;
       $this->_compress_enable = true;
       $this->_have_zlib = function_exists("gzcompress");
       
@@ -292,7 +292,7 @@ class memcached
       
       $key = is_array($key) ? $key[1] : $key;
       
-      $this->stats['delete']++;
+      @$this->stats['delete']++;
       $cmd = "delete $key $time\r\n";
       if(!fwrite($sock, $cmd, strlen($cmd)))
       {
@@ -374,7 +374,7 @@ class memcached
       if (!is_resource($sock))
          return false;
          
-      $this->stats['get']++;
+      @$this->stats['get']++;
       
       $cmd = "get $key\r\n";
       if (!fwrite($sock, $cmd, strlen($cmd)))
@@ -388,9 +388,9 @@ class memcached
       
       if ($this->_debug)
          foreach ($val as $k => $v)
-            $this->_debugprint(sprintf("MemCache: sock %s got %s => %s\r\n", $sock, $k, $v));
+            $this->_debugprint(@sprintf("MemCache: sock %s got %s => %s\r\n", serialize($sock), $k, $v));
 
-      return $val[$key];
+      return @$val[$key];
    }
 
    // }}}
@@ -667,7 +667,7 @@ class memcached
    function _dead_sock ($sock)
    {
       $host = array_search($sock, $this->_cache_sock);
-      list ($ip, $port) = explode(":", $host);
+      @list ($ip, $port) = explode(":", $host);
       $this->_host_dead[$ip] = time() + 30 + intval(rand(0, 10));
       $this->_host_dead[$host] = $this->_host_dead[$ip];
       unset($this->_cache_sock[$host]);
@@ -737,13 +737,7 @@ class memcached
     */
    function _hashfunc ($key)
    {
-      $hash = 0;
-      for ($i=0; $i<strlen($key); $i++)
-      {
-         $hash = $hash*33 + ord($key[$i]);
-      }
-      
-      return $hash;
+      return crc32($key);
    }
 
    // }}}
@@ -813,7 +807,7 @@ class memcached
                   break;
                $offset += $n;
                $bneed -= $n;
-               $ret[$rkey] .= $data;
+               @$ret[$rkey] .= $data;
             }
             
             if ($offset != $len+2)
@@ -866,7 +860,7 @@ class memcached
       if (!is_resource($sock))
          return false;
          
-      $this->stats[$cmd]++;
+      @$this->stats[$cmd]++;
       
       $flags = 0;