From c1f9b1f7b1b77776192048005dcc66dcf3df2bfb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 27 Dec 2014 15:41:37 +0100 Subject: Update to MediaWiki 1.24.1 --- maintenance/storage/orphanStats.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'maintenance/storage/orphanStats.php') diff --git a/maintenance/storage/orphanStats.php b/maintenance/storage/orphanStats.php index 1df1501e..c5213ad1 100644 --- a/maintenance/storage/orphanStats.php +++ b/maintenance/storage/orphanStats.php @@ -32,11 +32,13 @@ require_once __DIR__ . '/../Maintenance.php'; class OrphanStats extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "how some statistics on the blob_orphans table, created with trackBlobs.php"; + $this->mDescription = + "Show some statistics on the blob_orphans table, created with trackBlobs.php"; } protected function &getDB( $cluster, $groups = array(), $wiki = false ) { $lb = wfGetLBFactory()->getExternalLB( $cluster ); + return $lb->getConnection( DB_SLAVE ); } @@ -54,12 +56,17 @@ class OrphanStats extends Maintenance { foreach ( $res as $boRow ) { $extDB = $this->getDB( $boRow->bo_cluster ); - $blobRow = $extDB->selectRow( 'blobs', '*', array( 'blob_id' => $boRow->bo_blob_id ), __METHOD__ ); + $blobRow = $extDB->selectRow( + 'blobs', + '*', + array( 'blob_id' => $boRow->bo_blob_id ), + __METHOD__ + ); $num++; $size = strlen( $blobRow->blob_text ); $totalSize += $size; - $hashes[ sha1( $blobRow->blob_text ) ] = true; + $hashes[sha1( $blobRow->blob_text )] = true; $maxSize = max( $size, $maxSize ); } unset( $res ); @@ -67,8 +74,8 @@ class OrphanStats extends Maintenance { $this->output( "Number of orphans: $num\n" ); if ( $num > 0 ) { $this->output( "Average size: " . round( $totalSize / $num, 0 ) . " bytes\n" . - "Max size: $maxSize\n" . - "Number of unique texts: " . count( $hashes ) . "\n" ); + "Max size: $maxSize\n" . + "Number of unique texts: " . count( $hashes ) . "\n" ); } } } -- cgit v1.2.3-54-g00ecf