MediaWiki
1.39.10
PatrolLog.php
Go to the documentation of this file.
1
<?php
25
use
MediaWiki\User\UserIdentity
;
26
31
class
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
}
ManualLogEntry
Class for creating new log entries and inserting them into the database.
Definition
ManualLogEntry.php:45
PatrolLog
Class containing static functions for working with logs of patrol events.
Definition
PatrolLog.php:31
PatrolLog\record
static record( $rc, $auto, UserIdentity $user, $tags=null)
Record a log event for a change being patrolled.
Definition
PatrolLog.php:44
RecentChange
Utility class for creating new RC entries.
Definition
RecentChange.php:83
MediaWiki\User\UserIdentity
Interface for objects representing user identity.
Definition
UserIdentity.php:39
includes
logging
PatrolLog.php
Generated on Tue Oct 1 2024 01:16:09 for MediaWiki by
1.10.0