*
* @param RecentChange|int $change RecentChange or corresponding rc_id
* @param bool $auto For automatic patrol
+ * @param string|string[] $tags Change tags to add to the patrol log entry
+ * ($user should be able to add the specified tags before this is called)
* @return array See doMarkPatrolled(), or null if $change is not an existing rc_id
*/
- public static function markPatrolled( $change, $auto = false ) {
+ public static function markPatrolled( $change, $auto = false, $tags = null ) {
global $wgUser;
$change = $change instanceof RecentChange
return null;
}
- return $change->doMarkPatrolled( $wgUser, $auto );
+ return $change->doMarkPatrolled( $wgUser, $auto, $tags );
}
/**
* 'markedaspatrollederror-noautopatrol' as errors
* @param User $user User object doing the action
* @param bool $auto For automatic patrol
+ * @param string|string[] $tags Change tags to add to the patrol log entry
+ * ($user should be able to add the specified tags before this is called)
* @return array Array of permissions errors, see Title::getUserPermissionsErrors()
*/
- public function doMarkPatrolled( User $user, $auto = false ) {
+ public function doMarkPatrolled( User $user, $auto = false, $tags = null ) {
global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol;
+
$errors = [];
// If recentchanges patrol is disabled, only new pages or new file versions
// can be patrolled, provided the appropriate config variable is set
// Actually set the 'patrolled' flag in RC
$this->reallyMarkPatrolled();
// Log this patrol event
- PatrolLog::record( $this, $auto, $user );
+ PatrolLog::record( $this, $auto, $user, $tags );
+
Hooks::run(
- 'MarkPatrolledComplete',
- [ $this->getAttribute( 'rc_id' ), &$user, false, $auto ]
+ 'MarkPatrolledComplete',
+ [ $this->getAttribute( 'rc_id' ), &$user, false, $auto ]
);
return [];
* @param int $newId
* @param string $actionCommentIRC
* @param int $revId Id of associated revision, if any
+ * @param bool $isPatrollable Whether this log entry is patrollable
* @return RecentChange
*/
public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip,
$type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '',
- $revId = 0 ) {
+ $revId = 0, $isPatrollable = false ) {
global $wgRequest;
# # Get pageStatus for email notification
break;
}
- // Allow unpatrolled status when an associated rev id is passed
- // May be used in core by moves and uploads
- $markPatrolled = ( $revId > 0 ) ? $user->isAllowed( 'autopatrol' ) : true;
+ // Allow unpatrolled status for patrollable log entries
+ $markPatrolled = $isPatrollable ? $user->isAllowed( 'autopatrol' ) : true;
$rc = new RecentChange;
$rc->mTitle = $target;