Added autopatrol parameter to MarkPatrolled and MarkPatrolledComplete hooks
authorLojjik Braughler <llbraughler@gmail.com>
Mon, 5 Oct 2015 22:34:07 +0000 (18:34 -0400)
committerLojjik Braughler <llbraughler@gmail.com>
Mon, 12 Oct 2015 20:13:36 +0000 (16:13 -0400)
Change-Id: Ibc832ba8cec8eaef673ef07534c5522f678e8f58

docs/hooks.txt
includes/changes/RecentChange.php

index 2d268b8..ff3916f 100644 (file)
@@ -1956,12 +1956,14 @@ $rcid: ID of the revision to be marked patrolled
 $user: the user (object) marking the revision as patrolled
 $wcOnlySysopsCanPatrol: config setting indicating whether the user needs to be a
   sysop in order to mark an edit patrolled.
+$auto true if the edit is being marked as patrolled automatically
 
 'MarkPatrolledComplete': After an edit is marked patrolled.
 $rcid: ID of the revision marked as patrolled
 $user: user (object) who marked the edit patrolled
 $wcOnlySysopsCanPatrol: config setting indicating whether the user must be a
   sysop to patrol the edit.
+$auto true if the edit is being marked as patrolled automatically
 
 'MediaWikiPerformAction': Override MediaWiki::performAction(). Use this to do
 something completely different, after the basic globals have been set up, but
index 2ccc24b..f99c439 100644 (file)
@@ -460,7 +460,9 @@ class RecentChange {
                // Automatic patrol needs "autopatrol", ordinary patrol needs "patrol"
                $right = $auto ? 'autopatrol' : 'patrol';
                $errors = array_merge( $errors, $this->getTitle()->getUserPermissionsErrors( $right, $user ) );
-               if ( !Hooks::run( 'MarkPatrolled', array( $this->getAttribute( 'rc_id' ), &$user, false ) ) ) {
+               if ( !Hooks::run( 'MarkPatrolled',
+                                       array( $this->getAttribute( 'rc_id' ), &$user, false, $auto ) )
+               ) {
                        $errors[] = array( 'hookaborted' );
                }
                // Users without the 'autopatrol' right can't patrol their
@@ -481,7 +483,10 @@ class RecentChange {
                $this->reallyMarkPatrolled();
                // Log this patrol event
                PatrolLog::record( $this, $auto, $user );
-               Hooks::run( 'MarkPatrolledComplete', array( $this->getAttribute( 'rc_id' ), &$user, false ) );
+               Hooks::run(
+                                       'MarkPatrolledComplete',
+                                       array( $this->getAttribute( 'rc_id' ), &$user, false, $auto )
+               );
 
                return array();
        }
@@ -950,3 +955,4 @@ class RecentChange {
                return $unserializedParams;
        }
 }
+