Go to the documentation of this file.
30 use Wikimedia\Assert\Assert;
191 wfDebug(
'Overwriting existing ManualLogEntry tags' );
204 if (
$tags ===
null ) {
208 if ( is_string(
$tags ) ) {
211 Assert::parameterElementType(
'string',
$tags,
'tags' );
212 $this->tags = array_unique( array_merge( $this->tags,
$tags ) );
225 $this->isPatrollable = (bool)$patrollable;
258 if ( $this->timestamp ===
null ) {
271 $params[
'associated_rev_id'] =
$revId;
276 'log_type' => $this->
getType(),
278 'log_timestamp' => $dbw->timestamp( $this->
getTimestamp() ),
279 'log_namespace' => $this->
getTarget()->getNamespace(),
280 'log_title' => $this->
getTarget()->getDBkey(),
281 'log_page' => $this->
getTarget()->getArticleID(),
284 if ( isset( $this->deleted ) ) {
289 ->getInsertValues( $dbw,
'log_user', $this->
getPerformer() );
291 $dbw->insert(
'logging', $data, __METHOD__ );
292 $this->
id = $dbw->insertId();
296 if ( !strlen( $tag ) ) {
297 throw new MWException(
"Got empty log search tag." );
300 if ( !is_array( $values ) ) {
301 $values = [ $values ];
304 foreach ( $values as $value ) {
307 'ls_value' => $value,
312 if ( count( $rows ) ) {
313 $dbw->insert(
'log_search', $rows, __METHOD__, [
'IGNORE' ] );
334 if ( $user->isAnon() ) {
338 $ip = $user->getName();
346 $formatter->getPlainActionText(),
354 $formatter->getIRCActionComment(),
366 public function publish( $newId, $to =
'rcandudp' ) {
371 'newId and/or revId must be set when calling ManualLogEntry::publish()',
377 'exception' =>
new RuntimeException()
384 function () use ( $newId, $to, $canAddTags ) {
386 if ( !$log->isRestricted() ) {
390 if ( $to ===
'rc' || $to ===
'rcandudp' ) {
392 $rc->addTags( $this->
getTags() );
393 $rc->save( $rc::SEND_NONE );
396 if (
$tags && $canAddTags ) {
402 $newId > 0 ? $newId :
null
407 if ( $to ===
'udp' || $to ===
'rcandudp' ) {
408 $rc->notifyRCFeeds();
setTimestamp( $timestamp)
Set the timestamp of when the logged action took place.
__construct( $type, $subtype)
int $deleted
Deletion state of the log entry.
getType()
The main log type.
insert(IDatabase $dbw=null)
Insert the entry into the logging table.
setAssociatedRevId( $revId)
Set an associated revision id.
getParameters()
Get the extra parameters stored for this message.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getComment()
Get the user provided comment.
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
static newFromIdentity(UserIdentity $identity)
Returns a User object corresponding to the given UserIdentity.
setRelations(array $relations)
Declare arbitrary tag/value relations to this log entry.
addTags( $tags)
Add change tags for the log entry.
getTimestamp()
Get the timestamp when the action was executed.
static newMigration()
Static constructor.
bool $legacy
Whether this is a legacy log entry.
setTags( $tags)
Set change tags for the log entry.
string $comment
Comment for the log entry.
array $parameters
Parameters for log entry.
getRecentChange( $newId=0)
Get a RecentChanges object for the log entry.
setComment( $comment)
Set a comment associated with the action being logged.
string[] $tags
Change tags add to the log entry.
int $id
ID of the log entry.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Class to simplify the use of log pages.
getSubtype()
The log subtype.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
string $subtype
Sub type of log entry.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
setParameters( $parameters)
Set extra log parameters.
publish( $newId, $to='rcandudp')
Publish the log entry.
Extends the LogEntry Interface with some basic functionality.
setIsPatrollable( $patrollable)
Set whether this log entry should be made patrollable This shouldn't depend on config,...
static runWithoutAbort( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
setDeleted( $deleted)
Set the 'deleted' flag.
string $timestamp
Timestamp of creation of the log entry.
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
setTarget(LinkTarget $target)
Set the title of the object changed.
static newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='', $revId=0, $isPatrollable=false)
Represents a title within MediaWiki.
getDeleted()
Get the access restriction.
static makeParamBlob( $params)
Create a blob from a parameter array.
int $revId
A rev id associated to the log entry.
getIsPatrollable()
Whether this log entry is patrollable.
Title $target
Target title for the log entry.
Class for creating new log entries and inserting them into the database.
setLegacy( $legacy)
Set the 'legacy' flag.
setPerformer(UserIdentity $performer)
Set the user that performed the action being logged.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static addCallableUpdate( $callable, $stage=self::POSTSEND, $dbw=null)
Add a callable update.
string $type
Type of log entry.
bool $isPatrollable
Can this log entry be patrolled?
User $performer
Performer of the action for the log entry.
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).