Update wikimedia/timestamp to v2.2.0
[lhc/web/wiklou.git] / maintenance / importDump.php
index 2923b38..9834473 100644 (file)
@@ -24,6 +24,8 @@
  * @ingroup Maintenance
  */
 
+use MediaWiki\MediaWikiServices;
+
 require_once __DIR__ . '/Maintenance.php';
 
 /**
@@ -131,13 +133,13 @@ TEXT
        }
 
        private function getNsIndex( $namespace ) {
-               global $wgContLang;
-               $result = $wgContLang->getNsIndex( $namespace );
+               $contLang = MediaWikiServices::getInstance()->getContentLanguage();
+               $result = $contLang->getNsIndex( $namespace );
                if ( $result !== false ) {
                        return $result;
                }
                $ns = intval( $namespace );
-               if ( strval( $ns ) === $namespace && $wgContLang->getNsText( $ns ) !== false ) {
+               if ( strval( $ns ) === $namespace && $contLang->getNsText( $ns ) !== false ) {
                        return $ns;
                }
                $this->fatalError( "Unknown namespace text / index specified: $namespace" );
@@ -322,6 +324,9 @@ TEXT
                        $this->pageCount = $nthPage - 1;
                }
                $importer->setPageCallback( [ $this, 'reportPage' ] );
+               $importer->setNoticeCallback( function ( $msg, $params ) {
+                       echo wfMessage( $msg, $params )->text() . "\n";
+               } );
                $this->importCallback = $importer->setRevisionCallback(
                        [ $this, 'handleRevision' ] );
                $this->uploadCallback = $importer->setUploadCallback(
@@ -343,5 +348,5 @@ TEXT
        }
 }
 
-$maintClass = 'BackupReader';
+$maintClass = BackupReader::class;
 require_once RUN_MAINTENANCE_IF_MAIN;