(bug 12575) Prevent duplicate patrol log entries from being created
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 28 Feb 2008 21:41:06 +0000 (21:41 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 28 Feb 2008 21:41:06 +0000 (21:41 +0000)
RELEASE-NOTES
includes/Article.php

index 3d3123b..552eefa 100644 (file)
@@ -57,6 +57,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   'opensearch-desc' message.
 * (bug 13135) Special:Userrights now passes IDs through form submission
   to allow functionality on not-quite-right usernames
+* (bug 12575) Prevent duplicate patrol log entries from being created
 
 
 === API changes in 1.13 ===
index 68e561a..cc0e2c5 100644 (file)
@@ -1531,7 +1531,7 @@ class Article {
                        return;
                }
 
-               if ( !$wgUseRCPatrol && $rc->mAttribs['rc_type'] != RC_NEW) {
+               if ( !$wgUseRCPatrol && $rc->getAttribute( 'rc_type' ) != RC_NEW) {
                        // Only new pages can be patrolled if the general patrolling is off....???
                        // @fixme -- is this necessary? Shouldn't we only bother controlling the
                        // front end here?
@@ -1554,7 +1554,7 @@ class Article {
                }
 
                #It would be nice to see where the user had actually come from, but for now just guess
-               $returnto = $rc->mAttribs['rc_type'] == RC_NEW ? 'Newpages' : 'Recentchanges';
+               $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges';
                $return = Title::makeTitle( NS_SPECIAL, $returnto );
 
                # If it's left up to us, check that the user is allowed to patrol this edit
@@ -1575,10 +1575,14 @@ class Article {
                        }
                }
 
-               # Mark the edit as patrolled
-               RecentChange::markPatrolled( $rcid );
-               PatrolLog::record( $rcid );
-               wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
+               # Check that the revision isn't patrolled already
+               # Prevents duplicate log entries
+               if( !$rc->getAttribute( 'rc_patrolled' ) ) {
+                       # Mark the edit as patrolled
+                       RecentChange::markPatrolled( $rcid );
+                       PatrolLog::record( $rcid );
+                       wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
+               }
 
                # Inform the user
                $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) );