X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fchanges%2FRecentChange.php;h=eed159d8d13d6d5bb9260b2030938332ee773841;hb=c7c908e68fb85b2a00b1dda2d7d26f80d82c55d9;hp=7f7d77d94740b6cbd017e7b0bbdf5688db0347ae;hpb=0770f85a0a293e6c7af6f1d3d3a1dbd2d13c1e09;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 7f7d77d947..eed159d8d1 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -19,6 +19,7 @@ * * @file */ +use MediaWiki\ChangeTags\Taggable; /** * Utility class for creating new RC entries @@ -65,7 +66,7 @@ * we're having to include both rc_comment and rc_comment_text/rc_comment_data * so random crap works right. */ -class RecentChange { +class RecentChange implements Taggable { // Constants for the rc_source field. Extensions may also have // their own source constants. const SRC_EDIT = 'mw.edit'; @@ -589,6 +590,13 @@ class RecentChange { 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 @@ -601,7 +609,7 @@ class RecentChange { $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' ]; } @@ -1198,7 +1206,7 @@ class RecentChange { * * @since 1.28 * - * @param string|array $tags + * @param string|string[] $tags */ public function addTags( $tags ) { if ( is_string( $tags ) ) {