summaryrefslogtreecommitdiff
path: root/maintenance/storage/orphanStats.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/storage/orphanStats.php')
-rw-r--r--maintenance/storage/orphanStats.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/maintenance/storage/orphanStats.php b/maintenance/storage/orphanStats.php
index 63f9025b..f30f07e4 100644
--- a/maintenance/storage/orphanStats.php
+++ b/maintenance/storage/orphanStats.php
@@ -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 );