From 692e6103f27563100f5245a0061b448e08b416d1 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 7 Jan 2013 17:32:27 -0800 Subject: [PATCH] Removed useless keys() function from BagOStuff. Change-Id: Ie4249b2770de81377019ad383039ab85c0c5de7a --- includes/objectcache/APCBagOStuff.php | 15 ----------- includes/objectcache/BagOStuff.php | 9 ------- includes/objectcache/DBABagOStuff.php | 19 ------------- includes/objectcache/HashBagOStuff.php | 7 ----- includes/objectcache/SqlBagOStuff.php | 31 +++------------------- includes/objectcache/WinCacheBagOStuff.php | 19 ------------- 6 files changed, 4 insertions(+), 96 deletions(-) diff --git a/includes/objectcache/APCBagOStuff.php b/includes/objectcache/APCBagOStuff.php index 1a0de21865..1f79b611f0 100644 --- a/includes/objectcache/APCBagOStuff.php +++ b/includes/objectcache/APCBagOStuff.php @@ -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; - } } diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index 7bbaff9346..27b6dce296 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -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 diff --git a/includes/objectcache/DBABagOStuff.php b/includes/objectcache/DBABagOStuff.php index 36ced496bb..da6c5ec387 100644 --- a/includes/objectcache/DBABagOStuff.php +++ b/includes/objectcache/DBABagOStuff.php @@ -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; - } } diff --git a/includes/objectcache/HashBagOStuff.php b/includes/objectcache/HashBagOStuff.php index 799f26a3f4..ff078840d3 100644 --- a/includes/objectcache/HashBagOStuff.php +++ b/includes/objectcache/HashBagOStuff.php @@ -91,12 +91,5 @@ class HashBagOStuff extends BagOStuff { return true; } - - /** - * @return array - */ - function keys() { - return array_keys( $this->bag ); - } } diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index eccfe00521..36e337cbb7 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -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 diff --git a/includes/objectcache/WinCacheBagOStuff.php b/includes/objectcache/WinCacheBagOStuff.php index 21aa39e7d2..637647b61a 100644 --- a/includes/objectcache/WinCacheBagOStuff.php +++ b/includes/objectcache/WinCacheBagOStuff.php @@ -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; - } } -- 2.20.1