Replace wfGetLBFactory
[lhc/web/wiklou.git] / maintenance / dumpTextPass.php
index 2b79b54..59a6b51 100644 (file)
  */
 
 require_once __DIR__ . '/backup.inc';
+require_once __DIR__ . '/7zip.inc';
 require_once __DIR__ . '/../includes/export/WikiExporter.php';
 
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IMaintainableDatabase;
 
 /**
@@ -142,8 +144,6 @@ TEXT
        }
 
        function processOptions() {
-               global $IP;
-
                parent::processOptions();
 
                if ( $this->hasOption( 'buffersize' ) ) {
@@ -151,7 +151,6 @@ TEXT
                }
 
                if ( $this->hasOption( 'prefetch' ) ) {
-                       require_once "$IP/maintenance/backupPrefetch.inc";
                        $url = $this->processFileOpt( $this->getOption( 'prefetch' ) );
                        $this->prefetch = new BaseDump( $url );
                }
@@ -220,7 +219,8 @@ TEXT
                // individually retrying at different layers of code.
 
                try {
-                       $this->lb = wfGetLBFactory()->newMainLB();
+                       $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+                       $this->lb = $lbFactory->newMainLB();
                } catch ( Exception $e ) {
                        throw new MWException( __METHOD__
                                . " rotating DB failed to obtain new load balancer (" . $e->getMessage() . ")" );
@@ -724,13 +724,13 @@ TEXT
        }
 
        private function getTextSpawned( $id ) {
-               MediaWiki\suppressWarnings();
+               Wikimedia\suppressWarnings();
                if ( !$this->spawnProc ) {
                        // First time?
                        $this->openSpawn();
                }
                $text = $this->getTextSpawnedOnce( $id );
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
 
                return $text;
        }
@@ -776,7 +776,7 @@ TEXT
        }
 
        private function closeSpawn() {
-               MediaWiki\suppressWarnings();
+               Wikimedia\suppressWarnings();
                if ( $this->spawnRead ) {
                        fclose( $this->spawnRead );
                }
@@ -793,7 +793,7 @@ TEXT
                        pclose( $this->spawnProc );
                }
                $this->spawnProc = false;
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
        }
 
        private function getTextSpawnedOnce( $id ) {
@@ -988,5 +988,5 @@ TEXT
        }
 }
 
-$maintClass = 'TextPassDumper';
+$maintClass = TextPassDumper::class;
 require_once RUN_MAINTENANCE_IF_MAIN;