r101336 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101335‎ | r101336 | r101337 >
Date:04:06, 31 October 2011
Author:aaron
Status:ok
Tags:
Comment:
* Actually made use of getStableRevId() function in some places.
* Made RevisionReviewForm::doSubmit() sanity check the rev order when rejecting edits and also made it use timestamp to compare chronology rather than rev_id. WikiPage is used instead of Article.
Modified paths:
  • /trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/dataclasses/FRInclusionManager.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/dataclasses/FRInclusionManager.php
@@ -170,8 +170,7 @@
171171 $id = $this->stableVersions['templates'][$namespace][$dbKey];
172172 }
173173 if ( $id === null ) { // cache miss
174 - $srev = FlaggedRevision::newFromStable( $title );
175 - $id = $srev ? $srev->getRevId() : 0;
 174+ $id = FlaggedRevision::getStableRevId( $title );
176175 }
177176 $this->stableVersions['templates'][$namespace][$dbKey] = $id; // cache
178177 return $id;
Index: trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php
@@ -296,11 +296,16 @@
297297 } elseif ( !$newRev || $newRev->isDeleted( Revision::DELETED_TEXT ) ) {
298298 return 'review_bad_oldid';
299299 }
 300+ # Check that the revs are in order
 301+ if ( $oldRev->getTimestamp() > $newRev->getTimestamp() ) {
 302+ return 'review_cannot_undo';
 303+ }
 304+ # Make sure we are only rejecting pending changes
300305 $srev = FlaggedRevision::newFromStable( $this->page, FR_MASTER );
301 - if ( $srev && $srev->getRevId() > $oldRev->getId() ) {
 306+ if ( $srev && $oldRev->getTimestamp() < $srev->getRevTimestamp() ) {
302307 return 'review_cannot_reject'; // not really a use case
303308 }
304 - $article = new Article( $this->page );
 309+ $article = new WikiPage( $this->page );
305310 # Get text with changes after $oldRev up to and including $newRev removed
306311 $new_text = $article->getUndoText( $newRev, $oldRev );
307312 if ( $new_text === false ) {
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php
@@ -548,9 +548,9 @@
549549 // diff=review param (bug 16923)
550550 public static function checkDiffUrl( $titleObj, &$mOldid, &$mNewid, $old, $new ) {
551551 if ( $new === 'review' && isset( $titleObj ) ) {
552 - $frev = FlaggedRevision::newFromStable( $titleObj );
553 - if ( $frev ) {
554 - $mOldid = $frev->getRevId(); // stable
 552+ $sRevId = FlaggedRevision::getStableRevId( $titleObj );
 553+ if ( $sRevId ) {
 554+ $mOldid = $sRevId; // stable
555555 $mNewid = 0; // cur
556556 }
557557 }

Status & tagging log