Merge "Replace wfGetLBFactory"
[lhc/web/wiklou.git] / maintenance / storage / orphanStats.php
index d7d0b84..219b47c 100644 (file)
@@ -23,6 +23,8 @@
 
 require_once __DIR__ . '/../Maintenance.php';
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Maintenance script that shows some statistics on the blob_orphans table,
  * created with trackBlobs.php.
@@ -37,7 +39,8 @@ class OrphanStats extends Maintenance {
        }
 
        protected function &getDB( $cluster, $groups = [], $wiki = false ) {
-               $lb = wfGetLBFactory()->getExternalLB( $cluster );
+               $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+               $lb = $lbFactory->getExternalLB( $cluster );
 
                return $lb->getConnection( DB_REPLICA );
        }
@@ -45,9 +48,9 @@ class OrphanStats extends Maintenance {
        public function execute() {
                $dbr = $this->getDB( DB_REPLICA );
                if ( !$dbr->tableExists( 'blob_orphans' ) ) {
-                       $this->error( "blob_orphans doesn't seem to exist, need to run trackBlobs.php first", true );
+                       $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;
@@ -80,5 +83,5 @@ class OrphanStats extends Maintenance {
        }
 }
 
-$maintClass = "OrphanStats";
+$maintClass = OrphanStats::class;
 require_once RUN_MAINTENANCE_IF_MAIN;