From: Alexandre Emsenhuber Date: Tue, 21 Feb 2012 22:27:33 +0000 (+0000) Subject: Added $performer parameter to PatrolLog::record() and pass it from WikiPage::doEdit... X-Git-Tag: 1.31.0-rc.0~24582 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=75da88318c532ddfe9c8cdd6c893a0ce39326236;p=lhc%2Fweb%2Fwiklou.git Added $performer parameter to PatrolLog::record() and pass it from WikiPage::doEdit() and RecentChange::doMarkPatrolled() since the performer is not necessarily $wgUser --- diff --git a/includes/RecentChange.php b/includes/RecentChange.php index b4531d84e1..67bc5307c6 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -336,7 +336,7 @@ class RecentChange { // Actually set the 'patrolled' flag in RC $this->reallyMarkPatrolled(); // Log this patrol event - PatrolLog::record( $this, $auto ); + PatrolLog::record( $this, $auto, $user ); wfRunHooks( 'MarkPatrolledComplete', array($this->getAttribute('rc_id'), &$user, false) ); return array(); } diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 99e33f65fd..daa7bbceae 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1368,7 +1368,7 @@ class WikiPage extends Page { # Log auto-patrolled edits if ( $patrolled ) { - PatrolLog::record( $rc, true ); + PatrolLog::record( $rc, true, $user ); } } $user->incEditCount(); @@ -1449,7 +1449,7 @@ class WikiPage extends Page { # Log auto-patrolled edits if ( $patrolled ) { - PatrolLog::record( $rc, true ); + PatrolLog::record( $rc, true, $user ); } } $user->incEditCount(); diff --git a/includes/logging/PatrolLog.php b/includes/logging/PatrolLog.php index eea348eb6e..65c523d614 100644 --- a/includes/logging/PatrolLog.php +++ b/includes/logging/PatrolLog.php @@ -14,10 +14,11 @@ class PatrolLog { * * @param $rc Mixed: change identifier or RecentChange object * @param $auto Boolean: was this patrol event automatic? + * @param $performer User: user performing the action or null to use $wgUser * * @return bool */ - public static function record( $rc, $auto = false ) { + public static function record( $rc, $auto = false, User $user = null ) { if ( !$rc instanceof RecentChange ) { $rc = RecentChange::newFromId( $rc ); if ( !is_object( $rc ) ) { @@ -27,12 +28,15 @@ class PatrolLog { $title = Title::makeTitleSafe( $rc->getAttribute( 'rc_namespace' ), $rc->getAttribute( 'rc_title' ) ); if( $title ) { - global $wgUser; + if ( !$user ) { + global $wgUser; + $user = $wgUser; + } $entry = new ManualLogEntry( 'patrol', 'patrol' ); $entry->setTarget( $title ); $entry->setParameters( self::buildParams( $rc, $auto ) ); - $entry->setPerformer( $wgUser ); + $entry->setPerformer( $user ); $logid = $entry->insert(); if ( !$auto ) { $entry->publish( $logid, 'udp' );