|
MediaWiki master
|
Class for creating new log entries and inserting them into the database. More...
Inherits MediaWiki\Logging\LogEntryBase, and MediaWiki\ChangeTags\Taggable.

Public Member Functions | ||||
| __construct ( $type, $subtype) | ||||
| addParameter ( $name, $value) | ||||
| Add a parameter to the list already set. | ||||
| addTags ( $tags) | ||||
| Add change tags for the log entry. | ||||
| getAssociatedRevId () | ||||
| getComment () | ||||
| getDeleted () | ||||
| getIsPatrollable () | ||||
| Whether this log entry is patrollable. | ||||
| getParameters () | ||||
| getPerformerIdentity () | ||||
| getRecentChange ( $newId=0) | ||||
| Get a RecentChanges object for the log entry. | ||||
| getSubtype () | ||||
| getTags () | ||||
| getTarget () | ||||
| This method will throw if the target page belongs to another wiki. | ||||
| getTargetPage () | ||||
| Get the target page of this action. | ||||
| getTimestamp () | ||||
| getType () | ||||
| insert (?IDatabase $dbw=null) | ||||
Insert the entry into the logging table. | ||||
| isLegacy () | ||||
| publish ( $newId, $to='rcandudp') | ||||
| Publish the log entry. | ||||
| setAssociatedRevId ( $revId) | ||||
| Set an associated revision id. | ||||
| setComment (string $comment) | ||||
| Set a comment associated with the action being logged. | ||||
| setDeleted ( $deleted) | ||||
| Set the 'deleted' flag. | ||||
| setForceBotFlag (bool $forceBotFlag) | ||||
| Set the bot flag in the recent changes to this value. | ||||
| 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. | ||||
| setLegacy ( $legacy) | ||||
| Set the 'legacy' flag. | ||||
| setParameters ( $parameters) | ||||
| Set extra log parameters. | ||||
| setPerformer (UserIdentity $performer) | ||||
| Set the user that performed the action being logged. | ||||
| setRelations (array $relations) | ||||
| Declare arbitrary tag/value relations to this log entry. | ||||
| setTarget ( $target) | ||||
| Set the title of the object changed. | ||||
| setTimestamp ( $timestamp) | ||||
| Set the timestamp of when the logged action took place. | ||||
Public Member Functions inherited from MediaWiki\Logging\LogEntryBase | ||||
| getFullType () | ||||
The full logtype in format maintype/subtype.
| ||||
| isDeleted ( $field) | ||||
| ||||
Protected Attributes | |
| string | $comment = '' |
| Comment for the log entry. | |
| int null | $deleted |
| Deletion state of the log entry. | |
| bool null | $forceBotFlag = null |
| The bot flag in the recent changes will be set to this value. | |
| int | $id |
| ID of the log entry. | |
| bool | $isPatrollable = false |
| Can this log entry be patrolled? | |
| bool | $legacy = false |
| Whether this is a legacy log entry. | |
| array | $parameters = [] |
| Parameters for log entry. | |
| UserIdentity | $performer |
| Performer of the action for the log entry. | |
| array | $relations = [] |
| int | $revId = 0 |
| A rev id associated to the log entry. | |
| string | $subtype |
| Sub type of log entry. | |
| string[] | $tags = [] |
| Change tags add to the log entry. | |
| PageReference | $targetPage |
| Target page for the log entry. | |
| string | $timestamp |
| Timestamp of creation of the log entry. | |
| string | $type |
| Type of log entry. | |
Additional Inherited Members | |
Static Public Member Functions inherited from MediaWiki\Logging\LogEntryBase | |
| static | extractParams ( $blob) |
| Extract a parameter array from a blob. | |
| static | makeParamBlob ( $params) |
| Create a blob from a parameter array. | |
Class for creating new log entries and inserting them into the database.
Definition at line 45 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::__construct | ( | $type, | |
| $subtype ) |
| string | $type | Log type. Should match $wgLogTypes. |
| string | $subtype | Log subtype (action). Should match $wgLogActions or (together with $type) $wgLogActionsHandlers. |
Definition at line 99 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$subtype, and MediaWiki\Logging\ManualLogEntry\$type.
| MediaWiki\Logging\ManualLogEntry::addParameter | ( | $name, | |
| $value ) |
Add a parameter to the list already set.
| string | $name | |
| mixed | $value |
Definition at line 159 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::addTags | ( | $tags | ) |
Add change tags for the log entry.
| string | string[] | null | $tags | Tags to apply |
Implements MediaWiki\ChangeTags\Taggable.
Definition at line 248 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$tags.
| MediaWiki\Logging\ManualLogEntry::getAssociatedRevId | ( | ) |
| MediaWiki\Logging\ManualLogEntry::getComment | ( | ) |
Implements MediaWiki\Logging\LogEntry.
Definition at line 540 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::getDeleted | ( | ) |
Implements MediaWiki\Logging\LogEntry.
Definition at line 581 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::getIsPatrollable | ( | ) |
Whether this log entry is patrollable.
Definition at line 566 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::getParameters | ( | ) |
Implements MediaWiki\Logging\LogEntry.
Definition at line 507 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::getPerformerIdentity | ( | ) |
Implements MediaWiki\Logging\LogEntry.
Definition at line 511 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::getRecentChange | ( | $newId = 0 | ) |
Get a RecentChanges object for the log entry.
| int | $newId |
Definition at line 399 of file ManualLogEntry.php.
References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\SpecialPage\SpecialPage\getTitleFor(), and MediaWiki\Logging\LogEntryBase\makeParamBlob().
| MediaWiki\Logging\ManualLogEntry::getSubtype | ( | ) |
Implements MediaWiki\Logging\LogEntry.
Definition at line 500 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::getTags | ( | ) |
| MediaWiki\Logging\ManualLogEntry::getTarget | ( | ) |
This method will throw if the target page belongs to another wiki.
To avoid problems, use ::getTargetPage() in new code.
Implements MediaWiki\Logging\LogEntry.
Definition at line 520 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::getTargetPage | ( | ) |
Get the target page of this action.
Implements MediaWiki\Logging\LogEntry.
Definition at line 524 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::getTimestamp | ( | ) |
Implements MediaWiki\Logging\LogEntry.
Definition at line 531 of file ManualLogEntry.php.
References wfTimestamp(), and wfTimestampNow().
| MediaWiki\Logging\ManualLogEntry::getType | ( | ) |
Implements MediaWiki\Logging\LogEntry.
Definition at line 493 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::insert | ( | ?IDatabase | $dbw = null | ) |
Insert the entry into the logging table.
Since 1.46, the provided IDatabase may belong to a different wiki than the current one. In that case it's your responsibility to ensure that the log performer, target, and any parameters are all referring to users, titles, etc. that are valid on that wiki. Publishing such log entries to recent changes (see ::publish()) is not supported.
Definition at line 313 of file ManualLogEntry.php.
References MediaWiki\Page\PageReference\getDBkey(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Page\PageReference\getNamespace(), MediaWiki\Logging\LogEntryBase\makeParamBlob(), and wfTimestampNow().
| MediaWiki\Logging\ManualLogEntry::isLegacy | ( | ) |
Reimplemented from MediaWiki\Logging\LogEntryBase.
Definition at line 574 of file ManualLogEntry.php.
| MediaWiki\Logging\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 434 of file ManualLogEntry.php.
References MediaWiki\MediaWikiServices\getInstance().
| MediaWiki\Logging\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 238 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$revId.
| MediaWiki\Logging\ManualLogEntry::setComment | ( | string | $comment | ) |
Set a comment associated with the action being logged.
| string | $comment |
Definition at line 225 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$comment.
| MediaWiki\Logging\ManualLogEntry::setDeleted | ( | $deleted | ) |
Set the 'deleted' flag.
| int | $deleted | One of LogPage::DELETED_* bitfield constants |
Definition at line 289 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$deleted.
| MediaWiki\Logging\ManualLogEntry::setForceBotFlag | ( | bool | $forceBotFlag | ) |
Set the bot flag in the recent changes to this value.
| bool | $forceBotFlag |
Definition at line 299 of file ManualLogEntry.php.
| MediaWiki\Logging\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 269 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::setLegacy | ( | $legacy | ) |
Set the 'legacy' flag.
| bool | $legacy |
Definition at line 279 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$legacy.
| MediaWiki\Logging\ManualLogEntry::setParameters | ( | $parameters | ) |
Set extra log parameters.
Takes an array in a parameter name => parameter value format. The array will be converted to string via serialize() and stored in the log_params database field. (If you want to store parameters in such a way that they can be targeted by DB queries, use setRelations() instead.)
You can pass these parameters 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), as 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).
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. (Note that such parameters will still be publicly viewable via the API.)
Example: $entry->setParameters( [ // store and use in messages as $4 '4::color' => 'blue', // store as is, use in messages as $5 with Message::numParam() '5:number:count' => 3000, // store but do not use in messages 'animal' => 'dog' ] );
Typically, these parameters will be used in the logentry-<type>-<subtype> message, but custom formatters, declared via $wgLogActionsHandlers, can override that.
| array | $parameters | Associative array |
Definition at line 146 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$parameters.
| MediaWiki\Logging\ManualLogEntry::setPerformer | ( | UserIdentity | $performer | ) |
Set the user that performed the action being logged.
Since 1.46, the user can belong to another wiki, not just the current one. The database passed to ::insert() must belong to the same wiki.
| UserIdentity | $performer |
Definition at line 185 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$performer.
| MediaWiki\Logging\ManualLogEntry::setRelations | ( | array | $relations | ) |
Declare arbitrary tag/value relations to this log entry.
These will be stored in the log_search table and can be used to filter log entries later on.
| array | $relations | Map of (tag => (list of values|value)); values must be string. When an array of values is given, a separate DB row will be created for each value. |
Definition at line 172 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$relations.
| MediaWiki\Logging\ManualLogEntry::setTarget | ( | $target | ) |
Set the title of the object changed.
Since 1.46, the page can belong to another wiki, not just the current one. The database passed to ::insert() must belong to the same wiki.
| LinkTarget | PageReference | $target | calling with LinkTarget is deprecated since 1.37 |
Definition at line 199 of file ManualLogEntry.php.
| MediaWiki\Logging\ManualLogEntry::setTimestamp | ( | $timestamp | ) |
Set the timestamp of when the logged action took place.
| string | $timestamp | Can be in any format accepted by ConvertibleTimestamp |
Definition at line 215 of file ManualLogEntry.php.
References MediaWiki\Logging\ManualLogEntry\$timestamp.
|
protected |
Comment for the log entry.
Definition at line 68 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\setComment().
|
protected |
Deletion state of the log entry.
Definition at line 77 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\setDeleted().
|
protected |
The bot flag in the recent changes will be set to this value.
Definition at line 89 of file ManualLogEntry.php.
|
protected |
ID of the log entry.
Definition at line 80 of file ManualLogEntry.php.
|
protected |
Can this log entry be patrolled?
Definition at line 83 of file ManualLogEntry.php.
|
protected |
Whether this is a legacy log entry.
Definition at line 86 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\setLegacy().
|
protected |
Parameters for log entry.
Definition at line 53 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\setParameters().
|
protected |
Performer of the action for the log entry.
Definition at line 59 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\setPerformer().
|
protected |
Definition at line 56 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\setRelations().
|
protected |
A rev id associated to the log entry.
Definition at line 71 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\setAssociatedRevId().
|
protected |
Sub type of log entry.
Definition at line 50 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\__construct().
|
protected |
Change tags add to the log entry.
Definition at line 74 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\addTags().
|
protected |
Target page for the log entry.
Definition at line 62 of file ManualLogEntry.php.
|
protected |
Timestamp of creation of the log entry.
Definition at line 65 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\setTimestamp().
|
protected |
Type of log entry.
Definition at line 47 of file ManualLogEntry.php.
Referenced by MediaWiki\Logging\ManualLogEntry\__construct().