Merge "Allow partially blocked users to import images"
[lhc/web/wiklou.git] / maintenance / storage / orphanStats.php
index 219b47c..6a04b98 100644 (file)
@@ -38,11 +38,11 @@ class OrphanStats extends Maintenance {
                        "Show some statistics on the blob_orphans table, created with trackBlobs.php" );
        }
 
-       protected function &getDB( $cluster, $groups = [], $wiki = false ) {
+       protected function getDB( $cluster, $groups = [], $wiki = false ) {
                $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
                $lb = $lbFactory->getExternalLB( $cluster );
 
-               return $lb->getConnection( DB_REPLICA );
+               return $lb->getMaintenanceConnectionRef( DB_REPLICA );
        }
 
        public function execute() {
@@ -57,12 +57,12 @@ class OrphanStats extends Maintenance {
                $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__
                        );