From c848f486bcc6065826b3f322a60361d0bdf76949 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Tue, 21 Aug 2012 21:58:47 +0200 Subject: [PATCH] Replace deprecated wfMsg* calls with Message class calls. Doing this in steps of roughly 100 changes per commit, so that it remains reviewable. This should be the one but last change set with the "easy" ones for core. Change-Id: If894a92dd65b2f5f4f096b9133685eb3b067a1d8 --- includes/api/ApiParse.php | 2 +- includes/api/ApiQueryLogEvents.php | 2 +- includes/api/ApiQueryProtectedTitles.php | 2 +- includes/api/ApiQueryRecentChanges.php | 2 +- includes/api/ApiQueryRevisions.php | 2 +- includes/installer/DatabaseInstaller.php | 8 +-- includes/installer/Installer.php | 17 +++--- includes/installer/WebInstaller.php | 29 +++++----- includes/installer/WebInstallerOutput.php | 4 +- includes/installer/WebInstallerPage.php | 63 +++++++++++---------- includes/job/UploadFromUrlJob.php | 18 +++--- skins/CologneBlue.php | 67 +++++++++-------------- skins/Nostalgia.php | 6 +- skins/Standard.php | 31 +++++------ 14 files changed, 122 insertions(+), 131 deletions(-) diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 8aac2f4780..c63ae8ac67 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -425,7 +425,7 @@ class ApiParse extends ApiBase { $text == '' ? $l : $text ); } - $s .= implode( htmlspecialchars( wfMsgExt( 'pipe-separator', 'escapenoentities' ) ), $langs ); + $s .= implode( wfMessage( 'pipe-separator' )->escaped(), $langs ); if ( $wgContLang->isRTL() ) { $s = Html::rawElement( 'span', array( 'dir' => "LTR" ), $s ); diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index bc514b35c7..f2fd42519c 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -359,7 +359,7 @@ class ApiQueryLogEvents extends ApiQueryBase { public function getCacheMode( $params ) { if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) { - // formatComment() calls wfMsg() among other things + // formatComment() calls wfMessage() among other things return 'anon-public-user-private'; } else { return 'public'; diff --git a/includes/api/ApiQueryProtectedTitles.php b/includes/api/ApiQueryProtectedTitles.php index 5e270e0a31..14aed28d7a 100644 --- a/includes/api/ApiQueryProtectedTitles.php +++ b/includes/api/ApiQueryProtectedTitles.php @@ -139,7 +139,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { public function getCacheMode( $params ) { if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) { - // formatComment() calls wfMsg() among other things + // formatComment() calls wfMessage() among other things return 'anon-public-user-private'; } else { return 'public'; diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 7bb6bc5140..7ae4f371ab 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -503,7 +503,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { return 'private'; } if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) { - // formatComment() calls wfMsg() among other things + // formatComment() calls wfMessage() among other things return 'anon-public-user-private'; } return 'public'; diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 18a6cd419a..b89a8ea983 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -548,7 +548,7 @@ class ApiQueryRevisions extends ApiQueryBase { return 'private'; } if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) { - // formatComment() calls wfMsg() among other things + // formatComment() calls wfMessage() among other things return 'anon-public-user-private'; } return 'public'; diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 0beedfa462..de59b2d65f 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -334,7 +334,7 @@ abstract class DatabaseInstaller { * @return String */ public function getReadableName() { - return wfMsg( 'config-type-' . $this->getName() ); + return wfMessage( 'config-type-' . $this->getName() )->text(); } /** @@ -509,7 +509,7 @@ abstract class DatabaseInstaller { public function getInstallUserBox() { return Html::openElement( 'fieldset' ) . - Html::element( 'legend', array(), wfMsg( 'config-db-install-account' ) ) . + Html::element( 'legend', array(), wfMessage( 'config-db-install-account' )->text() ) . $this->getTextBox( '_InstallUser', 'config-db-username', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-install-username' ) ) . $this->getPasswordBox( '_InstallPassword', 'config-db-password', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-install-password' ) ) . Html::closeElement( 'fieldset' ); @@ -534,7 +534,7 @@ abstract class DatabaseInstaller { public function getWebUserBox( $noCreateMsg = false ) { $wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : ''; $s = Html::openElement( 'fieldset' ) . - Html::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) . + Html::element( 'legend', array(), wfMessage( 'config-db-web-account' )->text() ) . $this->getCheckBox( '_SameAccount', 'config-db-web-account-same', array( 'class' => 'hideShowRadio', 'rel' => 'dbOtherAccount' ) @@ -544,7 +544,7 @@ abstract class DatabaseInstaller { $this->getPasswordBox( 'wgDBpassword', 'config-db-password' ) . $this->parent->getHelpBox( 'config-db-web-help' ); if ( $noCreateMsg ) { - $s .= $this->parent->getWarningBox( wfMsgNoTrans( $noCreateMsg ) ); + $s .= $this->parent->getWarningBox( wfMessage( $noCreateMsg )->plain() ); } else { $s .= $this->getCheckBox( '_CreateDBAccount', 'config-db-web-create' ); } diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index d87f294e32..cbede1ec88 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -308,7 +308,7 @@ abstract class Installer { /** * UI interface for displaying a short message - * The parameters are like parameters to wfMsg(). + * The parameters are like parameters to wfMessage(). * The messages will be in wikitext format, which will be converted to an * output format such as HTML or text before being sent to the user. * @param $msg @@ -645,7 +645,7 @@ abstract class Installer { $allNames = array(); foreach ( self::getDBTypes() as $name ) { - $allNames[] = wfMsg( "config-type-$name" ); + $allNames[] = wfMessage( "config-type-$name" )->text(); } // cache initially available databases to make sure that everything will be displayed correctly @@ -1585,12 +1585,13 @@ abstract class Installer { $status = Status::newGood(); try { $page = WikiPage::factory( Title::newMainPage() ); - $page->doEdit( wfMsgForContent( 'mainpagetext' ) . "\n\n" . - wfMsgForContent( 'mainpagedocfooter' ), - '', - EDIT_NEW, - false, - User::newFromName( 'MediaWiki default' ) ); + $page->doEdit( wfMessage( 'mainpagetext' )->inContentLanguage()->text() . "\n\n" . + wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text(), + '', + EDIT_NEW, + false, + User::newFromName( 'MediaWiki default' ) + ); } catch (MWException $e) { //using raw, because $wgShowExceptionDetails can not be set yet $status->fatal( 'config-install-mainpage-failed', $e->getMessage() ); diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 4f31195e84..e1c5c29961 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -369,7 +369,7 @@ class WebInstaller extends Installer { } /** - * Show an error message in a box. Parameters are like wfMsg(). + * Show an error message in a box. Parameters are like wfMessage(). * @param $msg */ public function showError( $msg /*...*/ ) { @@ -540,7 +540,7 @@ class WebInstaller extends Installer { $s .= $this->getPageListItem( 'Restart', true, $currentPageName ); $s .= "\n"; // end list pane $s .= Html::element( 'h2', array(), - wfMsg( 'config-page-' . strtolower( $currentPageName ) ) ); + wfMessage( 'config-page-' . strtolower( $currentPageName ) )->text() ); $this->output->addHTMLNoFlush( $s ); } @@ -556,7 +556,7 @@ class WebInstaller extends Installer { */ private function getPageListItem( $pageName, $enabled, $currentPageName ) { $s = "
  • "; - $name = wfMsg( 'config-page-' . strtolower( $pageName ) ); + $name = wfMessage( 'config-page-' . strtolower( $pageName ) )->text(); if ( $enabled ) { $query = array( 'page' => $pageName ); @@ -609,7 +609,7 @@ class WebInstaller extends Installer { /** * Get HTML for an error box with an icon. * - * @param $text String: wikitext, get this with wfMsgNoTrans() + * @param $text String: wikitext, get this with wfMessage()->plain() * * @return string */ @@ -620,7 +620,7 @@ class WebInstaller extends Installer { /** * Get HTML for a warning box with an icon. * - * @param $text String: wikitext, get this with wfMsgNoTrans() + * @param $text String: wikitext, get this with wfMessage()->plain() * * @return string */ @@ -631,7 +631,7 @@ class WebInstaller extends Installer { /** * Get HTML for an info box with an icon. * - * @param $text String: wikitext, get this with wfMsgNoTrans() + * @param $text String: wikitext, get this with wfMessage()->plain() * @param $icon String: icon name, file in skins/common/images * @param $class String: additional class name to add to the wrapper div * @@ -640,13 +640,13 @@ class WebInstaller extends Installer { public function getInfoBox( $text, $icon = false, $class = false ) { $text = $this->parse( $text, true ); $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/'.$icon; - $alt = wfMsg( 'config-information' ); + $alt = wfMessage( 'config-information' )->text(); return Html::infoBox( $text, $icon, $alt, $class, false ); } /** * Get small text indented help for a preceding form field. - * Parameters like wfMsg(). + * Parameters like wfMessage(). * * @param $msg * @return string @@ -659,14 +659,15 @@ class WebInstaller extends Installer { $html = $this->parse( $text, true ); return "
    \n" . - "" . wfMsgHtml( 'config-help' ) . "\n" . + "" . wfMessage( 'config-help' )->escaped() . + "\n" . "" . $html . "\n" . "
    \n"; } /** * Output a help box. - * @param $msg String key for wfMsg() + * @param $msg String key for wfMessage() */ public function showHelpBox( $msg /*, ... */ ) { $args = func_get_args(); @@ -713,7 +714,7 @@ class WebInstaller extends Installer { if ( strval( $msg ) == '' ) { $labelText = ' '; } else { - $labelText = wfMsgHtml( $msg ); + $labelText = wfMessage( $msg )->escaped(); } $attributes = array( 'class' => 'config-label' ); @@ -893,7 +894,7 @@ class WebInstaller extends Installer { if( isset( $params['rawtext'] ) ) { $labelText = $params['rawtext']; } else { - $labelText = $this->parse( wfMsg( $params['label'] ) ); + $labelText = $this->parse( wfMessage( $params['label'] )->text() ); } return @@ -969,7 +970,7 @@ class WebInstaller extends Installer { Xml::radio( $params['controlName'], $value, $checked, $itemAttribs ) . ' ' . Xml::tags( 'label', array( 'for' => $id ), $this->parse( - wfMsgNoTrans( $params['itemLabelPrefix'] . strtolower( $value ) ) + wfMessage( $params['itemLabelPrefix'] . strtolower( $value ) )->plain() ) ) . "
  • \n"; } @@ -1077,7 +1078,7 @@ class WebInstaller extends Installer { ) ); $anchor = Html::rawElement( 'a', array( 'href' => $this->getURL( array( 'localsettings' => 1 ) ) ), - $img . ' ' . wfMsgHtml( 'config-download-localsettings' ) ); + $img . ' ' . wfMessage( 'config-download-localsettings' )->escaped() ); return Html::rawElement( 'div', array( 'class' => 'config-download-link' ), $anchor ); } diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index 84d115b51d..9a516a65b7 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -273,7 +273,7 @@ class WebInstallerOutput {
    parent->parse( wfMsgNoTrans( 'config-sidebar' ), true ); + echo $this->parent->parse( wfMessage( 'config-sidebar' )->plain(), true ); ?>
    @@ -301,7 +301,7 @@ class WebInstallerOutput { public function outputTitle() { global $wgVersion; - echo htmlspecialchars( wfMsg( 'config-title', $wgVersion ) ); + echo wfMessage( 'config-title', $wgVersion )->escaped(); } public function getJQuery() { diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 917a59ae79..a7ec2dffc6 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -84,13 +84,13 @@ abstract class WebInstallerPage { if ( $continue ) { // Fake submit button for enter keypress (bug 26267) - $s .= Xml::submitButton( wfMsg( "config-$continue" ), + $s .= Xml::submitButton( wfMessage( "config-$continue" )->text(), array( 'name' => "enter-$continue", 'style' => 'visibility:hidden;overflow:hidden;width:1px;margin:0' ) ) . "\n"; } if ( $back ) { - $s .= Xml::submitButton( wfMsg( "config-$back" ), + $s .= Xml::submitButton( wfMessage( "config-$back" )->text(), array( 'name' => "submit-$back", 'tabindex' => $this->parent->nextTabIndex() @@ -98,7 +98,7 @@ abstract class WebInstallerPage { } if ( $continue ) { - $s .= Xml::submitButton( wfMsg( "config-$continue" ), + $s .= Xml::submitButton( wfMessage( "config-$continue" )->text(), array( 'name' => "submit-$continue", 'tabindex' => $this->parent->nextTabIndex(), @@ -133,7 +133,7 @@ abstract class WebInstallerPage { * @return string */ protected function getFieldsetStart( $legend ) { - return "\n
    " . wfMsgHtml( $legend ) . "\n"; + return "\n
    " . wfMessage( $legend )->escaped() . "\n"; } /** @@ -295,8 +295,8 @@ class WebInstaller_ExistingWiki extends WebInstallerPage { } $this->startForm(); $this->addHTML( $this->parent->getInfoBox( - wfMsgNoTrans( 'config-upgrade-key-missing', - "
    \$wgUpgradeKey = '" . $this->getVar( 'wgUpgradeKey' ) . "';
    " ) + wfMessage( 'config-upgrade-key-missing', "
    \$wgUpgradeKey = '" .
    +					$this->getVar( 'wgUpgradeKey' ) . "';
    " )->plain() ) ); $this->endForm( 'continue' ); return 'output'; @@ -333,7 +333,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage { protected function showKeyForm() { $this->startForm(); $this->addHTML( - $this->parent->getInfoBox( wfMsgNoTrans( 'config-localsettings-upgrade' ) ). + $this->parent->getInfoBox( wfMessage( 'config-localsettings-upgrade' )->plain() ). '
    ' . $this->parent->getTextBox( array( 'var' => 'wgUpgradeKey', @@ -410,13 +410,13 @@ class WebInstaller_Welcome extends WebInstallerPage { return 'continue'; } } - $this->parent->output->addWikiText( wfMsgNoTrans( 'config-welcome' ) ); + $this->parent->output->addWikiText( wfMessage( 'config-welcome' )->plain() ); $status = $this->parent->doEnvironmentChecks(); if ( $status->isGood() ) { $this->parent->output->addHTML( '' . - wfMsgHtml( 'config-env-good' ) . '' ); - $this->parent->output->addWikiText( wfMsgNoTrans( 'config-copyright', - SpecialVersion::getCopyrightAndAuthorList() ) ); + wfMessage( 'config-env-good' )->escaped() . '' ); + $this->parent->output->addWikiText( wfMessage( 'config-copyright', + SpecialVersion::getCopyrightAndAuthorList() )->plain() ); $this->startForm(); $this->endForm(); } else { @@ -454,10 +454,10 @@ class WebInstaller_DBConnect extends WebInstallerPage { $dbSupport = ''; foreach( $this->parent->getDBTypes() as $type ) { $link = DatabaseBase::factory( $type )->getSoftwareLink(); - $dbSupport .= wfMsgNoTrans( "config-support-$type", $link ) . "\n"; + $dbSupport .= wfMessage( "config-support-$type", $link )->plain() . "\n"; } $this->addHTML( $this->parent->getInfoBox( - wfMsg( 'config-support-info', trim( $dbSupport ) ) ) ); + wfMessage( 'config-support-info', trim( $dbSupport ) )->text() ) ); foreach ( $this->parent->getVar( '_CompiledDBs' ) as $type ) { $installer = $this->parent->getDBInstaller( $type ); @@ -476,7 +476,7 @@ class WebInstaller_DBConnect extends WebInstallerPage { $settings .= Html::openElement( 'div', array( 'id' => 'DB_wrapper_' . $type, 'class' => 'dbWrapper' ) ) . - Html::element( 'h3', array(), wfMsg( 'config-header-' . $type ) ) . + Html::element( 'h3', array(), wfMessage( 'config-header-' . $type )->text() ) . $installer->getConnectForm() . "\n"; } @@ -555,7 +555,7 @@ class WebInstaller_Upgrade extends WebInstallerPage { $this->startForm(); $this->addHTML( $this->parent->getInfoBox( - wfMsgNoTrans( 'config-can-upgrade', $GLOBALS['wgVersion'] ) ) ); + wfMessage( 'config-can-upgrade', $GLOBALS['wgVersion'] )->plain() ) ); $this->endForm(); } @@ -570,11 +570,11 @@ class WebInstaller_Upgrade extends WebInstallerPage { $this->parent->disableLinkPopups(); $this->addHTML( $this->parent->getInfoBox( - wfMsgNoTrans( $msg, + wfMessage( $msg, $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/index' . $this->getVar( 'wgScriptExtension' ) - ), 'tick-32.png' + )->plain(), 'tick-32.png' ) ); $this->parent->restoreLinkPopups(); @@ -635,7 +635,10 @@ class WebInstaller_Name extends WebInstallerPage { // Set wgMetaNamespace to something valid before we show the form. // $wgMetaNamespace defaults to $wgSiteName which is 'MediaWiki' $metaNS = $this->getVar( 'wgMetaNamespace' ); - $this->setVar( 'wgMetaNamespace', wfMsgForContent( 'config-ns-other-default' ) ); + $this->setVar( + 'wgMetaNamespace', + wfMessage( 'config-ns-other-default' )->inContentLanguage()->text() + ); $this->addHTML( $this->parent->getTextBox( array( @@ -683,7 +686,7 @@ class WebInstaller_Name extends WebInstallerPage { 'help' => $this->parent->getHelpBox( 'config-subscribe-help' ) ) ) . $this->getFieldSetEnd() . - $this->parent->getInfoBox( wfMsg( 'config-almost-done' ) ) . + $this->parent->getInfoBox( wfMessage( 'config-almost-done' )->text() ) . $this->parent->getRadioSet( array( 'var' => '_SkipOptional', 'itemLabelPrefix' => 'config-optional-', @@ -721,7 +724,7 @@ class WebInstaller_Name extends WebInstallerPage { $name = preg_replace( '/__+/', '_', $name ); $name = ucfirst( trim( $name, '_' ) ); } elseif ( $nsType == 'generic' ) { - $name = wfMsg( 'config-ns-generic' ); + $name = wfMessage( 'config-ns-generic' )->text(); } else { // other $name = $this->getVar( 'wgMetaNamespace' ); } @@ -833,7 +836,7 @@ class WebInstaller_Options extends WebInstallerPage { 'itemLabelPrefix' => 'config-profile-', 'values' => array_keys( $this->parent->rightsProfiles ), ) ) . - $this->parent->getInfoBox( wfMsgNoTrans( 'config-profile-help' ) ) . + $this->parent->getInfoBox( wfMessage( 'config-profile-help' )->plain() ) . # Licensing $this->parent->getRadioSet( array( @@ -1046,7 +1049,7 @@ class WebInstaller_Options extends WebInstallerPage { 'href' => $this->getCCPartnerUrl(), 'onclick' => $expandJs, ), - wfMsg( 'config-cc-again' ) + wfMessage( 'config-cc-again' )->text() ) . "

    \n" . "