require_once __DIR__ . '/../Maintenance.php';
+use MediaWiki\MediaWikiServices;
+
/**
* Maintenance script that shows some statistics on the blob_orphans table,
* created with trackBlobs.php.
}
protected function &getDB( $cluster, $groups = [], $wiki = false ) {
- $lb = wfGetLBFactory()->getExternalLB( $cluster );
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+ $lb = $lbFactory->getExternalLB( $cluster );
return $lb->getConnection( DB_REPLICA );
}
if ( !$dbr->tableExists( 'blob_orphans' ) ) {
$this->fatalError( "blob_orphans doesn't seem to exist, need to run trackBlobs.php first" );
}
- $res = $dbr->select( 'blob_orphans', '*', false, __METHOD__ );
+ $res = $dbr->select( 'blob_orphans', '*', '', __METHOD__ );
$num = 0;
$totalSize = 0;
$hashes = [];
$maxSize = 0;
- foreach ( $res as $boRow ) {
- $extDB = $this->getDB( $boRow->bo_cluster );
+ foreach ( $res as $row ) {
+ $extDB = $this->getDB( $row->bo_cluster );
$blobRow = $extDB->selectRow(
'blobs',
'*',
- [ 'blob_id' => $boRow->bo_blob_id ],
+ [ 'blob_id' => $row->bo_blob_id ],
__METHOD__
);