Pass language to Status::getWikiText
authorUmherirrender <umherirrender_de.wp@web.de>
Tue, 18 Sep 2018 20:01:56 +0000 (22:01 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 21 Sep 2019 11:14:54 +0000 (11:14 +0000)
Avoid use of $wgLang

Change-Id: I9cd633a20c5c60e56a101a9a699eea6db8b8eef0

includes/EditPage.php
includes/ProtectionForm.php
includes/page/Article.php
includes/specialpage/LoginSignupSpecialPage.php
includes/specials/SpecialConfirmEmail.php
includes/specials/SpecialEditTags.php
includes/specials/SpecialImport.php
includes/specials/SpecialRevisionDelete.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialUpload.php
includes/specials/SpecialUserrights.php

index 9182300..fe00149 100644 (file)
@@ -1683,7 +1683,9 @@ class EditPage {
                        case self::AS_CANNOT_USE_CUSTOM_MODEL:
                        case self::AS_PARSE_ERROR:
                        case self::AS_UNICODE_NOT_SUPPORTED:
-                               $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
+                               $out->wrapWikiTextAsInterface( 'error',
+                                       $status->getWikiText( false, false, $this->context->getLanguage() )
+                               );
                                return true;
 
                        case self::AS_SUCCESS_NEW_ARTICLE:
@@ -1757,7 +1759,8 @@ class EditPage {
                                // is if an extension hook aborted from inside ArticleSave.
                                // Render the status object into $this->hookError
                                // FIXME this sucks, we should just use the Status object throughout
-                               $this->hookError = '<div class="error">' . "\n" . $status->getWikiText() .
+                               $this->hookError = '<div class="error">' . "\n" .
+                                       $status->getWikiText( false, false, $this->context->getLanguage() ) .
                                        '</div>';
                                return true;
                }
index a1be271..3e639b9 100644 (file)
@@ -333,7 +333,9 @@ class ProtectionForm {
                );
 
                if ( !$status->isOK() ) {
-                       $this->show( $out->parseInlineAsInterface( $status->getWikiText() ) );
+                       $this->show( $out->parseInlineAsInterface(
+                               $status->getWikiText( false, false, $this->mContext->getLanguage() )
+                       ) );
                        return false;
                }
 
index 6aeb038..4b37181 100644 (file)
@@ -808,7 +808,9 @@ class Article implements Page {
                                                        $outputPage->enableClientCache( false );
                                                        $outputPage->setRobotPolicy( 'noindex,nofollow' );
 
-                                                       $errortext = $error->getWikiText( false, 'view-pool-error' );
+                                                       $errortext = $error->getWikiText(
+                                                               false, 'view-pool-error', $this->getContext()->getLanguage()
+                                                       );
                                                        $outputPage->wrapWikiTextAsInterface( 'errorbox', $errortext );
                                                }
                                                # Connection or timeout error
@@ -2121,7 +2123,7 @@ class Article implements Page {
                        if ( $error == '' ) {
                                $outputPage->wrapWikiTextAsInterface(
                                        'error mw-error-cannotdelete',
-                                       $status->getWikiText()
+                                       $status->getWikiText( false, false, $context->getLanguage() )
                                );
                                $deleteLogPage = new LogPage( 'delete' );
                                $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
index 94be852..8be029a 100644 (file)
@@ -441,7 +441,9 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
                }
                if ( $extraMessages ) {
                        $extraMessages = Status::wrap( $extraMessages );
-                       $out->addWikiTextAsInterface( $extraMessages->getWikiText() );
+                       $out->addWikiTextAsInterface(
+                               $extraMessages->getWikiText( false, false, $this->getLanguage() )
+                       );
                }
 
                $out->addHTML( $injected_html );
index 2c42cd3..dc31eba 100644 (file)
@@ -141,7 +141,7 @@ class SpecialConfirmEmail extends UnlistedSpecialPage {
                        return Status::newGood( $this->msg( 'confirmemail_sent' )->text() );
                } else {
                        return Status::newFatal( new RawMessage(
-                               $status->getWikiText( 'confirmemail_sendfailed' )
+                               $status->getWikiText( 'confirmemail_sendfailed', false, $this->getLanguage() )
                        ) );
                }
        }
index 48357aa..0b4577e 100644 (file)
@@ -465,7 +465,7 @@ class SpecialEditTags extends UnlistedSpecialPage {
        protected function failure( $status ) {
                $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
                $this->getOutput()->wrapWikiTextAsInterface(
-                       'errorbox', $status->getWikiText( 'tags-edit-failure' )
+                       'errorbox', $status->getWikiText( 'tags-edit-failure', false, $this->getLanguage() )
                );
                $this->showForm();
        }
index cfefa47..428556f 100644 (file)
@@ -187,7 +187,8 @@ class SpecialImport extends SpecialPage {
                $out = $this->getOutput();
                if ( !$source->isGood() ) {
                        $out->wrapWikiTextAsInterface( 'error',
-                               $this->msg( 'importfailed', $source->getWikiText() )->plain()
+                               $this->msg( 'importfailed', $source->getWikiText( false, false, $this->getLanguage() ) )
+                                       ->plain()
                        );
                } else {
                        $importer = new WikiImporter( $source->value, $this->getConfig() );
@@ -200,7 +201,7 @@ class SpecialImport extends SpecialPage {
                                                "<div class=\"error\">\n$1\n</div>",
                                                [
                                                        'import-options-wrong',
-                                                       $statusRootPage->getWikiText(),
+                                                       $statusRootPage->getWikiText( false, false, $this->getLanguage() ),
                                                        count( $statusRootPage->getErrorsArray() )
                                                ]
                                        );
@@ -239,7 +240,7 @@ class SpecialImport extends SpecialPage {
                                # Zero revisions
                                $out->wrapWikiMsg(
                                        "<div class=\"error\">\n$1\n</div>",
-                                       [ 'importfailed', $result->getWikiText() ]
+                                       [ 'importfailed', $result->getWikiText( false, false, $this->getLanguage() ) ]
                                );
                        } else {
                                # Success!
index 67177b7..750e2c3 100644 (file)
@@ -667,7 +667,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
                $this->getOutput()->wrapWikiTextAsInterface(
                        'errorbox',
-                       $status->getWikiText( $this->typeLabels['failure'] )
+                       $status->getWikiText( $this->typeLabels['failure'], false, $this->getLanguage() )
                );
                $this->showForm();
        }
index d3d3bd7..c6f0721 100644 (file)
@@ -1216,7 +1216,8 @@ class SpecialUndelete extends SpecialPage {
                                '<div id="mw-error-cannotundelete">' .
                                $status->getWikiText(
                                        'cannotundelete',
-                                       'cannotundelete'
+                                       'cannotundelete',
+                                       $this->getLanguage()
                                ) . '</div>'
                        );
                }
@@ -1228,7 +1229,8 @@ class SpecialUndelete extends SpecialPage {
                                'error',
                                $status->getWikiText(
                                        'undelete-error-short',
-                                       'undelete-error-long'
+                                       'undelete-error-long',
+                                       $this->getLanguage()
                                )
                        );
                }
index e7c2e42..a2edca0 100644 (file)
@@ -488,7 +488,9 @@ class SpecialUpload extends SpecialPage {
                // Fetch the file if required
                $status = $this->mUpload->fetchFile();
                if ( !$status->isOK() ) {
-                       $this->showUploadError( $this->getOutput()->parseAsInterface( $status->getWikiText() ) );
+                       $this->showUploadError( $this->getOutput()->parseAsInterface(
+                               $status->getWikiText( false, false, $this->getLanguage() )
+                       ) );
 
                        return;
                }
@@ -559,7 +561,7 @@ class SpecialUpload extends SpecialPage {
                                $changeTags, $this->getUser() );
                        if ( !$changeTagsStatus->isOK() ) {
                                $this->showUploadError( $this->getOutput()->parseAsInterface(
-                                       $changeTagsStatus->getWikiText()
+                                       $changeTagsStatus->getWikiText( false, false, $this->getLanguage() )
                                ) );
 
                                return;
@@ -576,7 +578,9 @@ class SpecialUpload extends SpecialPage {
 
                if ( !$status->isGood() ) {
                        $this->showRecoverableUploadError(
-                               $this->getOutput()->parseAsInterface( $status->getWikiText() )
+                               $this->getOutput()->parseAsInterface(
+                                       $status->getWikiText( false, false, $this->getLanguage() )
+                               )
                        );
 
                        return;
index 585699d..28626ea 100644 (file)
@@ -177,7 +177,9 @@ class UserrightsPage extends SpecialPage {
 
                        // save settings
                        if ( !$fetchedStatus->isOK() ) {
-                               $this->getOutput()->addWikiTextAsInterface( $fetchedStatus->getWikiText() );
+                               $this->getOutput()->addWikiTextAsInterface(
+                                       $fetchedStatus->getWikiText( false, false, $this->getLanguage() )
+                               );
 
                                return;
                        }
@@ -208,7 +210,9 @@ class UserrightsPage extends SpecialPage {
                                        return;
                                } else {
                                        // Print an error message and redisplay the form
-                                       $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
+                                       $out->wrapWikiTextAsInterface(
+                                               'error', $status->getWikiText( false, false, $this->getLanguage() )
+                                       );
                                }
                        }
                }
@@ -482,7 +486,9 @@ class UserrightsPage extends SpecialPage {
        function editUserGroupsForm( $username ) {
                $status = $this->fetchUser( $username, true );
                if ( !$status->isOK() ) {
-                       $this->getOutput()->addWikiTextAsInterface( $status->getWikiText() );
+                       $this->getOutput()->addWikiTextAsInterface(
+                               $status->getWikiText( false, false, $this->getLanguage() )
+                       );
 
                        return;
                }