]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - maintenance/storage/orphanStats.php
MediaWiki 1.17.0
[autoinstalls/mediawiki.git] / maintenance / storage / orphanStats.php
index 63f9025b474efc0e970cc13d63c22235e9b5db7f..f30f07e42480c096b315761df8b81eec9543f9e6 100644 (file)
@@ -20,7 +20,7 @@
  *
  * @ingroup Maintenance ExternalStorage
  */
-require_once( dirname(__FILE__) . '/../Maintenance.php' );
+require_once( dirname( __FILE__ ) . '/../Maintenance.php' );
 
 class OrphanStats extends Maintenance {
        public function __construct() {
@@ -34,13 +34,12 @@ class OrphanStats extends Maintenance {
        }
 
        public function execute() {
-               $extDBs = array();
                $dbr = wfGetDB( DB_SLAVE );
-               if( !$dbr->tableExists( 'blob_orphans' ) ) {
+               if ( !$dbr->tableExists( 'blob_orphans' ) ) {
                        $this->error( "blob_orphans doesn't seem to exist, need to run trackBlobs.php first", true );
                }
                $res = $dbr->select( 'blob_orphans', '*', false, __METHOD__ );
-               
+
                $num = 0;
                $totalSize = 0;
                $hashes = array();
@@ -49,7 +48,7 @@ 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__ );
-                       
+
                        $num++;
                        $size = strlen( $blobRow->blob_text );
                        $totalSize += $size;
@@ -61,11 +60,11 @@ 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" . 
+                       "Max size: $maxSize\n" .
                        "Number of unique texts: " . count( $hashes ) . "\n" );
                }
        }
 }
 
 $maintClass = "OrphanStats";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );