r55764 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55763‎ | r55764 | r55765 >
Date:22:16, 2 September 2009
Author:aaron
Status:ok
Tags:
Comment:
(bug 20372) Improve rollback-revisiondelete handling
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1753,6 +1753,7 @@
17541754 'alreadyrolled',
17551755 'editcomment',
17561756 'revertpage',
 1757+ 'revertpage-nouser',
17571758 'rollback-success',
17581759 'sessionfailure',
17591760 ),
Index: trunk/phase3/includes/Article.php
@@ -3003,6 +3003,8 @@
30043004 }
30053005
30063006 $from = str_replace( '_', ' ', $fromP );
 3007+ # User name given should match up with the top revision.
 3008+ # If the user was deleted then $from should be empty.
30073009 if( $from != $current->getUserText() ) {
30083010 $resultDetails = array( 'current' => $current );
30093011 return array(array('alreadyrolled',
@@ -3012,9 +3014,10 @@
30133015 ));
30143016 }
30153017
3016 - # Get the last edit not by this guy
3017 - $user = intval( $current->getUser() );
3018 - $user_text = $dbw->addQuotes( $current->getUserText() );
 3018+ # Get the last edit not by this guy...
 3019+ # Note: these may not be public values
 3020+ $user = intval( $current->getRawUser() );
 3021+ $user_text = $dbw->addQuotes( $current->getRawUserText() );
30193022 $s = $dbw->selectRow( 'revision',
30203023 array( 'rev_id', 'rev_timestamp', 'rev_deleted' ),
30213024 array( 'rev_page' => $current->getPage(),
@@ -3041,20 +3044,24 @@
30423045 $set['rc_patrolled'] = 1;
30433046 }
30443047
3045 - if( $set ) {
 3048+ if( count($set) ) {
30463049 $dbw->update( 'recentchanges', $set,
3047 - array( /* WHERE */
3048 - 'rc_cur_id' => $current->getPage(),
3049 - 'rc_user_text' => $current->getUserText(),
3050 - "rc_timestamp > '{$s->rev_timestamp}'",
3051 - ), __METHOD__
3052 - );
 3050+ array( /* WHERE */
 3051+ 'rc_cur_id' => $current->getPage(),
 3052+ 'rc_user_text' => $current->getUserText(),
 3053+ "rc_timestamp > '{$s->rev_timestamp}'",
 3054+ ), __METHOD__
 3055+ );
30533056 }
30543057
30553058 # Generate the edit summary if necessary
30563059 $target = Revision::newFromId( $s->rev_id );
3057 - if( empty( $summary ) ){
3058 - $summary = wfMsgForContent( 'revertpage' );
 3060+ if( empty( $summary ) ) {
 3061+ if( $from == '' ) { // no public user name
 3062+ $summary = wfMsgForContent( 'revertpage-nouser' );
 3063+ } else {
 3064+ $summary = wfMsgForContent( 'revertpage' );
 3065+ }
30593066 }
30603067
30613068 # Allow the custom summary to use the same args as the default message
@@ -3086,8 +3093,8 @@
30873094 $resultDetails = array(
30883095 'summary' => $summary,
30893096 'current' => $current,
3090 - 'target' => $target,
3091 - 'newid' => $revId
 3097+ 'target' => $target,
 3098+ 'newid' => $revId
30923099 );
30933100 return array();
30943101 }
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2666,6 +2666,7 @@
26672667 The last edit to the page was by [[User:$3|$3]] ([[User talk:$3|Talk]]{{int:pipe-separator}}[[Special:Contributions/$3|{{int:contribslink}}]]).',
26682668 'editcomment' => "The edit summary was: \"''\$1''\".",
26692669 'revertpage' => 'Reverted edits by [[Special:Contributions/$2|$2]] ([[User talk:$2|Talk]]) to last revision by [[User:$1|$1]]',
 2670+'revertpage-nouser' => 'Reverted edits by (username removed) to last revision by [[User:$1|$1]]',
26702671 'rollback-success' => 'Reverted edits by $1;
26712672 changed back to last revision by $2.',
26722673 'sessionfailure' => 'There seems to be a problem with your login session;

Status & tagging log