MediaWiki
1.34.0
PatrolLog.php
Go to the documentation of this file.
1
<?php
29
class
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->addTags( $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
}
PatrolLog\record
static record( $rc, $auto=false, User $user=null, $tags=null)
Record a log event for a change being patrolled.
Definition:
PatrolLog.php:42
RecentChange
Utility class for creating new RC entries.
Definition:
RecentChange.php:70
PatrolLog\buildParams
static buildParams( $change, $auto)
Prepare log parameters for a patrolled change.
Definition:
PatrolLog.php:82
RecentChange\newFromId
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
Definition:
RecentChange.php:194
PatrolLog
Class containing static functions for working with logs of patrol events.
Definition:
PatrolLog.php:29
ManualLogEntry
Class for creating new log entries and inserting them into the database.
Definition:
ManualLogEntry.php:37
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition:
User.php:51
includes
logging
PatrolLog.php
Generated on Thu Dec 19 2019 14:54:35 for MediaWiki by
1.8.16