Custom rollback summaries now accept the same arguments as the default message
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 3 May 2008 16:07:57 +0000 (16:07 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 3 May 2008 16:07:57 +0000 (16:07 +0000)
RELEASE-NOTES
includes/Article.php

index 19fe2ee..b164414 100644 (file)
@@ -97,6 +97,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Update documentation links in auto-generated LocalSettings.php
 * (bug 13584) The new hook SkinTemplateToolboxEnd was added.
 * (bug 709) Cannot rename/move images and other media files [EXPERIMENTAL]
+* Custom rollback summaries now accept the same arguments as the default message
 
 === Bug fixes in 1.13 ===
 
index 6b141b3..6e714fa 100644 (file)
@@ -2423,7 +2423,7 @@ class Article {
         * doRollback() instead.
         */
        public function commitRollback($fromP, $summary, $bot, &$resultDetails) {
-               global $wgUseRCPatrol, $wgUser;
+               global $wgUseRCPatrol, $wgUser, $wgLang;
                $dbw = wfGetDB( DB_MASTER );
 
                if( wfReadOnly() ) {
@@ -2488,15 +2488,17 @@ class Article {
 
                # Generate the edit summary if necessary
                $target = Revision::newFromId( $s->rev_id );
-               if( empty( $summary ) )
-               {
-                       global $wgLang;
-                       $summary = wfMsgForContent( 'revertpage',
-                                        $target->getUserText(), $from,
-                                        $s->rev_id, $wgLang->timeanddate(wfTimestamp(TS_MW, $s->rev_timestamp), true),
-                                        $current->getId(), $wgLang->timeanddate($current->getTimestamp())
-                       );
+               if( empty( $summary ) ){
+                       $summary = wfMsgForContent( 'revertpage' );
                }
+               
+               # Allow the custom summary to use the same args as the default message
+               $args = array(
+                       $target->getUserText(), $from, $s->rev_id,
+                       $wgLang->timeanddate(wfTimestamp(TS_MW, $s->rev_timestamp), true),
+                       $current->getId(), $wgLang->timeanddate($current->getTimestamp())
+               );
+               $summary = wfMsgReplaceArgs( $summary, $args ); 
 
                # Save
                $flags = EDIT_UPDATE;