r45526 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45525‎ | r45526 | r45527 >
Date:21:56, 7 January 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
(bug 16924) Deleting and restoring versions will result in entry on OldReviewedPages
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -602,8 +602,7 @@
603603 * Updates the fp_stable and fp_reviewed fields
604604 */
605605 public static function updateArticleOn( $article, $revId, $latest=NULL ) {
606 - if( !$article->getId() )
607 - return true; // no bogus entries
 606+ if( !$article->getId() ) return true; // no bogus entries
608607
609608 $lastID = $latest ? $latest : $article->getTitle()->getLatestRevID(GAID_FOR_UPDATE);
610609 # Get the highest quality revision (not necessarily this one)
@@ -613,18 +612,24 @@
614613 array( 'fr_page_id' => $article->getId(),
615614 'rev_id = fr_rev_id',
616615 'rev_page = fr_page_id',
617 - 'rev_deleted & '.Revision::DELETED_TEXT => 0 ),
 616+ 'rev_deleted & '.Revision::DELETED_TEXT => 0
 617+ ),
618618 __METHOD__,
619619 array( 'ORDER BY' => 'fr_quality DESC', 'LIMIT' => 1 )
620620 );
621621 # Get the timestamp of the edit after the stable version (if any)
622 - $nextTimestamp = $dbw->selectField( 'revision',
623 - 'rev_timestamp',
624 - array( 'rev_page' => $article->getId(),
625 - "rev_id > ".intval($revId) ),
626 - __METHOD__,
627 - array( 'ORDER BY' => 'rev_id ASC', 'LIMIT' => 1 )
628 - );
 622+ if( $lastID != $revId ) {
 623+ $timestamp = Revision::getTimestampFromId( $article->getTitle(), $revId );
 624+ $nextTimestamp = $dbw->selectField( 'revision',
 625+ 'rev_timestamp',
 626+ array( 'rev_page' => $article->getId(),
 627+ "rev_timestamp > ".$dbw->strencode( $dbw->timestamp($timestamp) ) ),
 628+ __METHOD__,
 629+ array( 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 1 )
 630+ );
 631+ } else {
 632+ $nextTimestamp = null;
 633+ }
629634 # Alter table metadata
630635 $dbw->replace( 'flaggedpages',
631636 array( 'fp_page_id' ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r45715Cleanup for r45526: use addQuotes rather than strencode on a timestamp parame...brion18:55, 13 January 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   18:55, 13 January 2009

Tweaked that strencode to an addQuotes in r45715

Status & tagging log