Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/163619
Change subject: Revert "Replace wfMsgReplaceArgs by RawMessage"
......................................................................
Revert "Replace wfMsgReplaceArgs by RawMessage"
This was merged too quickly, has several issues.
This reverts commit 6abefb274ff9cd86f75d5d13f713e1971e1b27ce.
Change-Id: Ibf3e464fa9eb534d599274dd9262a30d5a6a6948
---
M includes/GlobalFunctions.php
M includes/api/ApiBase.php
M includes/api/ApiMain.php
M includes/db/DatabaseError.php
M includes/exception/MWException.php
M includes/page/WikiPage.php
6 files changed, 11 insertions(+), 18 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/19/163619/1
diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index a2160fb..3306acd 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -1602,7 +1602,6 @@
* @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 c80d903..7bc3f71 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1791,11 +1791,9 @@
}
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 d5c1c47..bd20b14 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -1306,8 +1306,7 @@
$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 f48458a..2dfec41 100644
--- a/includes/db/DatabaseError.php
+++ b/includes/db/DatabaseError.php
@@ -136,12 +136,10 @@
$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 0528d69..074128f 100644
--- a/includes/exception/MWException.php
+++ b/includes/exception/MWException.php
@@ -117,12 +117,10 @@
$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 f27c27a..9ade16e 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -3090,10 +3090,11 @@
$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 );
--
To view, visit https://gerrit.wikimedia.org/r/163619
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf3e464fa9eb534d599274dd9262a30d5a6a6948
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits