MediaWiki fundraising/REL1_35
PatrolLog.php
Go to the documentation of this file.
1<?php
29class PatrolLog {
30
43 public static function record( $rc, $auto = false, User $user = null, $tags = null ) {
44 // Do not log autopatrol actions: T184485
45 if ( $auto ) {
46 return false;
47 }
48
49 if ( !$rc instanceof RecentChange ) {
50 $rc = RecentChange::newFromId( $rc );
51 if ( !is_object( $rc ) ) {
52 return false;
53 }
54 }
55
56 if ( !$user ) {
57 wfDeprecated( __METHOD__ . ' without passing a $user parameter', '1.35' );
58 global $wgUser;
59 $user = $wgUser;
60 }
61
62 $entry = new ManualLogEntry( 'patrol', 'patrol' );
63 $entry->setTarget( $rc->getTitle() );
64 $entry->setParameters( self::buildParams( $rc ) );
65 $entry->setPerformer( $user );
66 $entry->addTags( $tags );
67 $logid = $entry->insert();
68 $entry->publish( $logid, 'udp' );
69
70 return true;
71 }
72
79 private static function buildParams( $change ) {
80 return [
81 '4::curid' => $change->getAttribute( 'rc_this_oldid' ),
82 '5::previd' => $change->getAttribute( 'rc_last_oldid' ),
83 '6::auto' => 0
84 ];
85 }
86}
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
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:29
static record( $rc, $auto=false, User $user=null, $tags=null)
Record a log event for a change being patrolled.
Definition PatrolLog.php:43
static buildParams( $change)
Prepare log parameters for a patrolled change.
Definition PatrolLog.php:79
Utility class for creating new RC entries.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:60