MediaWiki REL1_32
PatrolLog.php
Go to the documentation of this file.
1<?php
29class PatrolLog {
30
42 public static function record( $rc, $auto = false, User $user = null, $tags = null ) {
43 // Do not log autopatrol actions: T184485
44 if ( $auto ) {
45 return false;
46 }
47
48 if ( !$rc instanceof RecentChange ) {
49 $rc = RecentChange::newFromId( $rc );
50 if ( !is_object( $rc ) ) {
51 return false;
52 }
53 }
54
55 if ( !$user ) {
56 global $wgUser;
57 $user = $wgUser;
58 }
59
60 $action = $auto ? 'autopatrol' : 'patrol';
61
62 $entry = new ManualLogEntry( 'patrol', $action );
63 $entry->setTarget( $rc->getTitle() );
64 $entry->setParameters( self::buildParams( $rc, $auto ) );
65 $entry->setPerformer( $user );
66 $entry->setTags( $tags );
67 $logid = $entry->insert();
68 if ( !$auto ) {
69 $entry->publish( $logid, 'udp' );
70 }
71
72 return true;
73 }
74
82 private static function buildParams( $change, $auto ) {
83 return [
84 '4::curid' => $change->getAttribute( 'rc_this_oldid' ),
85 '5::previd' => $change->getAttribute( 'rc_last_oldid' ),
86 '6::auto' => (int)$auto
87 ];
88 }
89}
Class for creating new log entries and inserting them into the database.
Definition LogEntry.php:437
Class containing static functions for working with logs of patrol events.
Definition PatrolLog.php:29
static buildParams( $change, $auto)
Prepare log parameters for a patrolled change.
Definition PatrolLog.php:82
static record( $rc, $auto=false, User $user=null, $tags=null)
Record a log event for a change being patrolled.
Definition PatrolLog.php:42
Utility class for creating new RC entries.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:47
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges use this to change the tables headers change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped true if there is text before this autocomment $auto
Definition hooks.txt:1623