X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fstorage%2ForphanStats.php;h=c5213ad17f6127ac9feceeaae76d3d3546972124;hb=8d1c5a70f753fe6b7d2533a30b07fe03e6583a1d;hp=8b4fc937bced3df3a80078d8c16fb931c20b8d18;hpb=fd0ff7a312126ca68e2ce4a11418d7854395f46a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/storage/orphanStats.php b/maintenance/storage/orphanStats.php index 8b4fc937bc..c5213ad17f 100644 --- a/maintenance/storage/orphanStats.php +++ b/maintenance/storage/orphanStats.php @@ -21,7 +21,7 @@ * @ingroup Maintenance ExternalStorage */ -require_once( __DIR__ . '/../Maintenance.php' ); +require_once __DIR__ . '/../Maintenance.php'; /** * Maintenance script that shows some statistics on the blob_orphans table, @@ -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" ); } } }