From: Anomie Date: Mon, 29 Sep 2014 17:41:56 +0000 (+0000) Subject: Revert "Replace wfMsgReplaceArgs by RawMessage" X-Git-Tag: 1.31.0-rc.0~13770^2 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=8f0ed5f5a73dca913e6a76d2c84c8f3847ef9f95;p=lhc%2Fweb%2Fwiklou.git Revert "Replace wfMsgReplaceArgs by RawMessage" This was merged too quickly, has several issues. This reverts commit 6abefb274ff9cd86f75d5d13f713e1971e1b27ce. Change-Id: Ibf3e464fa9eb534d599274dd9262a30d5a6a6948 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index a2160fb478..3306acda3e 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1602,7 +1602,6 @@ function wfMsgGetKey( $key, $useDB = true, $langCode = false, $transform = true * @param string $message * @param array $args * @return string - * @deprecated since 1.25 Use the RawMessage class * @private */ function wfMsgReplaceArgs( $message, $args ) { diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index c80d90351c..7bc3f71f4f 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1791,11 +1791,9 @@ abstract class ApiBase extends ContextSource { } if ( isset( self::$messageMap[$key] ) ) { - $codeMsg = new RawMessage( self::$messageMap[$key]['code'] ); - $infoMsg = new RawMessage( self::$messageMap[$key]['info'] ); return array( - 'code' => $codeMsg->params( $error )->text(), - 'info' => $infoMsg->params( $error )->text() + 'code' => wfMsgReplaceArgs( self::$messageMap[$key]['code'], $error ), + 'info' => wfMsgReplaceArgs( self::$messageMap[$key]['info'], $error ) ); } diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index d5c1c475ad..bd20b140f6 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -1306,8 +1306,7 @@ class ApiMain extends ApiBase { $msg .= "\n$astriks Permissions $astriks\n\n"; foreach ( self::$mRights as $right => $rightMsg ) { $groups = User::getGroupsWithPermission( $right ); - $rightRawMsg = new RawMessage( $rightMsg['msg'] ); - $msg .= "* " . $right . " *\n " . $rightRawMsg->params( $rightMsg['params'] )->text() . + $msg .= "* " . $right . " *\n " . wfMsgReplaceArgs( $rightMsg['msg'], $rightMsg['params'] ) . "\nGranted to:\n " . str_replace( '*', 'all', implode( ', ', $groups ) ) . "\n\n"; } diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php index f48458a824..2dfec41dd7 100644 --- a/includes/db/DatabaseError.php +++ b/includes/db/DatabaseError.php @@ -136,12 +136,10 @@ class DBConnectionError extends DBExpectedError { $args = array_slice( func_get_args(), 2 ); if ( $this->useMessageCache() ) { - $msg = wfMessage( $key )->useDatabase( false ); + return wfMessage( $key, $args )->useDatabase( false )->text(); } else { - $msg = new RawMessage( $fallback ); + return wfMsgReplaceArgs( $fallback, $args ); } - - return $msg->params( $args )->text(); } /** diff --git a/includes/exception/MWException.php b/includes/exception/MWException.php index 0528d69d44..074128f889 100644 --- a/includes/exception/MWException.php +++ b/includes/exception/MWException.php @@ -117,12 +117,10 @@ class MWException extends Exception { $args = array_slice( func_get_args(), 2 ); if ( $this->useMessageCache() ) { - $msg = wfMessage( $key ); + return wfMessage( $key, $args )->text(); } else { - $msg = new RawMessage( $fallback ); + return wfMsgReplaceArgs( $fallback, $args ); } - - return $msg->params( $args )->text(); } /** diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index f27c27a47f..9ade16e5af 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -3090,10 +3090,11 @@ class WikiPage implements Page, IDBAccessObject { $wgContLang->timeanddate( wfTimestamp( TS_MW, $s->rev_timestamp ) ), $current->getId(), $wgContLang->timeanddate( $current->getTimestamp() ) ); - if ( !$summary instanceof Message ) { - $summary = new RawMessage( $summary ); + if ( $summary instanceof Message ) { + $summary = $summary->params( $args )->inContentLanguage()->text(); + } else { + $summary = wfMsgReplaceArgs( $summary, $args ); } - $summary = $summary->params( $args )->inContentLanguage()->text(); // Trim spaces on user supplied text $summary = trim( $summary );