Merge "Added autopatrol parameter to MarkPatrolled and MarkPatrolledComplete hooks"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 13 Oct 2015 13:04:02 +0000 (13:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 13 Oct 2015 13:04:02 +0000 (13:04 +0000)
1  2 
docs/hooks.txt
includes/changes/RecentChange.php

diff --combined docs/hooks.txt
@@@ -1956,12 -1956,14 +1956,14 @@@ $rcid: ID of the revision to be marked 
  $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
@@@ -2907,7 -2909,6 +2909,7 @@@ $term: Search term specified by the use
  on the search results page.  Useful for including a feedback link.
  $specialSearch: SpecialSearch object ($this)
  $output: $wgOut
 +$term: Search term specified by the user
  
  'SpecialSearchSetupEngine': Allows passing custom data to search engine.
  $search: SpecialSearch special page object
@@@ -3293,26 -3294,6 +3295,26 @@@ when UserMailer sends an email, with a 
  $to: Array of MailAddress objects for the recipients
  &$returnPath: The return address string
  
 +'UserMailerSplitTo': Called in UserMailer::send() to give extensions a chance
 +to split up an email with multiple the To: field into separate emails.
 +$to: array of MailAddress objects; unset the ones which should be mailed separately
 +
 +'UserMailerTransformContent': Called in UserMailer::send() to change email contents.
 +Extensions can block sending the email by returning false and setting $error.
 +$to: array of MailAdresses of the targets
 +$from: MailAddress of the sender
 +&$body: email body, either a string (for plaintext emails) or an array with 'text' and 'html' keys
 +&$error: should be set to an error message string
 +
 +'UserMailerTransformMessage': Called in UserMailer::send() to change email after it has gone through
 +the MIME transform. Extensions can block sending the email by returning false and setting $error.
 +$to: array of MailAdresses of the targets
 +$from: MailAddress of the sender
 +&$subject: email subject (not MIME encoded)
 +&$headers: email headers (except To: and Subject:) as an array of header name => value pairs
 +&$body: email body (in MIME format) as a string
 +&$error: should be set to an error message string
 +
  'UserRemoveGroup': Called when removing a group; return false to override stock
  group removal.
  $user: the user object that is to have a group removed
@@@ -460,7 -460,9 +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
                $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();
        }
         * Constructs a RecentChange object for the given categorization
         * This does not call save() on the object and thus does not write to the db
         *
 -       * @since 1.26
 +       * @since 1.27
         *
         * @param string $timestamp Timestamp of the recent change to occur
         * @param Title $categoryTitle Title of the category a page is being added to or removed from
                return $unserializedParams;
        }
  }