r18254 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r18253‎ | r18254 | r18255 >
Date:09:39, 11 December 2006
Author:werdna
Status:old
Tags:
Comment:
Per discussion on wikitech-l, add an (undo) link for on-top revisions as well. Also, don't do a merge if (undo) is being used for a straight revert
Modified paths:
  • /trunk/phase3/includes/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -109,9 +109,14 @@
110110 $undorev_text = $undorev->getText();
111111 $oldrev_text = $oldrev->getText();
112112 $currev_text = $text;
 113+
 114+ #No use doing a merge if it's just a straight revert.
 115+ if ($currev_text != $undorev_text) {
 116+ $result = wfMerge($undorev_text, $oldrev_text, $currev_text, $text);
 117+ } else {
 118+ $result = true;
 119+ }
113120
114 - $result = wfMerge($undorev_text, $oldrev_text, $currev_text, $text);
115 -
116121 if (!$result) {
117122 #Undoing failed. Bailing out with regular revision text.
118123 $text = $currev_text;
Index: trunk/phase3/includes/DifferenceEngine.php
@@ -523,9 +523,11 @@
524524 $newLink = $this->mNewPage->escapeLocalUrl();
525525 $this->mPagetitle = htmlspecialchars( wfMsg( 'currentrev' ) );
526526 $newEdit = $this->mNewPage->escapeLocalUrl( 'action=edit' );
 527+ $newUndo = $this->mNewPage->escapeLocalUrl( 'action=edit&undo=' . $this->mNewid );
527528
528529 $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a> ($timestamp)"
529 - . " (<a href='$newEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)";
 530+ . " (<a href='$newEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)"
 531+ . " (<a href='$newUndo'>" . htmlspecialchars( wfMsg( 'editundo' ) ) . "</a>)";
530532
531533 } else {
532534 $newLink = $this->mNewPage->escapeLocalUrl( 'oldid=' . $this->mNewid );