r48149 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48148‎ | r48149 | r48150 >
Date:23:01, 7 March 2009
Author:pinky
Status:resolved (Comments)
Tags:
Comment:
(bug 10336) Added new magic word {{REVISIONUSER}}, which displays the user name of the last user to edit the page
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -2450,6 +2450,12 @@
24512451 $this->mOutput->setFlag( 'vary-revision' );
24522452 wfDebug( __METHOD__ . ": {{REVISIONTIMESTAMP}} used, setting vary-revision...\n" );
24532453 return $this->getRevisionTimestamp();
 2454+ case 'revisionuser':
 2455+ // Let the edit saving system know we should parse the page
 2456+ // *after* a revision ID has been assigned. This is for null edits.
 2457+ $this->mOutput->setFlag( 'vary-revision' );
 2458+ wfDebug( __METHOD__ . ": {{REVISIONUSER}} used, setting vary-revision...\n" );
 2459+ return $this->getRevisionUser();
24542460 case 'namespace':
24552461 return str_replace('_',' ',$wgContLang->getNsText( $this->mTitle->getNamespace() ) );
24562462 case 'namespacee':
@@ -4626,6 +4632,23 @@
46274633 }
46284634
46294635 /**
 4636+ * Get the name of the user that edited the last revision
 4637+ */
 4638+ function getRevisionUser() {
 4639+ // if this template is subst: the revision id will be blank,
 4640+ // so just use the current user's name
 4641+ if( $this->mRevisionId ) {
 4642+ $dbr = wfGetDB( DB_SLAVE );
 4643+ $revuser = $dbr->selectField( 'revision', 'rev_user_text',
 4644+ array( 'rev_id' => $this->mRevisionId ), __METHOD__ );
 4645+ } else {
 4646+ global $wgUser;
 4647+ $revuser = $wgUser->getName();
 4648+ }
 4649+ return $revuser;
 4650+ }
 4651+
 4652+ /**
46304653 * Mutator for $mDefaultSort
46314654 *
46324655 * @param $sort New value
Index: trunk/phase3/includes/MagicWord.php
@@ -78,6 +78,7 @@
7979 'revisionmonth',
8080 'revisionyear',
8181 'revisiontimestamp',
 82+ 'revisionuser',
8283 'subpagename',
8384 'subpagenamee',
8485 'displaytitle',
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -300,6 +300,7 @@
301301 'revisionmonth' => array( 1, 'REVISIONMONTH' ),
302302 'revisionyear' => array( 1, 'REVISIONYEAR' ),
303303 'revisiontimestamp' => array( 1, 'REVISIONTIMESTAMP' ),
 304+ 'revisionuser' => array( 1, 'REVISIONUSER' ),
304305 'plural' => array( 0, 'PLURAL:' ),
305306 'fullurl' => array( 0, 'FULLURL:' ),
306307 'fullurle' => array( 0, 'FULLURLE:' ),
Index: trunk/phase3/RELEASE-NOTES
@@ -132,6 +132,8 @@
133133 * (bug 17844) Redirect users to a specific page when they log in, see
134134 $wgRedirectOnLogin
135135 * Added a link to Special:UserRights on Special:Contributions for privileged users
 136+* (bug 10336) Added new magic word {{REVISIONUSER}}, which displays the user
 137+ name of the last user to edit the page
136138
137139 === Bug fixes in 1.15 ===
138140 * (bug 16968) Special:Upload no longer throws useless warnings.

Follow-up revisions

RevisionCommit summaryAuthorDate
r48334Follow up on r48149, update RELEASE-NOTESpinky23:02, 11 March 2009
r48342Tweaked bug 10336 notesaaron06:28, 12 March 2009

Comments

#Comment by Aaron Schulz (talk | contribs)   05:03, 8 March 2009

RELEASE-NOTES look wrong, should be "edit of this revision" not "last editor"

#Comment by Pinky (talk | contribs)   00:50, 10 March 2009
  • (bug 10336) Added new magic word , which displays the editor of the current revision's user name -- better?
#Comment by Pinky (talk | contribs)   23:04, 11 March 2009

Updated in r48334

#Comment by Jack Phoenix (talk | contribs)   23:04, 11 March 2009

Resolved in r48334.

Status & tagging log