X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fchanges%2FRecentChange.php;h=c33a94bb00474f0de84c4920b86a7415fa9f7e28;hb=592637225a4d5db5abcdc288d838c160284eef08;hp=7c6fbb913341bb1cf4cae96d35d744af7d716115;hpb=4eff73118fe6e4d4431ace75f36c6583ce8f4b97;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 7c6fbb9133..c33a94bb00 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -456,11 +456,13 @@ class RecentChange { * @return array Array of permissions errors, see Title::getUserPermissionsErrors() */ public function doMarkPatrolled( User $user, $auto = false ) { - global $wgUseRCPatrol, $wgUseNPPatrol; + global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol; $errors = array(); - // If recentchanges patrol is disabled, only new pages - // can be patrolled - if ( !$wgUseRCPatrol && ( !$wgUseNPPatrol || $this->getAttribute( 'rc_type' ) != RC_NEW ) ) { + // If recentchanges patrol is disabled, only new pages or new file versions + // can be patrolled, provided the appropriate config variable is set + if ( !$wgUseRCPatrol && ( !$wgUseNPPatrol || $this->getAttribute( 'rc_type' ) != RC_NEW ) && + ( !$wgUseFilePatrol || !( $this->getAttribute( 'rc_type' ) == RC_LOG && + $this->getAttribute( 'rc_log_type' ) == 'upload' ) ) ) { $errors[] = array( 'rcpatroldisabled' ); } // Automatic patrol needs "autopatrol", ordinary patrol needs "patrol" @@ -536,11 +538,13 @@ class RecentChange { * @param int $newSize * @param int $newId * @param int $patrol + * @param array $tags * @return RecentChange */ public static function notifyEdit( $timestamp, &$title, $minor, &$user, $comment, $oldId, $lastTimestamp, - $bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0 + $bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0, + $tags = array() ) { $rc = new RecentChange; $rc->mTitle = $title; @@ -579,11 +583,15 @@ class RecentChange { 'pageStatus' => 'changed' ); - DeferredUpdates::addCallableUpdate( function() use ( $rc ) { + DeferredUpdates::addCallableUpdate( function() use ( $rc, $tags ) { $rc->save(); if ( $rc->mAttribs['rc_patrolled'] ) { PatrolLog::record( $rc, true, $rc->getPerformer() ); } + if ( count( $tags ) ) { + ChangeTags::addTags( $tags, $rc->mAttribs['rc_id'], + $rc->mAttribs['rc_this_oldid'], null, null ); + } } ); return $rc; @@ -603,11 +611,12 @@ class RecentChange { * @param int $size * @param int $newId * @param int $patrol + * @param array $tags * @return RecentChange */ public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot, - $ip = '', $size = 0, $newId = 0, $patrol = 0 + $ip = '', $size = 0, $newId = 0, $patrol = 0, $tags = array() ) { $rc = new RecentChange; $rc->mTitle = $title; @@ -646,11 +655,15 @@ class RecentChange { 'pageStatus' => 'created' ); - DeferredUpdates::addCallableUpdate( function() use ( $rc ) { + DeferredUpdates::addCallableUpdate( function() use ( $rc, $tags ) { $rc->save(); if ( $rc->mAttribs['rc_patrolled'] ) { PatrolLog::record( $rc, true, $rc->getPerformer() ); } + if ( count( $tags ) ) { + ChangeTags::addTags( $tags, $rc->mAttribs['rc_id'], + $rc->mAttribs['rc_this_oldid'], null, null ); + } } ); return $rc; @@ -700,10 +713,12 @@ class RecentChange { * @param string $params * @param int $newId * @param string $actionCommentIRC + * @param int $revId Id of associated revision, if any * @return RecentChange */ public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, - $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '' ) { + $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '', + $revId = 0 ) { global $wgRequest; # # Get pageStatus for email notification @@ -727,6 +742,10 @@ class RecentChange { 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; + $rc = new RecentChange; $rc->mTitle = $target; $rc->mPerformer = $user; @@ -741,11 +760,11 @@ class RecentChange { 'rc_user' => $user->getId(), 'rc_user_text' => $user->getName(), 'rc_comment' => $logComment, - 'rc_this_oldid' => 0, + 'rc_this_oldid' => $revId, 'rc_last_oldid' => 0, 'rc_bot' => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot', true ) : 0, 'rc_ip' => self::checkIPAddress( $ip ), - 'rc_patrolled' => 1, + 'rc_patrolled' => $markPatrolled ? 1 : 0, 'rc_new' => 0, # obsolete 'rc_old_len' => null, 'rc_new_len' => null, @@ -960,4 +979,3 @@ class RecentChange { return $unserializedParams; } } -