Don't use classes error, success and warning outside parser

Bug: T280766
Change-Id: I83f2828bcde160c98a1d97e783a869e64fb4c6ea
This commit is contained in:
mainframe98 2021-04-23 09:35:55 +02:00
parent 1d7e23e460
commit c87462097c
7 changed files with 22 additions and 17 deletions

View file

@ -1860,9 +1860,9 @@ class EditPage implements IEditObject {
// 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( false, false, $this->context->getLanguage() ) .
'</div>';
$this->hookError = Html::errorBox(
$status->getWikiText( false, false, $this->context->getLanguage() )
);
return true;
}
}
@ -2965,8 +2965,11 @@ class EditPage implements IEditObject {
$out->addHTML( $this->editFormTextTop );
if ( $this->wasDeletedSinceLastEdit() && $this->formtype !== 'save' ) {
$out->wrapWikiMsg( "<div class='error mw-deleted-while-editing'>\n$1\n</div>",
'deletedwhileediting' );
$out->addHTML( Html::errorBox(
$out->msg( 'deletedwhileediting' )->plain(),
'',
'mw-deleted-while-editing'
) );
}
// @todo add EditForm plugin interface and use it here!
@ -3359,7 +3362,7 @@ class EditPage implements IEditObject {
# Check the skin exists
if ( $this->isWrongCaseUserConfigPage() ) {
$out->wrapWikiMsg(
"<div class='error' id='mw-userinvalidconfigtitle'>\n$1\n</div>",
"<div class='errorbox' id='mw-userinvalidconfigtitle'>\n$1\n</div>",
[ 'userinvalidconfigtitle', $this->mTitle->getSkinFromConfigSubpage() ]
);
}

View file

@ -4117,11 +4117,11 @@ class OutputPage extends ContextSource {
*
* For example:
*
* $wgOut->wrapWikiMsg( "<div class='error'>\n$1\n</div>", 'some-error' );
* $wgOut->wrapWikiMsg( "<div class='errorbox'>\n$1\n</div>", 'some-error' );
*
* Is equivalent to:
*
* $wgOut->addWikiTextAsInterface( "<div class='error'>\n"
* $wgOut->addWikiTextAsInterface( "<div class='errorbox'>\n"
* . wfMessage( 'some-error' )->plain() . "\n</div>" );
*
* The newline after the opening div is needed in some wikitext. See T21226.

View file

@ -256,9 +256,9 @@ class ProtectionForm {
$out->addBacklinkSubtitle( $this->mTitle );
if ( is_array( $err ) ) {
$out->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n", $err );
$out->addHTML( Html::errorBox( $out->msg( ...$err )->plain() ) );
} elseif ( is_string( $err ) ) {
$out->addHTML( "<div class='error'>{$err}</div>\n" );
$out->addHTML( Html::errorBox( $err ) );
}
if ( $this->mApplicableTypes === [] ) {

View file

@ -146,7 +146,7 @@ class SpecialChangeEmail extends FormSpecialPage {
$this->getOutput()->redirect( $titleObj->getFullUrlForRedirect( $query ) );
} elseif ( $this->status->value === 'eauth' ) {
# Notify user that a confirmation email has been sent...
$this->getOutput()->wrapWikiMsg( "<div class='error' style='clear: both;'>\n$1\n</div>",
$this->getOutput()->wrapWikiMsg( "<div class='errorbox'>\n$1\n</div>",
'eauthentsent', $this->getUser()->getName() );
// just show the link to go back
$this->getOutput()->addReturnTo( $titleObj, wfCgiToArray( $query ) );

View file

@ -396,8 +396,8 @@ class SpecialUpload extends SpecialPage {
$sessionKey = null;
$uploadWarning = 'upload-tryagain-nostash';
}
$message = '<h2>' . $this->msg( 'uploaderror' )->escaped() . "</h2>\n" .
'<div class="error">' . $message . "</div>\n";
$message = '<h2>' . $this->msg( 'uploaderror' )->escaped() . '</h2>' .
Html::errorBox( $message );
$form = $this->getUploadForm( $message, $sessionKey );
$form->setSubmitText( $this->msg( $uploadWarning )->escaped() );
@ -517,8 +517,8 @@ class SpecialUpload extends SpecialPage {
* @param string $message HTML string
*/
protected function showUploadError( $message ) {
$message = '<h2>' . $this->msg( 'uploadwarning' )->escaped() . "</h2>\n" .
'<div class="error">' . $message . "</div>\n";
$message = '<h2>' . $this->msg( 'uploadwarning' )->escaped() . '</h2>' .
Html::errorBox( $message );
$this->showUploadForm( $this->getUploadForm( $message ) );
}

View file

@ -226,7 +226,9 @@ class UserrightsPage extends SpecialPage {
$userGroups = $targetUser->getGroups();
if ( $userGroups !== $conflictCheck ) {
$out->wrapWikiMsg( '<span class="error">$1</span>', 'userrights-conflict' );
$out->addHTML( Html::errorBox(
$this->msg( 'userrights-conflict' )->parse()
) );
} else {
$status = $this->saveUserGroups(
$this->mTarget,

View file

@ -20,7 +20,7 @@
<img src="{{path}}resources/assets/mediawiki.png" alt="The MediaWiki logo" />
<h1>MediaWiki {{version}}</h1>
<div class="error">
<div class="errorbox">
{{#localSettingsExists}}
<p>LocalSettings.php not readable.</p>
<p>Please correct file permissions and try again.</p>