MediaWiki
master
|
Class for creating new log entries and inserting them into the database. More...
Public Member Functions | |
__construct ( $type, $subtype) | |
Stable to call. More... | |
addTags ( $tags) | |
Add change tags for the log entry. More... | |
getAssociatedRevId () | |
getComment () | |
getDeleted () | |
getIsPatrollable () | |
Whether this log entry is patrollable. More... | |
getParameters () | |
getPerformer () | |
getPerformerIdentity () | |
getRecentChange ( $newId=0) | |
Get a RecentChanges object for the log entry. More... | |
getSubtype () | |
getTags () | |
getTarget () | |
getTimestamp () | |
getType () | |
insert (IDatabase $dbw=null) | |
Insert the entry into the logging table. More... | |
isLegacy () | |
publish ( $newId, $to='rcandudp') | |
Publish the log entry. More... | |
setAssociatedRevId ( $revId) | |
Set an associated revision id. More... | |
setComment ( $comment) | |
Set a comment associated with the action being logged. More... | |
setDeleted ( $deleted) | |
Set the 'deleted' flag. More... | |
setIsPatrollable ( $patrollable) | |
Set whether this log entry should be made patrollable This shouldn't depend on config, only on whether there is full support in the software for patrolling this log entry. More... | |
setLegacy ( $legacy) | |
Set the 'legacy' flag. More... | |
setParameters ( $parameters) | |
Set extra log parameters. More... | |
setPerformer (UserIdentity $performer) | |
Set the user that performed the action being logged. More... | |
setRelations (array $relations) | |
Declare arbitrary tag/value relations to this log entry. More... | |
setTags ( $tags) | |
Set change tags for the log entry. More... | |
setTarget (LinkTarget $target) | |
Set the title of the object changed. More... | |
setTimestamp ( $timestamp) | |
Set the timestamp of when the logged action took place. More... | |
![]() | |
getFullType () | |
The full logtype in format maintype/subtype. More... | |
isDeleted ( $field) | |
Protected Attributes | |
string | $comment = '' |
Comment for the log entry. More... | |
int | $deleted |
Deletion state of the log entry. More... | |
int | $id |
ID of the log entry. More... | |
bool | $isPatrollable = false |
Can this log entry be patrolled? More... | |
bool | $legacy = false |
Whether this is a legacy log entry. More... | |
array | $parameters = [] |
Parameters for log entry. More... | |
UserIdentity | $performer |
Performer of the action for the log entry. More... | |
array | $relations = [] |
int | $revId = 0 |
A rev id associated to the log entry. More... | |
string | $subtype |
Sub type of log entry. More... | |
string[] | $tags = [] |
Change tags add to the log entry. More... | |
Title | $target |
Target title for the log entry. More... | |
string | $timestamp |
Timestamp of creation of the log entry. More... | |
string | $type |
Type of log entry. More... | |
Additional Inherited Members | |
![]() | |
static | extractParams ( $blob) |
Extract a parameter array from a blob. More... | |
static | makeParamBlob ( $params) |
Create a blob from a parameter array. More... | |
Class for creating new log entries and inserting them into the database.
@newable
Definition at line 43 of file ManualLogEntry.php.
ManualLogEntry::__construct | ( | $type, | |
$subtype | |||
) |
Stable to call.
string | $type | Log type. Should match $wgLogTypes. |
string | $subtype | Log subtype (action). Should match $wgLogActions or (together with $type) $wgLogActionsHandlers. |
Definition at line 94 of file ManualLogEntry.php.
ManualLogEntry::addTags | ( | $tags | ) |
Add change tags for the log entry.
string | string[] | null | $tags | Tags to apply |
Implements MediaWiki\ChangeTags\Taggable.
Definition at line 221 of file ManualLogEntry.php.
References $tags.
Referenced by setTags().
ManualLogEntry::getAssociatedRevId | ( | ) |
ManualLogEntry::getComment | ( | ) |
Implements LogEntry.
Definition at line 489 of file ManualLogEntry.php.
References $comment.
Referenced by insert().
ManualLogEntry::getDeleted | ( | ) |
Implements LogEntry.
Definition at line 530 of file ManualLogEntry.php.
References $deleted.
ManualLogEntry::getIsPatrollable | ( | ) |
Whether this log entry is patrollable.
Definition at line 515 of file ManualLogEntry.php.
References $isPatrollable.
ManualLogEntry::getParameters | ( | ) |
Implements LogEntry.
Definition at line 452 of file ManualLogEntry.php.
References $parameters.
Referenced by insert().
ManualLogEntry::getPerformer | ( | ) |
Implements LogEntry.
Definition at line 459 of file ManualLogEntry.php.
References User\newFromIdentity().
ManualLogEntry::getPerformerIdentity | ( | ) |
Definition at line 466 of file ManualLogEntry.php.
References $performer.
Referenced by getRecentChange(), and insert().
ManualLogEntry::getRecentChange | ( | $newId = 0 | ) |
Get a RecentChanges object for the log entry.
int | $newId |
Definition at line 344 of file ManualLogEntry.php.
References getPerformerIdentity(), getTarget(), getTimestamp(), SpecialPage\getTitleFor(), getType(), LogEntryBase\makeParamBlob(), RequestContext\newExtraneousContext(), LogFormatter\newFromEntry(), and RecentChange\newLogEntry().
Referenced by publish().
ManualLogEntry::getSubtype | ( | ) |
Implements LogEntry.
Definition at line 445 of file ManualLogEntry.php.
References $subtype.
Referenced by insert().
ManualLogEntry::getTags | ( | ) |
Definition at line 505 of file ManualLogEntry.php.
References $tags.
Referenced by publish().
ManualLogEntry::getTarget | ( | ) |
Implements LogEntry.
Definition at line 473 of file ManualLogEntry.php.
References $target.
Referenced by getRecentChange(), and insert().
ManualLogEntry::getTimestamp | ( | ) |
Implements LogEntry.
Definition at line 480 of file ManualLogEntry.php.
References wfTimestamp(), and wfTimestampNow().
Referenced by getRecentChange(), and insert().
ManualLogEntry::getType | ( | ) |
Implements LogEntry.
Definition at line 438 of file ManualLogEntry.php.
References $type.
Referenced by getRecentChange(), insert(), and publish().
ManualLogEntry::insert | ( | IDatabase | $dbw = null | ) |
Insert the entry into the logging
table.
IDatabase | null | $dbw |
MWException |
Definition at line 273 of file ManualLogEntry.php.
References $comment, $deleted, $id, $relations, $revId, DB_MASTER, getAssociatedRevId(), getComment(), getParameters(), getPerformerIdentity(), CommentStore\getStore(), getSubtype(), getTarget(), getTimestamp(), getType(), LogEntryBase\makeParamBlob(), ActorMigration\newMigration(), wfGetDB(), and wfTimestampNow().
ManualLogEntry::isLegacy | ( | ) |
Reimplemented from LogEntryBase.
Definition at line 523 of file ManualLogEntry.php.
References $legacy.
ManualLogEntry::publish | ( | $newId, | |
$to = 'rcandudp' |
|||
) |
Publish the log entry.
int | $newId | Id of the log entry. |
string | $to | One of: rcandudp (default), rc, udp |
Definition at line 384 of file ManualLogEntry.php.
References $revId, $tags, DeferredUpdates\addCallableUpdate(), ChangeTags\addTags(), DB_MASTER, getAssociatedRevId(), MediaWiki\Logger\LoggerFactory\getInstance(), getRecentChange(), getTags(), getType(), Hooks\runner(), and wfGetDB().
ManualLogEntry::setAssociatedRevId | ( | $revId | ) |
Set an associated revision id.
For example, the ID of the revision that was inserted to mark a page move or protection, file upload, etc.
int | $revId |
Definition at line 193 of file ManualLogEntry.php.
References $revId.
ManualLogEntry::setComment | ( | $comment | ) |
Set a comment associated with the action being logged.
string | $comment |
Definition at line 180 of file ManualLogEntry.php.
References $comment.
ManualLogEntry::setDeleted | ( | $deleted | ) |
Set the 'deleted' flag.
int | $deleted | One of LogPage::DELETED_* bitfield constants |
Definition at line 262 of file ManualLogEntry.php.
References $deleted.
ManualLogEntry::setIsPatrollable | ( | $patrollable | ) |
Set whether this log entry should be made patrollable This shouldn't depend on config, only on whether there is full support in the software for patrolling this log entry.
False by default
bool | $patrollable |
Definition at line 242 of file ManualLogEntry.php.
ManualLogEntry::setLegacy | ( | $legacy | ) |
Set the 'legacy' flag.
bool | $legacy |
Definition at line 252 of file ManualLogEntry.php.
References $legacy.
ManualLogEntry::setParameters | ( | $parameters | ) |
Set extra log parameters.
You can pass params to the log action message by prefixing the keys with a number and optional type, using colons to separate the fields. The numbering should start with number 4 (matching the $4 message parameter), the first three parameters are hardcoded for every message ($1 is a link to the username and user talk page of the performing user, $2 is just the username (for determining gender), $3 is a link to the target page).
Typically, these parameters will be used in the logentry-<type>-<subtype> message, but custom formatters, declared via $wgLogActionsHandlers, can override that.
If you want to store stuff that should not be available in messages, don't prefix the array key with a number and don't use the colons. Parameters which should be searchable need to be set with setRelations() instead.
Example: $entry->setParameters( '4::color' => 'blue', '5:number:count' => 3000, 'animal' => 'dog' );
array | $parameters | Associative array |
Definition at line 129 of file ManualLogEntry.php.
References $parameters.
ManualLogEntry::setPerformer | ( | UserIdentity | $performer | ) |
Set the user that performed the action being logged.
UserIdentity | $performer |
Definition at line 150 of file ManualLogEntry.php.
References $performer.
ManualLogEntry::setRelations | ( | array | $relations | ) |
Declare arbitrary tag/value relations to this log entry.
These can be used to filter log entries later on.
array | $relations | Map of (tag => (list of values|value)) |
Definition at line 140 of file ManualLogEntry.php.
References $relations.
ManualLogEntry::setTags | ( | $tags | ) |
Set change tags for the log entry.
Passing null
means the same as empty array, for compatibility with WikiPage::doUpdateRestrictions().
string | string[] | null | $tags |
Definition at line 207 of file ManualLogEntry.php.
ManualLogEntry::setTarget | ( | LinkTarget | $target | ) |
Set the title of the object changed.
LinkTarget | $target |
Definition at line 160 of file ManualLogEntry.php.
References $target, and Title\newFromLinkTarget().
ManualLogEntry::setTimestamp | ( | $timestamp | ) |
Set the timestamp of when the logged action took place.
string | $timestamp |
Definition at line 170 of file ManualLogEntry.php.
References $timestamp.
|
protected |
Comment for the log entry.
Definition at line 66 of file ManualLogEntry.php.
Referenced by getComment(), insert(), and setComment().
|
protected |
Deletion state of the log entry.
Definition at line 75 of file ManualLogEntry.php.
Referenced by getDeleted(), insert(), and setDeleted().
|
protected |
|
protected |
Can this log entry be patrolled?
Definition at line 81 of file ManualLogEntry.php.
Referenced by getIsPatrollable().
|
protected |
Whether this is a legacy log entry.
Definition at line 84 of file ManualLogEntry.php.
Referenced by isLegacy(), and setLegacy().
|
protected |
Parameters for log entry.
Definition at line 51 of file ManualLogEntry.php.
Referenced by getParameters(), and setParameters().
|
protected |
Performer of the action for the log entry.
Definition at line 57 of file ManualLogEntry.php.
Referenced by getPerformerIdentity(), and setPerformer().
|
protected |
Definition at line 54 of file ManualLogEntry.php.
Referenced by insert(), and setRelations().
|
protected |
A rev id associated to the log entry.
Definition at line 69 of file ManualLogEntry.php.
Referenced by getAssociatedRevId(), insert(), publish(), and setAssociatedRevId().
|
protected |
Sub type of log entry.
Definition at line 48 of file ManualLogEntry.php.
Referenced by __construct(), and getSubtype().
|
protected |
Change tags add to the log entry.
Definition at line 72 of file ManualLogEntry.php.
|
protected |
Target title for the log entry.
Definition at line 60 of file ManualLogEntry.php.
Referenced by getTarget(), and setTarget().
|
protected |
Timestamp of creation of the log entry.
Definition at line 63 of file ManualLogEntry.php.
Referenced by setTimestamp().
|
protected |
Type of log entry.
Definition at line 45 of file ManualLogEntry.php.
Referenced by __construct(), and getType().