Replace some wfMessage by ContextSource::msg
Change-Id: Ie056af7a002dbbf4e8defc8032bfcc0bdefc6566
This commit is contained in:
parent
73380233aa
commit
7f68979bec
12 changed files with 32 additions and 32 deletions
|
|
@ -16,7 +16,6 @@
|
|||
<exclude name="MediaWiki.Commenting.MissingCovers.MissingCovers" />
|
||||
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
|
||||
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
|
||||
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
|
||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.passthru" />
|
||||
<exclude name="MediaWiki.VariableAnalysis.ForbiddenGlobalVariables.ForbiddenGlobal$wgTitle" />
|
||||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
||||
|
|
|
|||
|
|
@ -296,6 +296,7 @@ class DerivativeContext extends ContextSource implements MutableContext {
|
|||
public function msg( $key ) {
|
||||
$args = func_get_args();
|
||||
|
||||
// phpcs:ignore MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage
|
||||
return wfMessage( ...$args )->setContext( $this );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ abstract class IndexPager extends ContextSource implements Pager {
|
|||
}
|
||||
|
||||
if ( in_array( $type, [ 'asc', 'desc' ] ) ) {
|
||||
$attrs['title'] = wfMessage( $type == 'asc' ? 'sort-ascending' : 'sort-descending' )->text();
|
||||
$attrs['title'] = $this->msg( $type == 'asc' ? 'sort-ascending' : 'sort-descending' )->text();
|
||||
}
|
||||
|
||||
if ( $type ) {
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ abstract class Skin extends ContextSource {
|
|||
$t = $embed . implode( "{$pop}{$embed}", $allCats['normal'] ) . $pop;
|
||||
|
||||
$msg = $this->msg( 'pagecategories' )->numParams( count( $allCats['normal'] ) )->escaped();
|
||||
$linkPage = wfMessage( 'pagecategorieslink' )->inContentLanguage()->text();
|
||||
$linkPage = $this->msg( 'pagecategorieslink' )->inContentLanguage()->text();
|
||||
$title = Title::newFromText( $linkPage );
|
||||
$link = $title ? Linker::link( $title, $msg ) : $msg;
|
||||
$s .= '<div id="mw-normal-catlinks" class="mw-normal-catlinks">' .
|
||||
|
|
@ -1331,7 +1331,7 @@ abstract class Skin extends ContextSource {
|
|||
* @param string $message
|
||||
*/
|
||||
public function addToSidebar( &$bar, $message ) {
|
||||
$this->addToSidebarPlain( $bar, wfMessage( $message )->inContentLanguage()->plain() );
|
||||
$this->addToSidebarPlain( $bar, $this->msg( $message )->inContentLanguage()->plain() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1621,13 +1621,13 @@ abstract class Skin extends ContextSource {
|
|||
|
||||
$attribs = [];
|
||||
if ( !is_null( $tooltip ) ) {
|
||||
$attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
|
||||
$attribs['title'] = $this->msg( 'editsectionhint' )->rawParams( $tooltip )
|
||||
->inLanguage( $lang )->text();
|
||||
}
|
||||
|
||||
$links = [
|
||||
'editsection' => [
|
||||
'text' => wfMessage( 'editsection' )->inLanguage( $lang )->escaped(),
|
||||
'text' => $this->msg( 'editsection' )->inLanguage( $lang )->escaped(),
|
||||
'targetTitle' => $nt,
|
||||
'attribs' => $attribs,
|
||||
'query' => [ 'action' => 'edit', 'section' => $section ],
|
||||
|
|
@ -1652,7 +1652,7 @@ abstract class Skin extends ContextSource {
|
|||
|
||||
$result .= implode(
|
||||
'<span class="mw-editsection-divider">'
|
||||
. wfMessage( 'pipe-separator' )->inLanguage( $lang )->escaped()
|
||||
. $this->msg( 'pipe-separator' )->inLanguage( $lang )->escaped()
|
||||
. '</span>',
|
||||
$linksHtml
|
||||
);
|
||||
|
|
|
|||
|
|
@ -157,9 +157,9 @@ class SpecialChangeCredentials extends AuthManagerSpecialPage {
|
|||
|
||||
$form->addPreText(
|
||||
Html::openElement( 'dl' )
|
||||
. Html::element( 'dt', [], wfMessage( 'credentialsform-provider' )->text() )
|
||||
. Html::element( 'dt', [], $this->msg( 'credentialsform-provider' )->text() )
|
||||
. Html::element( 'dd', [], $info['provider'] )
|
||||
. Html::element( 'dt', [], wfMessage( 'credentialsform-account' )->text() )
|
||||
. Html::element( 'dt', [], $this->msg( 'credentialsform-account' )->text() )
|
||||
. Html::element( 'dd', [], $info['account'] )
|
||||
. Html::closeElement( 'dl' )
|
||||
);
|
||||
|
|
|
|||
|
|
@ -706,7 +706,7 @@ class SpecialContributions extends IncludableSpecialPage {
|
|||
$dateRangeSelection = Html::rawElement(
|
||||
'div',
|
||||
[],
|
||||
Xml::label( wfMessage( 'date-range-from' )->text(), 'mw-date-start' ) . ' ' .
|
||||
Xml::label( $this->msg( 'date-range-from' )->text(), 'mw-date-start' ) . ' ' .
|
||||
new DateInputWidget( [
|
||||
'infusable' => true,
|
||||
'id' => 'mw-date-start',
|
||||
|
|
@ -714,7 +714,7 @@ class SpecialContributions extends IncludableSpecialPage {
|
|||
'value' => $this->opts['start'],
|
||||
'longDisplayFormat' => true,
|
||||
] ) . '<br>' .
|
||||
Xml::label( wfMessage( 'date-range-to' )->text(), 'mw-date-end' ) . ' ' .
|
||||
Xml::label( $this->msg( 'date-range-to' )->text(), 'mw-date-end' ) . ' ' .
|
||||
new DateInputWidget( [
|
||||
'infusable' => true,
|
||||
'id' => 'mw-date-end',
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
|
|||
* SPF and bounce problems with some mailers (see below).
|
||||
*/
|
||||
$mailFrom = new MailAddress( $config->get( 'PasswordSender' ),
|
||||
wfMessage( 'emailsender' )->inContentLanguage()->text() );
|
||||
$context->msg( 'emailsender' )->inContentLanguage()->text() );
|
||||
$replyTo = $from;
|
||||
} else {
|
||||
/**
|
||||
|
|
@ -482,7 +482,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
|
|||
if ( $config->get( 'UserEmailUseReplyTo' ) ) {
|
||||
$mailFrom = new MailAddress(
|
||||
$config->get( 'PasswordSender' ),
|
||||
wfMessage( 'emailsender' )->inContentLanguage()->text()
|
||||
$context->msg( 'emailsender' )->inContentLanguage()->text()
|
||||
);
|
||||
$replyTo = $ccFrom;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ class SpecialLinkAccounts extends AuthManagerSpecialPage {
|
|||
if ( !$this->isActionAllowed( $this->authAction ) ) {
|
||||
if ( $this->authAction === AuthManager::ACTION_LINK ) {
|
||||
// looks like no linking provider is installed or willing to take this user
|
||||
$titleMessage = wfMessage( 'cannotlink-no-provider-title' );
|
||||
$errorMessage = wfMessage( 'cannotlink-no-provider' );
|
||||
$titleMessage = $this->msg( 'cannotlink-no-provider-title' );
|
||||
$errorMessage = $this->msg( 'cannotlink-no-provider' );
|
||||
throw new ErrorPageError( $titleMessage, $errorMessage );
|
||||
} else {
|
||||
// user probably back-button-navigated into an auth session that no longer exists
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class SpecialUnlinkAccounts extends AuthManagerSpecialPage {
|
|||
}
|
||||
|
||||
$status = StatusValue::newGood();
|
||||
$status->warning( wfMessage( 'unlinkaccounts-success' ) );
|
||||
$status->warning( $this->msg( 'unlinkaccounts-success' ) );
|
||||
$this->loadAuth( $subPage, null, true ); // update requests so the unlinked one doesn't show up
|
||||
|
||||
// Reset sessions - if the user unlinked an account because it was compromised,
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class SpecialUpload extends SpecialPage {
|
|||
$this->mForReUpload = $request->getBool( 'wpForReUpload' ); // updating a file
|
||||
|
||||
$commentDefault = '';
|
||||
$commentMsg = wfMessage( 'upload-default-description' )->inContentLanguage();
|
||||
$commentMsg = $this->msg( 'upload-default-description' )->inContentLanguage();
|
||||
if ( !$this->mForReUpload && !$commentMsg->isDisabled() ) {
|
||||
$commentDefault = $commentMsg->plain();
|
||||
}
|
||||
|
|
@ -401,12 +401,12 @@ class SpecialUpload extends SpecialPage {
|
|||
} elseif ( $warning == 'no-change' ) {
|
||||
$file = $args;
|
||||
$filename = $file->getTitle()->getPrefixedText();
|
||||
$msg = "\t<li>" . wfMessage( 'fileexists-no-change', $filename )->parse() . "</li>\n";
|
||||
$msg = "\t<li>" . $this->msg( 'fileexists-no-change', $filename )->parse() . "</li>\n";
|
||||
} elseif ( $warning == 'duplicate-version' ) {
|
||||
$file = $args[0];
|
||||
$count = count( $args );
|
||||
$filename = $file->getTitle()->getPrefixedText();
|
||||
$message = wfMessage( 'fileexists-duplicate-version' )
|
||||
$message = $this->msg( 'fileexists-duplicate-version' )
|
||||
->params( $filename )
|
||||
->numParams( $count );
|
||||
$msg = "\t<li>" . $message->parse() . "</li>\n";
|
||||
|
|
@ -415,14 +415,14 @@ class SpecialUpload extends SpecialPage {
|
|||
$ltitle = SpecialPage::getTitleFor( 'Log' );
|
||||
$llink = $linkRenderer->makeKnownLink(
|
||||
$ltitle,
|
||||
wfMessage( 'deletionlog' )->text(),
|
||||
$this->msg( 'deletionlog' )->text(),
|
||||
[],
|
||||
[
|
||||
'type' => 'delete',
|
||||
'page' => Title::makeTitle( NS_FILE, $args )->getPrefixedText(),
|
||||
]
|
||||
);
|
||||
$msg = "\t<li>" . wfMessage( 'filewasdeleted' )->rawParams( $llink )->parse() . "</li>\n";
|
||||
$msg = "\t<li>" . $this->msg( 'filewasdeleted' )->rawParams( $llink )->parse() . "</li>\n";
|
||||
} elseif ( $warning == 'duplicate' ) {
|
||||
$msg = $this->getDupeWarning( $args );
|
||||
} elseif ( $warning == 'duplicate-archive' ) {
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
|
||||
if ( $type !== 'file' && $type !== 'thumb' ) {
|
||||
throw new UploadStashBadPathException(
|
||||
wfMessage( 'uploadstash-bad-path-unknown-type', $type )
|
||||
$this->msg( 'uploadstash-bad-path-unknown-type', $type )
|
||||
);
|
||||
}
|
||||
$fileName = strtok( '/' );
|
||||
|
|
@ -140,7 +140,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
$srcNamePos = strrpos( $thumbPart, $fileName );
|
||||
if ( $srcNamePos === false || $srcNamePos < 1 ) {
|
||||
throw new UploadStashBadPathException(
|
||||
wfMessage( 'uploadstash-bad-path-unrecognized-thumb-name' )
|
||||
$this->msg( 'uploadstash-bad-path-unrecognized-thumb-name' )
|
||||
);
|
||||
}
|
||||
$paramString = substr( $thumbPart, 0, $srcNamePos - 1 );
|
||||
|
|
@ -152,7 +152,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
return [ 'file' => $file, 'type' => $type, 'params' => $params ];
|
||||
} else {
|
||||
throw new UploadStashBadPathException(
|
||||
wfMessage( 'uploadstash-bad-path-no-handler', $file->getMimeType(), $file->getPath() )
|
||||
$this->msg( 'uploadstash-bad-path-no-handler', $file->getMimeType(), $file->getPath() )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -200,14 +200,14 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
$thumbnailImage = $file->transform( $params, $flags );
|
||||
if ( !$thumbnailImage ) {
|
||||
throw new UploadStashFileNotFoundException(
|
||||
wfMessage( 'uploadstash-file-not-found-no-thumb' )
|
||||
$this->msg( 'uploadstash-file-not-found-no-thumb' )
|
||||
);
|
||||
}
|
||||
|
||||
// we should have just generated it locally
|
||||
if ( !$thumbnailImage->getStoragePath() ) {
|
||||
throw new UploadStashFileNotFoundException(
|
||||
wfMessage( 'uploadstash-file-not-found-no-local-path' )
|
||||
$this->msg( 'uploadstash-file-not-found-no-local-path' )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
$this->stash->repo, $thumbnailImage->getStoragePath(), false );
|
||||
if ( !$thumbFile ) {
|
||||
throw new UploadStashFileNotFoundException(
|
||||
wfMessage( 'uploadstash-file-not-found-no-object' )
|
||||
$this->msg( 'uploadstash-file-not-found-no-object' )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
if ( !$status->isOK() ) {
|
||||
$errors = $status->getErrorsArray();
|
||||
throw new UploadStashFileNotFoundException(
|
||||
wfMessage(
|
||||
$this->msg(
|
||||
'uploadstash-file-not-found-no-remote-thumb',
|
||||
print_r( $errors, 1 ),
|
||||
$scalerThumbUrl
|
||||
|
|
@ -283,7 +283,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
$contentType = $req->getResponseHeader( "content-type" );
|
||||
if ( !$contentType ) {
|
||||
throw new UploadStashFileNotFoundException(
|
||||
wfMessage( 'uploadstash-file-not-found-missing-content-type' )
|
||||
$this->msg( 'uploadstash-file-not-found-missing-content-type' )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
private function outputLocalFile( File $file ) {
|
||||
if ( $file->getSize() > self::MAX_SERVE_BYTES ) {
|
||||
throw new SpecialUploadStashTooLargeException(
|
||||
wfMessage( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
|
||||
$this->msg( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
|
|||
$size = strlen( $content );
|
||||
if ( $size > self::MAX_SERVE_BYTES ) {
|
||||
throw new SpecialUploadStashTooLargeException(
|
||||
wfMessage( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
|
||||
$this->msg( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
|
||||
);
|
||||
}
|
||||
// Cancel output buffering and gzipping if set
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ class ImageListPager extends TablePager {
|
|||
if ( $thumb ) {
|
||||
return $thumb->toHtml( [ 'desc-link' => true ] );
|
||||
} else {
|
||||
return wfMessage( 'thumbnail_error', '' )->escaped();
|
||||
return $this->msg( 'thumbnail_error', '' )->escaped();
|
||||
}
|
||||
} else {
|
||||
return htmlspecialchars( $value );
|
||||
|
|
|
|||
Loading…
Reference in a new issue