r44869 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44868‎ | r44869 | r44870 >
Date:09:46, 21 December 2008
Author:aaron
Status:deferred
Tags:
Comment:
Fix patrol handling, particularly with $wgUseNPPatrol. Should cover bug 16724.
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -447,16 +447,16 @@
448448 #########
449449
450450 function efLoadFlaggedRevs() {
451 - global $wgUseRCPatrol, $wgUseNPPatrol, $wgFlaggedRevsNamespaces;
 451+ global $wgUseRCPatrol, $wgFlaggedRevsNamespaces;
 452+ # If patrolling is already on, then we know that it
 453+ # was intended to have all namespaces patrollable.
 454+ if( $wgUseRCPatrol ) {
 455+ global $wgFlaggedRevsPatrolNamespaces, $wgCanonicalNamespaceNames;
 456+ $wgFlaggedRevsPatrolNamespaces = array_keys( $wgCanonicalNamespaceNames );
 457+ }
452458 # Use RC Patrolling to check for vandalism
453459 # When revisions are flagged, they count as patrolled
454460 if( !empty($wgFlaggedRevsNamespaces) ) {
455 - # If patrolling is already on, then we know that it
456 - # was intended to have all namespaces patrollable.
457 - if( $wgUseRCPatrol || $wgUseNPPatrol ) {
458 - global $wgFlaggedRevsPatrolNamespaces, $wgCanonicalNamespaceNames;
459 - $wgFlaggedRevsPatrolNamespaces = array_keys( $wgCanonicalNamespaceNames );
460 - }
461461 $wgUseRCPatrol = true;
462462 }
463463 }
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -609,9 +609,19 @@
610610 return false;
611611 }
612612 $flaggedArticle = FlaggedArticle::getTitleInstance( $title );
 613+ # The page must be in a patrollable namespace...
613614 if( !$flaggedArticle->isPatrollable() ) {
614 - $result = false;
615 - return false;
 615+ global $wgUseNPPatrol;
 616+ # ...unless the page is not in a reviewable namespace and
 617+ # new page patrol is enabled. In this scenario, any edits
 618+ # to pages outside of patrollable namespaces would already
 619+ # be auto-patrolled, except for the new page edits.
 620+ if( $wgUseNPPatrol && !$flaggedArticle->isReviewable() ) {
 621+ return true;
 622+ } else {
 623+ $result = false;
 624+ return false;
 625+ }
616626 }
617627 return true;
618628 }
@@ -744,7 +754,10 @@
745755 $patrol = $wgUser->isAllowed('autopatrolother');
746756 $record = true;
747757 } else {
748 - $patrol = true; // mark by default
 758+ global $wgUseNPPatrol;
 759+ # Mark patrolled by default unless this is a new page
 760+ # and new page patrol is enabled.
 761+ $patrol = !( $wgUseNPPatrol && !empty($rc->mAttribs['rc_new']) );
749762 }
750763 if( $patrol ) {
751764 RevisionReview::updateRecentChanges( $rc->getTitle(), $rc->mAttribs['rc_this_oldid'] );

Status & tagging log