Removed useless keys() function from BagOStuff.
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 8 Jan 2013 01:32:27 +0000 (17:32 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 8 Jan 2013 01:32:27 +0000 (17:32 -0800)
Change-Id: Ie4249b2770de81377019ad383039ab85c0c5de7a

includes/objectcache/APCBagOStuff.php
includes/objectcache/BagOStuff.php
includes/objectcache/DBABagOStuff.php
includes/objectcache/HashBagOStuff.php
includes/objectcache/SqlBagOStuff.php
includes/objectcache/WinCacheBagOStuff.php

index 1a0de21..1f79b61 100644 (file)
@@ -79,19 +79,4 @@ class APCBagOStuff extends BagOStuff {
        public function decr( $key, $value = 1 ) {
                return apc_dec( $key, $value );
        }
-
-       /**
-        * @return Array
-        */
-       public function keys() {
-               $info = apc_cache_info( 'user' );
-               $list = $info['cache_list'];
-               $keys = array();
-
-               foreach ( $list as $entry ) {
-                       $keys[] = $entry['info'];
-               }
-
-               return $keys;
-       }
 }
index 7bbaff9..27b6dce 100644 (file)
@@ -96,15 +96,6 @@ abstract class BagOStuff {
                return true;
        }
 
-       /**
-        * @todo: what is this?
-        * @return Array
-        */
-       public function keys() {
-               /* stub */
-               return array();
-       }
-
        /**
         * Delete all objects expiring before a certain date.
         * @param $date string The reference date in MW format
index 36ced49..da6c5ec 100644 (file)
@@ -264,23 +264,4 @@ class DBABagOStuff extends BagOStuff {
 
                return ( $value === false ) ? false : (int)$value;
        }
-
-       function keys() {
-               $reader = $this->getReader();
-               $k1 = dba_firstkey( $reader );
-
-               if ( !$k1 ) {
-                       return array();
-               }
-
-               $result[] = $k1;
-
-               $key = dba_nextkey( $reader );
-               while ( $key ) {
-                       $result[] = $key;
-                       $key = dba_nextkey( $reader );
-               }
-
-               return $result;
-       }
 }
index 799f26a..ff07884 100644 (file)
@@ -91,12 +91,5 @@ class HashBagOStuff extends BagOStuff {
 
                return true;
        }
-
-       /**
-        * @return array
-        */
-       function keys() {
-               return array_keys( $this->bag );
-       }
 }
 
index eccfe00..36e337c 100644 (file)
@@ -49,7 +49,7 @@ class SqlBagOStuff extends BagOStuff {
         *   - server:      A server info structure in the format required by each
         *                  element in $wgDBServers.
         *
-        *   - servers:     An array of server info structures describing a set of 
+        *   - servers:     An array of server info structures describing a set of
         *                  database servers to distribute keys to. If this is
         *                  specified, the "server" option will be ignored.
         *
@@ -62,7 +62,7 @@ class SqlBagOStuff extends BagOStuff {
         *
         *   - tableName:   The table name to use, default is "objectcache".
         *
-        *   - shards:      The number of tables to use for data storage on each server. 
+        *   - shards:      The number of tables to use for data storage on each server.
         *                  If this is more than 1, table names will be formed in the style
         *                  objectcacheNNN where NNN is the shard index, between 0 and
         *                  shards-1. The number of digits will be the minimum number
@@ -113,8 +113,8 @@ class SqlBagOStuff extends BagOStuff {
                        }
 
                        # Don't keep timing out trying to connect for each call if the DB is down
-                       if ( isset( $this->connFailureErrors[$serverIndex] ) 
-                               && ( time() - $this->connFailureTimes[$serverIndex] ) < 60 ) 
+                       if ( isset( $this->connFailureErrors[$serverIndex] )
+                               && ( time() - $this->connFailureTimes[$serverIndex] ) < 60 )
                        {
                                throw $this->connFailureErrors[$serverIndex];
                        }
@@ -387,29 +387,6 @@ class SqlBagOStuff extends BagOStuff {
                return $newValue;
        }
 
-       /**
-        * @return Array
-        */
-       public function keys() {
-               $result = array();
-
-               for ( $serverIndex = 0; $serverIndex < $this->numServers; $serverIndex++ ) {
-                       try {
-                               $db = $this->getDB( $serverIndex );
-                               for ( $i = 0; $i < $this->shards; $i++ ) {
-                                       $res = $db->select( $this->getTableNameByShard( $i ),
-                                               array( 'keyname' ), false, __METHOD__ );
-                                       foreach ( $res as $row ) {
-                                               $result[] = $row->keyname;
-                                       }
-                               }
-                       } catch ( DBError $e ) {
-                               $this->handleReadError( $e, $serverIndex );
-                       }
-               }
-               return $result;
-       }
-
        /**
         * @param $exptime string
         * @return bool
index 21aa39e..637647b 100644 (file)
@@ -73,23 +73,4 @@ class WinCacheBagOStuff extends BagOStuff {
 
                return true;
        }
-
-       /**
-        * @return Array
-        */
-       public function keys() {
-               $info = wincache_ucache_info();
-               $list = $info['ucache_entries'];
-               $keys = array();
-
-               if ( is_null( $list ) ) {
-                       return array();
-               }
-
-               foreach ( $list as $entry ) {
-                       $keys[] = $entry['key_name'];
-               }
-
-               return $keys;
-       }
 }