X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fstorage%2FstorageTypeStats.php;h=e156efe34742b68d052a93ee226682bf964d0f65;hb=faf7cc4a09848c538320bd2b9067b1a77c0a0183;hp=3187c3180f0191df2f9e987516bd8f1861a329ac;hpb=cfdf23952dac41ac78dd97e670295098348604cd;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/storage/storageTypeStats.php b/maintenance/storage/storageTypeStats.php index 3187c3180f..6dee1a5c83 100644 --- a/maintenance/storage/storageTypeStats.php +++ b/maintenance/storage/storageTypeStats.php @@ -19,11 +19,11 @@ * @ingroup Maintenance ExternalStorage */ -require_once( __DIR__ . '/../Maintenance.php' ); +require_once __DIR__ . '/../Maintenance.php'; class StorageTypeStats extends Maintenance { function execute() { - $dbr = wfGetDB( DB_SLAVE ); + $dbr = $this->getDB( DB_REPLICA ); $endId = $dbr->selectField( 'text', 'MAX(old_id)', false, __METHOD__ ); if ( !$endId ) { @@ -37,7 +37,7 @@ class StorageTypeStats extends Maintenance { } echo "Using bin size of $binSize\n"; - $stats = array(); + $stats = []; $classSql = <<select( 'text', - array( + [ 'old_flags', "$classSql AS class", 'COUNT(*) as count', - ), - array( + ], + [ 'old_id >= ' . intval( $rangeStart ), 'old_id < ' . intval( $rangeStart + $binSize ) - ), + ], __METHOD__, - array( 'GROUP BY' => 'old_flags, class' ) + [ 'GROUP BY' => 'old_flags, class' ] ); foreach ( $res as $row ) { @@ -85,11 +85,11 @@ SQL; $class = $row->class; $count = $row->count; if ( !isset( $stats[$flags][$class] ) ) { - $stats[$flags][$class] = array( + $stats[$flags][$class] = [ 'count' => 0, 'first' => $rangeStart, 'last' => 0 - ); + ]; } $entry =& $stats[$flags][$class]; $entry['count'] += $count; @@ -111,5 +111,5 @@ SQL; } } -$maintClass = 'StorageTypeStats'; -require_once( RUN_MAINTENANCE_IF_MAIN ); +$maintClass = StorageTypeStats::class; +require_once RUN_MAINTENANCE_IF_MAIN;