summaryrefslogtreecommitdiff
path: root/maintenance/storage/orphanStats.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /maintenance/storage/orphanStats.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
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 );