MediaWiki 1.40.4
ManualLogEntry Class Reference

Class for creating new log entries and inserting them into the database. More...

Inherits LogEntryBase, and MediaWiki\ChangeTags\Taggable.

Collaboration diagram for ManualLogEntry:

Public Member Functions

 __construct ( $type, $subtype)
 
 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 ()
 
 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.
 
 setTags ( $tags)
 Set change tags for the 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 LogEntryBase
 getFullType ()
 The full logtype in format maintype/subtype.
 
 isDeleted ( $field)
 

Protected Attributes

string $comment = ''
 Comment for the log entry.
 
int $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.
 
Title $target
 Target title 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 LogEntryBase
static extractParams ( $blob)
 Extract a parameter array from a blob.
 
static makeParamBlob ( $params)
 Create a blob from a parameter array.
 

Detailed Description

Class for creating new log entries and inserting them into the database.

Stability: newable
Note
marked as newable in 1.35 for lack of a better alternative, but should be changed to use the builder pattern or the command pattern.
Since
1.19
See also
https://www.mediawiki.org/wiki/Manual:Logging_to_Special:Log

Definition at line 46 of file ManualLogEntry.php.

Constructor & Destructor Documentation

◆ __construct()

ManualLogEntry::__construct ( $type,
$subtype )
Stability: stable
to call
Since
1.19
Parameters
string$typeLog type. Should match $wgLogTypes.
string$subtypeLog subtype (action). Should match $wgLogActions or (together with $type) $wgLogActionsHandlers.
Note

Definition at line 100 of file ManualLogEntry.php.

References $type.

Member Function Documentation

◆ addTags()

ManualLogEntry::addTags ( $tags)

Add change tags for the log entry.

Since
1.33
Parameters
string | string[] | null$tagsTags to apply

Implements MediaWiki\ChangeTags\Taggable.

Definition at line 237 of file ManualLogEntry.php.

Referenced by setTags().

◆ getAssociatedRevId()

ManualLogEntry::getAssociatedRevId ( )
Since
1.27
Returns
int

Definition at line 517 of file ManualLogEntry.php.

◆ getComment()

ManualLogEntry::getComment ( )
Returns
string

Implements LogEntry.

Definition at line 509 of file ManualLogEntry.php.

◆ getDeleted()

ManualLogEntry::getDeleted ( )
Returns
int

Implements LogEntry.

Definition at line 550 of file ManualLogEntry.php.

◆ getIsPatrollable()

ManualLogEntry::getIsPatrollable ( )

Whether this log entry is patrollable.

Since
1.27
Returns
bool

Definition at line 535 of file ManualLogEntry.php.

◆ getParameters()

ManualLogEntry::getParameters ( )
Returns
array

Implements LogEntry.

Definition at line 479 of file ManualLogEntry.php.

◆ getPerformerIdentity()

ManualLogEntry::getPerformerIdentity ( )
Returns
UserIdentity

Implements LogEntry.

Definition at line 486 of file ManualLogEntry.php.

◆ getRecentChange()

ManualLogEntry::getRecentChange ( $newId = 0)

Get a RecentChanges object for the log entry.

Parameters
int$newId
Returns
RecentChange
Since
1.23

Definition at line 370 of file ManualLogEntry.php.

References getTimestamp(), SpecialPage\getTitleFor(), and LogEntryBase\makeParamBlob().

◆ getSubtype()

ManualLogEntry::getSubtype ( )
Returns
string

Implements LogEntry.

Definition at line 472 of file ManualLogEntry.php.

◆ getTags()

ManualLogEntry::getTags ( )
Since
1.27
Returns
string[]

Definition at line 525 of file ManualLogEntry.php.

◆ getTarget()

ManualLogEntry::getTarget ( )
Returns
Title

Implements LogEntry.

Definition at line 493 of file ManualLogEntry.php.

◆ getTimestamp()

ManualLogEntry::getTimestamp ( )
Returns
string|false TS_MW timestamp, a string with 14 digits

Implements LogEntry.

Definition at line 500 of file ManualLogEntry.php.

References wfTimestamp(), and wfTimestampNow().

◆ getType()

ManualLogEntry::getType ( )
Returns
string

Implements LogEntry.

Definition at line 465 of file ManualLogEntry.php.

References $type.

◆ insert()

ManualLogEntry::insert ( IDatabase $dbw = null)

Insert the entry into the logging table.

Parameters
IDatabase | null$dbw
Returns
int ID of the log entry
Exceptions
MWException

Definition at line 299 of file ManualLogEntry.php.

References DB_PRIMARY, getTimestamp(), LogEntryBase\makeParamBlob(), wfGetDB(), and wfTimestampNow().

◆ isLegacy()

ManualLogEntry::isLegacy ( )
Since
1.25
Returns
bool

Reimplemented from LogEntryBase.

Definition at line 543 of file ManualLogEntry.php.

◆ publish()

ManualLogEntry::publish ( $newId,
$to = 'rcandudp' )

Publish the log entry.

Parameters
int$newIdId of the log entry.
string$toOne of: rcandudp (default), rc, udp

Definition at line 411 of file ManualLogEntry.php.

References ChangeTags\addTags(), DB_PRIMARY, and wfGetDB().

◆ setAssociatedRevId()

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.

Since
1.27
Parameters
int$revId

Definition at line 207 of file ManualLogEntry.php.

◆ setComment()

ManualLogEntry::setComment ( string $comment)

Set a comment associated with the action being logged.

Since
1.19
Parameters
string$comment

Definition at line 194 of file ManualLogEntry.php.

◆ setDeleted()

ManualLogEntry::setDeleted ( $deleted)

Set the 'deleted' flag.

Since
1.19
Parameters
int$deletedOne of LogPage::DELETED_* bitfield constants

Definition at line 278 of file ManualLogEntry.php.

◆ setForceBotFlag()

ManualLogEntry::setForceBotFlag ( bool $forceBotFlag)

Set the bot flag in the recent changes to this value.

Since
1.40
Parameters
bool$forceBotFlag

Definition at line 288 of file ManualLogEntry.php.

◆ setIsPatrollable()

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

Since
1.27
Parameters
bool$patrollable

Definition at line 258 of file ManualLogEntry.php.

◆ setLegacy()

ManualLogEntry::setLegacy ( $legacy)

Set the 'legacy' flag.

Since
1.25
Parameters
bool$legacy

Definition at line 268 of file ManualLogEntry.php.

◆ setParameters()

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' );

Since
1.19
Parameters
array$parametersAssociative array
See also
LogFormatter::formatParameterValue for valid parameter types and their meanings

Definition at line 135 of file ManualLogEntry.php.

◆ setPerformer()

ManualLogEntry::setPerformer ( UserIdentity $performer)

Set the user that performed the action being logged.

Since
1.19
Parameters
UserIdentity$performer

Definition at line 156 of file ManualLogEntry.php.

◆ setRelations()

ManualLogEntry::setRelations ( array $relations)

Declare arbitrary tag/value relations to this log entry.

These can be used to filter log entries later on.

Parameters
array$relationsMap of (tag => (list of values|value))
Since
1.22

Definition at line 146 of file ManualLogEntry.php.

◆ setTags()

ManualLogEntry::setTags ( $tags)

Set change tags for the log entry.

Passing null means the same as empty array, for compatibility with WikiPage::doUpdateRestrictions().

Since
1.27
Parameters
string | string[] | null$tags
Deprecated
since 1.33 Please use addTags() instead. Hard deprecated since 1.39.

Definition at line 222 of file ManualLogEntry.php.

References addTags(), wfDebug(), and wfDeprecated().

◆ setTarget()

ManualLogEntry::setTarget ( $target)

Set the title of the object changed.

Parameters
LinkTarget | PageReference$targetcalling with LinkTarget is deprecated since 1.37
Since
1.19

Definition at line 167 of file ManualLogEntry.php.

◆ setTimestamp()

ManualLogEntry::setTimestamp ( $timestamp)

Set the timestamp of when the logged action took place.

Since
1.19
Parameters
string$timestampCan be in any format accepted by ConvertibleTimestamp

Definition at line 184 of file ManualLogEntry.php.

Member Data Documentation

◆ $comment

string ManualLogEntry::$comment = ''
protected

Comment for the log entry.

Definition at line 69 of file ManualLogEntry.php.

◆ $deleted

int ManualLogEntry::$deleted
protected

Deletion state of the log entry.

Definition at line 78 of file ManualLogEntry.php.

◆ $forceBotFlag

bool null ManualLogEntry::$forceBotFlag = null
protected

The bot flag in the recent changes will be set to this value.

Definition at line 90 of file ManualLogEntry.php.

◆ $id

int ManualLogEntry::$id
protected

ID of the log entry.

Definition at line 81 of file ManualLogEntry.php.

◆ $isPatrollable

bool ManualLogEntry::$isPatrollable = false
protected

Can this log entry be patrolled?

Definition at line 84 of file ManualLogEntry.php.

◆ $legacy

bool ManualLogEntry::$legacy = false
protected

Whether this is a legacy log entry.

Definition at line 87 of file ManualLogEntry.php.

◆ $parameters

array ManualLogEntry::$parameters = []
protected

Parameters for log entry.

Definition at line 54 of file ManualLogEntry.php.

◆ $performer

UserIdentity ManualLogEntry::$performer
protected

Performer of the action for the log entry.

Definition at line 60 of file ManualLogEntry.php.

◆ $relations

array ManualLogEntry::$relations = []
protected

Definition at line 57 of file ManualLogEntry.php.

◆ $revId

int ManualLogEntry::$revId = 0
protected

A rev id associated to the log entry.

Definition at line 72 of file ManualLogEntry.php.

◆ $subtype

string ManualLogEntry::$subtype
protected

Sub type of log entry.

Definition at line 51 of file ManualLogEntry.php.

◆ $tags

string [] ManualLogEntry::$tags = []
protected

Change tags add to the log entry.

Definition at line 75 of file ManualLogEntry.php.

◆ $target

Title ManualLogEntry::$target
protected

Target title for the log entry.

Definition at line 63 of file ManualLogEntry.php.

◆ $timestamp

string ManualLogEntry::$timestamp
protected

Timestamp of creation of the log entry.

Definition at line 66 of file ManualLogEntry.php.

◆ $type

string ManualLogEntry::$type
protected

Type of log entry.

Definition at line 48 of file ManualLogEntry.php.


The documentation for this class was generated from the following file: