Merge "Add &$tags argument to MarkPatrolled hook"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 4 Apr 2019 17:09:31 +0000 (17:09 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 4 Apr 2019 17:09:31 +0000 (17:09 +0000)
RELEASE-NOTES-1.33
docs/hooks.txt
includes/changes/RecentChange.php

index 0dafa0f..c30c538 100644 (file)
@@ -110,6 +110,8 @@ For notes on 1.32.x and older releases, see HISTORY.
 * (T214706) LinksUpdate::getAddedExternalLinks() and
   LinksUpdate::getRemovedExternalLinks() were introduced.
 * (T213893) Added 'MaintenanceUpdateAddParams' hook
+* (T219655) The MarkPatrolled hook has a new parameter for the tags
+  associated with this entry in the patrol log.
 
 === External library changes in 1.33 ===
 ==== New external libraries ====
index e9ceb95..5f2c129 100644 (file)
@@ -2230,6 +2230,7 @@ $rcid: ID of the revision to be marked 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
+&$tags: the tags to be applied to the patrol log entry
 
 'MarkPatrolledComplete': After an edit is marked patrolled.
 $rcid: ID of the revision marked as patrolled
index 2d37eac..eed159d 100644 (file)
@@ -590,6 +590,13 @@ class RecentChange implements Taggable {
        public function doMarkPatrolled( User $user, $auto = false, $tags = null ) {
                global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol;
 
+               // Fix up $tags so that the MarkPatrolled hook below always gets an array
+               if ( $tags === null ) {
+                       $tags = [];
+               } elseif ( is_string( $tags ) ) {
+                       $tags = [ $tags ];
+               }
+
                $errors = [];
                // If recentchanges patrol is disabled, only new pages or new file versions
                // can be patrolled, provided the appropriate config variable is set
@@ -602,7 +609,7 @@ class RecentChange implements Taggable {
                $right = $auto ? 'autopatrol' : 'patrol';
                $errors = array_merge( $errors, $this->getTitle()->getUserPermissionsErrors( $right, $user ) );
                if ( !Hooks::run( 'MarkPatrolled',
-                                       [ $this->getAttribute( 'rc_id' ), &$user, false, $auto ] )
+                                       [ $this->getAttribute( 'rc_id' ), &$user, false, $auto, &$tags ] )
                ) {
                        $errors[] = [ 'hookaborted' ];
                }