r72846 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72845‎ | r72846 | r72847 >
Date:10:02, 12 September 2010
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Made getUndoText() not use unreliable getContent() function (weird wgRequest dependency)
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -321,9 +321,13 @@
322322 * @return mixed string on success, false on failure
323323 */
324324 public function getUndoText( Revision $undo, Revision $undoafter = null ) {
 325+ $currentRev = Revision::newFromTitle( $this->mTitle );
 326+ if ( !$currentRev ) {
 327+ return false; // no page
 328+ }
325329 $undo_text = $undo->getText();
326330 $undoafter_text = $undoafter->getText();
327 - $cur_text = $this->getContent();
 331+ $cur_text = $currentRev->getText();
328332
329333 if ( $cur_text == $undo_text ) {
330334 # No use doing a merge if it's just a straight revert.

Follow-up revisions

RevisionCommit summaryAuthorDate
r77747MFT r72846 to fix bug 26238aaron22:42, 4 December 2010

Comments

#Comment by Platonides (talk | contribs)   13:31, 12 September 2010

I don't see the wgRequest dependency. I see it returning lots of messages if the page does not exist, though.

#Comment by Aaron Schulz (talk | contribs)   18:48, 12 September 2010

getContent calls loadContent, which sets to $oldid via getOldID (which itself calls getOldIDFromRequest) and then calls fetchContent( $oldid )

#Comment by Platonides (talk | contribs)   18:58, 12 September 2010

Thanks, I didn't see getOldID() dependance

#Comment by Nikerabbit (talk | contribs)   19:00, 12 September 2010

I had the very same problem in my extension, and it took weeks to debug it. I even filed a bug 24997 about it.

#Comment by Aaron Schulz (talk | contribs)   19:08, 12 September 2010

I just noticed it in testing for a "reject" button for flaggedrevs when testing the conflict scenario. "Undo" was saying they conflicted, but "reject" saying they merged :)

Status & tagging log