Merge "Delete autoload.ide.php"
[lhc/web/wiklou.git] / maintenance / dumpTextPass.php
index fdc36c7..e1df1f1 100644 (file)
@@ -28,6 +28,7 @@ require_once __DIR__ . '/backup.inc';
 require_once __DIR__ . '/7zip.inc';
 require_once __DIR__ . '/../includes/export/WikiExporter.php';
 
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IMaintainableDatabase;
 
 /**
@@ -99,7 +100,7 @@ class TextPassDumper extends BackupDumper {
        protected $db;
 
        /**
-        * @param array $args For backward compatibility
+        * @param array|null $args For backward compatibility
         */
        function __construct( $args = null ) {
                parent::__construct();
@@ -218,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() . ")" );
@@ -703,7 +705,6 @@ TEXT
         * @throws MWException
         */
        private function getTextDb( $id ) {
-               global $wgContLang;
                if ( !isset( $this->db ) ) {
                        throw new MWException( __METHOD__ . "No database available" );
                }
@@ -716,19 +717,20 @@ TEXT
                        return false;
                }
                $stripped = str_replace( "\r", "", $text );
-               $normalized = $wgContLang->normalize( $stripped );
+               $normalized = MediaWikiServices::getInstance()->getContentLanguage()->
+                       normalize( $stripped );
 
                return $normalized;
        }
 
        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;
        }
@@ -774,7 +776,7 @@ TEXT
        }
 
        private function closeSpawn() {
-               MediaWiki\suppressWarnings();
+               Wikimedia\suppressWarnings();
                if ( $this->spawnRead ) {
                        fclose( $this->spawnRead );
                }
@@ -791,12 +793,10 @@ TEXT
                        pclose( $this->spawnProc );
                }
                $this->spawnProc = false;
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
        }
 
        private function getTextSpawnedOnce( $id ) {
-               global $wgContLang;
-
                $ok = fwrite( $this->spawnWrite, "$id\n" );
                // $this->progress( ">> $id" );
                if ( !$ok ) {
@@ -851,7 +851,8 @@ TEXT
 
                // Do normalization in the dump thread...
                $stripped = str_replace( "\r", "", $text );
-               $normalized = $wgContLang->normalize( $stripped );
+               $normalized = MediaWikiServices::getInstance()->getContentLanguage()->
+                       normalize( $stripped );
 
                return $normalized;
        }