From 4e6b945b95d485a1c589cfaa58241e2a8eab2e95 Mon Sep 17 00:00:00 2001 From: Lojjik Braughler Date: Mon, 5 Oct 2015 18:34:07 -0400 Subject: [PATCH] Added autopatrol parameter to MarkPatrolled and MarkPatrolledComplete hooks Change-Id: Ibc832ba8cec8eaef673ef07534c5522f678e8f58 --- docs/hooks.txt | 2 ++ includes/changes/RecentChange.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) 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; } } + -- 2.20.1