Output only to stderr in unit tests
[lhc/web/wiklou.git] / includes / logging / PatrolLog.php
index 510c711..9b2e098 100644 (file)
  * logs of patrol events
  */
 class PatrolLog {
+
        /**
         * Record a log event for a change being patrolled
         *
         * @param int|RecentChange $rc Change identifier or RecentChange object
         * @param bool $auto Was this patrol event automatic?
         * @param User $user User performing the action or null to use $wgUser
+        * @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 bool
         */
-       public static function record( $rc, $auto = false, User $user = null ) {
-               global $wgLogAutopatrol;
-
-               // do not log autopatrolled edits if setting disables it
-               if ( $auto && !$wgLogAutopatrol ) {
+       public static function record( $rc, $auto = false, User $user = null, $tags = null ) {
+               // Do not log autopatrol actions: T184485
+               if ( $auto ) {
                        return false;
                }
 
@@ -56,10 +57,13 @@ class PatrolLog {
                        $user = $wgUser;
                }
 
-               $entry = new ManualLogEntry( 'patrol', 'patrol' );
+               $action = $auto ? 'autopatrol' : 'patrol';
+
+               $entry = new ManualLogEntry( 'patrol', $action );
                $entry->setTarget( $rc->getTitle() );
                $entry->setParameters( self::buildParams( $rc, $auto ) );
                $entry->setPerformer( $user );
+               $entry->setTags( $tags );
                $logid = $entry->insert();
                if ( !$auto ) {
                        $entry->publish( $logid, 'udp' );