MediaWiki master
PatrolLog.php
Go to the documentation of this file.
1<?php
26
31class PatrolLog {
32
44 public static function record( $rc, $auto, UserIdentity $user, $tags = null ) {
45 // Do not log autopatrol actions: T184485
46 if ( $auto ) {
47 return false;
48 }
49
50 if ( !$rc instanceof RecentChange ) {
51 $rc = RecentChange::newFromId( $rc );
52 if ( !is_object( $rc ) ) {
53 return false;
54 }
55 }
56
57 $entry = new ManualLogEntry( 'patrol', 'patrol' );
58 $entry->setTarget( $rc->getTitle() );
59 $entry->setParameters( self::buildParams( $rc ) );
60 $entry->setPerformer( $user );
61 $entry->addTags( $tags );
62 $logid = $entry->insert();
63 $entry->publish( $logid, 'udp' );
64
65 return true;
66 }
67
74 private static function buildParams( $change ) {
75 return [
76 '4::curid' => $change->getAttribute( 'rc_this_oldid' ),
77 '5::previd' => $change->getAttribute( 'rc_last_oldid' ),
78 '6::auto' => 0
79 ];
80 }
81}
Class for creating new log entries and inserting them into the database.
Class containing static functions for working with logs of patrol events.
Definition PatrolLog.php:31
static record( $rc, $auto, UserIdentity $user, $tags=null)
Record a log event for a change being patrolled.
Definition PatrolLog.php:44
Utility class for creating new RC entries.
Interface for objects representing user identity.