Merge "Begin 1.27 development cycle"
[lhc/web/wiklou.git] / maintenance / storage / orphanStats.php
index 8b4fc93..c5213ad 100644 (file)
@@ -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" );
                }
        }
 }