r47016 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47015‎ | r47016 | r47017 >
Date:17:42, 8 February 2009
Author:aaron
Status:deferred
Tags:
Comment:
Set sync key on edit for non-autoreview cases
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -697,14 +697,16 @@
698698 # Don't do so if an edit was auto-merged in between though...
699699 if( !$editTimestamp || !$prevTimestamp || $prevTimestamp == $editTimestamp ) {
700700 FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags, false );
701 - return true;
 701+ return true; // done!
702702 }
703703 }
704 - # Auto-reviewing must be enabled
705 - if( !$wgFlaggedRevsAutoReview ) return true;
706 - # User must have the required permissions
707 - if( !$user->isAllowed('autoreview') && !$user->isAllowed('bot') ) {
708 - return true;
 704+ # Get sync cache key
 705+ $key = wfMemcKey( 'flaggedrevs', 'includesSynced', $rev->getPage() );
 706+ global $wgMemc, $wgParserCacheExpireTime;
 707+ # Auto-reviewing must be enabled and user must have the required permissions
 708+ if( !$wgFlaggedRevsAutoReview || (!$user->isAllowed('autoreview') && !$user->isAllowed('bot')) ) {
 709+ $wgMemc->set( $key, FlaggedRevs::makeMemcObj('false'), $wgParserCacheExpireTime );
 710+ return true; // done! edit pending!
709711 }
710712 # If $baseRevId passed in, this is a null edit
711713 $isNullEdit = $baseRevId ? true : false;
@@ -741,7 +743,7 @@
742744 $frev = FlaggedRevision::newFromTitle( $title, $prevRevId, FR_MASTER );
743745 }
744746 }
745 - # Is this an edit directly to the stable version?
 747+ # Is this an edit directly to the stable version? Is it a new page?
746748 if( $reviewableNewPage || !is_null($frev) ) {
747749 # Assume basic flagging level unless this is a null edit
748750 if( $isNullEdit ) {
@@ -749,6 +751,9 @@
750752 }
751753 # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit...
752754 FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags );
 755+ } else {
 756+ # Done! edit pending!
 757+ $wgMemc->set( $key, FlaggedRevs::makeMemcObj('false'), $wgParserCacheExpireTime );
753758 }
754759 return true;
755760 }

Status & tagging log