From: Lojjik Braughler Date: Mon, 5 Oct 2015 22:34:07 +0000 (-0400) Subject: Added autopatrol parameter to MarkPatrolled and MarkPatrolledComplete hooks X-Git-Tag: 1.31.0-rc.0~9423^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=4e6b945b95d485a1c589cfaa58241e2a8eab2e95;p=lhc%2Fweb%2Fwiklou.git Added autopatrol parameter to MarkPatrolled and MarkPatrolledComplete hooks Change-Id: Ibc832ba8cec8eaef673ef07534c5522f678e8f58 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 2d268b8ab3..ff3916f94f 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 2ccc24b5e9..f99c4398ae 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -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; } } +