Merge "Drop ParserLimitReport, deprecated in 1.22"
[lhc/web/wiklou.git] / includes / export / XmlDumpWriter.php
index c46eb61..e6f1fd7 100644 (file)
@@ -23,6 +23,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * @ingroup Dump
  */
@@ -38,7 +40,6 @@ class XmlDumpWriter {
         * @return string
         */
        function openStream() {
-               global $wgContLang;
                $ver = WikiExporter::schemaVersion();
                return Xml::element( 'mediawiki', [
                        'xmlns'              => "http://www.mediawiki.org/xml/export-$ver/",
@@ -55,8 +56,8 @@ class XmlDumpWriter {
                         */
                        'xsi:schemaLocation' => "http://www.mediawiki.org/xml/export-$ver/ " .
                                "http://www.mediawiki.org/xml/export-$ver.xsd",
-                       'version'            => $ver,
-                       'xml:lang'           => $wgContLang->getHtmlCode() ],
+                       'version' => $ver,
+                       'xml:lang' => MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() ],
                        null ) .
                        "\n" .
                        $this->siteInfo();
@@ -123,9 +124,11 @@ class XmlDumpWriter {
         * @return string
         */
        function namespaces() {
-               global $wgContLang;
                $spaces = "<namespaces>\n";
-               foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) {
+               foreach (
+                       MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces()
+                       as $ns => $title
+               ) {
                        $spaces .= '      ' .
                                Xml::element( 'namespace',
                                        [
@@ -219,7 +222,7 @@ class XmlDumpWriter {
                if ( isset( $row->rev_deleted ) && ( $row->rev_deleted & Revision::DELETED_COMMENT ) ) {
                        $out .= "      " . Xml::element( 'comment', [ 'deleted' => 'deleted' ] ) . "\n";
                } else {
-                       $comment = CommentStore::newKey( 'rev_comment' )->getComment( $row )->text;
+                       $comment = CommentStore::getStore()->getComment( 'rev_comment', $row )->text;
                        if ( $comment != '' ) {
                                $out .= "      " . Xml::elementClean( 'comment', [], strval( $comment ) ) . "\n";
                        }
@@ -303,7 +306,7 @@ class XmlDumpWriter {
                if ( $row->log_deleted & LogPage::DELETED_COMMENT ) {
                        $out .= "    " . Xml::element( 'comment', [ 'deleted' => 'deleted' ] ) . "\n";
                } else {
-                       $comment = CommentStore::newKey( 'log_comment' )->getComment( $row )->text;
+                       $comment = CommentStore::getStore()->getComment( 'log_comment', $row )->text;
                        if ( $comment != '' ) {
                                $out .= "    " . Xml::elementClean( 'comment', null, strval( $comment ) ) . "\n";
                        }
@@ -434,8 +437,8 @@ class XmlDumpWriter {
                        return $title->getPrefixedText();
                }
 
-               global $wgContLang;
-               $prefix = $wgContLang->getFormattedNsText( $title->getNamespace() );
+               $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
+                       getFormattedNsText( $title->getNamespace() );
 
                // @todo Emit some kind of warning to the user if $title->getNamespace() !==
                // NS_MAIN and $prefix === '' (viz. pages in an unregistered namespace)