MediaWiki REL1_30
PatrolLog.php
Go to the documentation of this file.
1<?php
29class PatrolLog {
41 public static function record( $rc, $auto = false, User $user = null, $tags = null ) {
42 global $wgLogAutopatrol;
43
44 // do not log autopatrolled edits if setting disables it
45 if ( $auto && !$wgLogAutopatrol ) {
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 global $wgUser;
58 $user = $wgUser;
59 }
60
61 $action = $auto ? 'autopatrol' : 'patrol';
62
63 $entry = new ManualLogEntry( 'patrol', $action );
64 $entry->setTarget( $rc->getTitle() );
65 $entry->setParameters( self::buildParams( $rc, $auto ) );
66 $entry->setPerformer( $user );
67 $entry->setTags( $tags );
68 $logid = $entry->insert();
69 if ( !$auto ) {
70 $entry->publish( $logid, 'udp' );
71 }
72
73 return true;
74 }
75
83 private static function buildParams( $change, $auto ) {
84 return [
85 '4::curid' => $change->getAttribute( 'rc_this_oldid' ),
86 '5::previd' => $change->getAttribute( 'rc_last_oldid' ),
87 '6::auto' => (int)$auto
88 ];
89 }
90}
$wgLogAutopatrol
Log autopatrol actions to the log table.
$wgUser
Definition Setup.php:817
Class for creating log entries manually, to inject them into the database.
Definition LogEntry.php:400
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:83
static record( $rc, $auto=false, User $user=null, $tags=null)
Record a log event for a change being patrolled.
Definition PatrolLog.php:41
Utility class for creating new RC entries.
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:51
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:1577