X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2Fstorage%2ForphanStats.php;h=c5213ad17f6127ac9feceeaae76d3d3546972124;hb=422300936d7bd030f2bdbeebb77fc49f681400dd;hp=1df1501e8d43f943a4f6ebea5ec2dd949cfab154;hpb=b65669ff7adbbde55872a8ddd93214a9e1df75c6;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/storage/orphanStats.php b/maintenance/storage/orphanStats.php index 1df1501e8d..c5213ad17f 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" ); } } }