MediaWiki  master
ManualLogEntry Class Reference

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

Inheritance diagram for ManualLogEntry:
Collaboration diagram for ManualLogEntry:

Public Member Functions

 __construct ( $type, $subtype)
 
 addTags ( $tags)
 Add change tags for the log entry. More...
 
 getAssociatedRevId ()
 
 getComment ()
 
 getDeleted ()
 
 getIsPatrollable ()
 Whether this log entry is patrollable. More...
 
 getParameters ()
 
 getPerformer ()
 
 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...
 
- Public Member Functions inherited from LogEntryBase
 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...
 
User $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 Public Member Functions inherited from LogEntryBase
static extractParams ( $blob)
 Extract a parameter array from a blob. More...
 
static makeParamBlob ( $params)
 Create a blob from a parameter array. More...
 

Detailed Description

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

Since
1.19

Definition at line 38 of file ManualLogEntry.php.

Constructor & Destructor Documentation

◆ __construct()

ManualLogEntry::__construct (   $type,
  $subtype 
)
Since
1.19
Parameters
string$type
string$subtype

Definition at line 86 of file ManualLogEntry.php.

References $subtype, and $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 204 of file ManualLogEntry.php.

References $tags.

Referenced by setTags().

◆ getAssociatedRevId()

ManualLogEntry::getAssociatedRevId ( )
Since
1.27
Returns
int

Definition at line 473 of file ManualLogEntry.php.

References $revId.

Referenced by insert(), and publish().

◆ getComment()

ManualLogEntry::getComment ( )
Returns
string

Implements LogEntry.

Definition at line 465 of file ManualLogEntry.php.

References $comment.

Referenced by insert().

◆ getDeleted()

ManualLogEntry::getDeleted ( )
Returns
int

Implements LogEntry.

Definition at line 506 of file ManualLogEntry.php.

References $deleted.

◆ getIsPatrollable()

ManualLogEntry::getIsPatrollable ( )

Whether this log entry is patrollable.

Since
1.27
Returns
bool

Definition at line 491 of file ManualLogEntry.php.

References $isPatrollable.

◆ getParameters()

ManualLogEntry::getParameters ( )
Returns
array

Implements LogEntry.

Definition at line 435 of file ManualLogEntry.php.

References $parameters.

Referenced by insert().

◆ getPerformer()

ManualLogEntry::getPerformer ( )
Returns
User

Implements LogEntry.

Definition at line 442 of file ManualLogEntry.php.

References $performer.

Referenced by getRecentChange(), and insert().

◆ getRecentChange()

ManualLogEntry::getRecentChange (   $newId = 0)

Get a RecentChanges object for the log entry.

Parameters
int$newId
Returns
RecentChange
Since
1.23

Definition at line 327 of file ManualLogEntry.php.

References $context, getPerformer(), getTarget(), getTimestamp(), SpecialPage\getTitleFor(), getType(), LogEntryBase\makeParamBlob(), RequestContext\newExtraneousContext(), LogFormatter\newFromEntry(), and RecentChange\newLogEntry().

Referenced by publish().

◆ getSubtype()

ManualLogEntry::getSubtype ( )
Returns
string

Implements LogEntry.

Definition at line 428 of file ManualLogEntry.php.

References $subtype.

Referenced by insert().

◆ getTags()

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

Definition at line 481 of file ManualLogEntry.php.

References $tags.

Referenced by publish().

◆ getTarget()

ManualLogEntry::getTarget ( )
Returns
Title

Implements LogEntry.

Definition at line 449 of file ManualLogEntry.php.

References $target.

Referenced by getRecentChange(), and insert().

◆ getTimestamp()

ManualLogEntry::getTimestamp ( )
Returns
string|false

Implements LogEntry.

Definition at line 456 of file ManualLogEntry.php.

References wfTimestamp(), and wfTimestampNow().

Referenced by getRecentChange(), and insert().

◆ getType()

ManualLogEntry::getType ( )
Returns
string

Implements LogEntry.

Definition at line 421 of file ManualLogEntry.php.

References $type.

Referenced by getRecentChange(), insert(), and publish().

◆ 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 256 of file ManualLogEntry.php.

References $comment, $deleted, $id, $relations, $revId, DB_MASTER, getAssociatedRevId(), getComment(), getParameters(), getPerformer(), CommentStore\getStore(), getSubtype(), getTarget(), getTimestamp(), getType(), LogEntryBase\makeParamBlob(), ActorMigration\newMigration(), wfGetDB(), and wfTimestampNow().

◆ isLegacy()

ManualLogEntry::isLegacy ( )
Since
1.25
Returns
bool

Reimplemented from LogEntryBase.

Definition at line 499 of file ManualLogEntry.php.

References $legacy.

◆ 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 367 of file ManualLogEntry.php.

References $revId, $tags, DeferredUpdates\addCallableUpdate(), ChangeTags\addTags(), DB_MASTER, getAssociatedRevId(), MediaWiki\Logger\LoggerFactory\getInstance(), getRecentChange(), getTags(), getType(), DeferredUpdates\POSTSEND, Hooks\runner(), 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 176 of file ManualLogEntry.php.

References $revId.

◆ setComment()

ManualLogEntry::setComment (   $comment)

Set a comment associated with the action being logged.

Since
1.19
Parameters
string$comment

Definition at line 163 of file ManualLogEntry.php.

References $comment.

◆ setDeleted()

ManualLogEntry::setDeleted (   $deleted)

Set the 'deleted' flag.

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

Definition at line 245 of file ManualLogEntry.php.

References $deleted.

◆ 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 225 of file ManualLogEntry.php.

◆ setLegacy()

ManualLogEntry::setLegacy (   $legacy)

Set the 'legacy' flag.

Since
1.25
Parameters
bool$legacy

Definition at line 235 of file ManualLogEntry.php.

References $legacy.

◆ 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, the first three parameters are hardcoded for every message.

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.

Example: $entry->setParameters( '4::color' => 'blue', '5:number:count' => 3000, 'animal' => 'dog' );

Since
1.19
Parameters
array$parametersAssociative array

Definition at line 112 of file ManualLogEntry.php.

References $parameters.

◆ setPerformer()

ManualLogEntry::setPerformer ( UserIdentity  $performer)

Set the user that performed the action being logged.

Since
1.19
Parameters
UserIdentity$performer

Definition at line 133 of file ManualLogEntry.php.

References $performer, and User\newFromIdentity().

◆ 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 123 of file ManualLogEntry.php.

References $relations.

◆ 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

Definition at line 190 of file ManualLogEntry.php.

References addTags(), and wfDebug().

◆ setTarget()

ManualLogEntry::setTarget ( LinkTarget  $target)

Set the title of the object changed.

Since
1.19
Parameters
LinkTarget$target

Definition at line 143 of file ManualLogEntry.php.

References $target, and Title\newFromLinkTarget().

◆ setTimestamp()

ManualLogEntry::setTimestamp (   $timestamp)

Set the timestamp of when the logged action took place.

Since
1.19
Parameters
string$timestamp

Definition at line 153 of file ManualLogEntry.php.

References $timestamp.

Member Data Documentation

◆ $comment

string ManualLogEntry::$comment = ''
protected

Comment for the log entry.

Definition at line 61 of file ManualLogEntry.php.

Referenced by getComment(), insert(), and setComment().

◆ $deleted

int ManualLogEntry::$deleted
protected

Deletion state of the log entry.

Definition at line 70 of file ManualLogEntry.php.

Referenced by getDeleted(), insert(), and setDeleted().

◆ $id

int ManualLogEntry::$id
protected

ID of the log entry.

Definition at line 73 of file ManualLogEntry.php.

Referenced by insert().

◆ $isPatrollable

bool ManualLogEntry::$isPatrollable = false
protected

Can this log entry be patrolled?

Definition at line 76 of file ManualLogEntry.php.

Referenced by getIsPatrollable().

◆ $legacy

bool ManualLogEntry::$legacy = false
protected

Whether this is a legacy log entry.

Definition at line 79 of file ManualLogEntry.php.

Referenced by isLegacy(), and setLegacy().

◆ $parameters

array ManualLogEntry::$parameters = []
protected

Parameters for log entry.

Definition at line 46 of file ManualLogEntry.php.

Referenced by getParameters(), and setParameters().

◆ $performer

User ManualLogEntry::$performer
protected

Performer of the action for the log entry.

Definition at line 52 of file ManualLogEntry.php.

Referenced by getPerformer(), and setPerformer().

◆ $relations

array ManualLogEntry::$relations = []
protected

Definition at line 49 of file ManualLogEntry.php.

Referenced by insert(), and setRelations().

◆ $revId

int ManualLogEntry::$revId = 0
protected

A rev id associated to the log entry.

Definition at line 64 of file ManualLogEntry.php.

Referenced by getAssociatedRevId(), insert(), publish(), and setAssociatedRevId().

◆ $subtype

string ManualLogEntry::$subtype
protected

Sub type of log entry.

Definition at line 43 of file ManualLogEntry.php.

Referenced by __construct(), and getSubtype().

◆ $tags

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

Change tags add to the log entry.

Definition at line 67 of file ManualLogEntry.php.

Referenced by addTags(), getTags(), and publish().

◆ $target

Title ManualLogEntry::$target
protected

Target title for the log entry.

Definition at line 55 of file ManualLogEntry.php.

Referenced by getTarget(), and setTarget().

◆ $timestamp

string ManualLogEntry::$timestamp
protected

Timestamp of creation of the log entry.

Definition at line 58 of file ManualLogEntry.php.

Referenced by setTimestamp().

◆ $type

string ManualLogEntry::$type
protected

Type of log entry.

Definition at line 40 of file ManualLogEntry.php.

Referenced by __construct(), and getType().


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