한국   대만   중국   일본 
r48149 MediaWiki - Code Review archive

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 @@
2451 2451 $this->mOutput->setFlag( 'vary-revision' );
2452 2452 wfDebug( __METHOD__ . ": {{REVISIONTIMESTAMP}} used, setting vary-revision...\n" );
2453 2453 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();
2454 2460 case 'namespace':
2455 2461 return str_replace('_',' ',$wgContLang->getNsText( $this->mTitle->getNamespace() ) );
2456 2462 case 'namespacee':
? ? @@ -4626,6 +4632,23 @@
4627 4633 }
4628 4634
4629 4635 /**
 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 + /**
4630 4653 * Mutator for $mDefaultSort
4631 4654 *
4632 4655 * @param $sort New value
Index: trunk/phase3/includes/MagicWord.php
? ? @@ -78,6 +78,7 @@
79 79 'revisionmonth',
80 80 'revisionyear',
81 81 'revisiontimestamp',
 82 + 'revisionuser',
82 83 'subpagename',
83 84 'subpagenamee',
84 85 'displaytitle',
Index: trunk/phase3/languages/messages/MessagesEn.php
? ? @@ -300,6 +300,7 @@
301 301 'revisionmonth' => array( 1, 'REVISIONMONTH' ),
302 302 'revisionyear' => array( 1, 'REVISIONYEAR' ),
303 303 'revisiontimestamp' => array( 1, 'REVISIONTIMESTAMP' ),
 304 + 'revisionuser' => array( 1, 'REVISIONUSER' ),
304 305 'plural' => array( 0, 'PLURAL:' ),
305 306 'fullurl' => array( 0, 'FULLURL:' ),
306 307 'fullurle' => array( 0, 'FULLURLE:' ),
Index: trunk/phase3/RELEASE-NOTES
? ? @@ -132,6 +132,8 @@
133 133 * (bug 17844) Redirect users to a specific page when they log in, see
134 134 $wgRedirectOnLogin
135 135 * 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
136 138
137 139 === Bug fixes in 1.15 ===
138 140 * (bug 16968) Special:Upload no longer throws useless warnings.

Follow-up revisions

Revision Commit summary Author Date
r48334 Follow up on r48149 , update RELEASE-NOTES pinky 23:02, 11 March 2009
r48342 Tweaked bug 10336 notes aaron 06: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