122 return ( $this->
getDeleted() & $field ) === $field;
173 $commentQuery = CommentStore::getStore()->getJoin(
'log_comment' );
174 $actorQuery = ActorMigration::newMigration()->getJoin(
'log_user' );
177 [
'logging' ], $commentQuery[
'tables'], $actorQuery[
'tables'], [
'user' ]
180 'log_id',
'log_type',
'log_action',
'log_timestamp',
181 'log_namespace',
'log_title',
182 'log_params',
'log_deleted',
183 'user_id',
'user_name',
'user_editcount',
184 ] + $commentQuery[
'fields'] + $actorQuery[
'fields'];
188 'user' => [
'LEFT JOIN',
'user_id=' . $actorQuery[
'fields'][
'log_user'] ],
189 ] + $commentQuery[
'joins'] + $actorQuery[
'joins'];
196 'join_conds' => $joins,
209 if ( isset(
$row->rc_logid ) ) {
212 return new self(
$row );
225 $queryInfo[
'conds'] += [
'log_id' => $id ];
227 $queryInfo[
'tables'],
228 $queryInfo[
'fields'],
231 $queryInfo[
'options'],
232 $queryInfo[
'join_conds']
265 return (
int)$this->row->log_id;
274 return $this->row->log_params;
284 return $this->row->log_type;
288 return $this->row->log_action;
292 if ( !isset( $this->params ) ) {
294 Wikimedia\suppressWarnings();
296 Wikimedia\restoreWarnings();
299 $this->legacy =
false;
302 $this->legacy =
true;
305 if ( isset( $this->params[
'associated_rev_id'] ) ) {
306 $this->revId = $this->params[
'associated_rev_id'];
307 unset( $this->params[
'associated_rev_id'] );
321 if ( !$this->performer ) {
322 $actorId = isset( $this->row->log_actor ) ? (int)$this->row->log_actor : 0;
323 $userId = (int)$this->row->log_user;
324 if ( $userId !== 0 || $actorId !== 0 ) {
326 if ( isset( $this->row->user_name ) ) {
328 } elseif ( $actorId !== 0 ) {
335 $userText = $this->row->log_user_text;
344 $namespace = $this->row->log_namespace;
345 $page = $this->row->log_title;
346 $title = Title::makeTitle( $namespace, $page );
352 return wfTimestamp( TS_MW, $this->row->log_timestamp );
356 return CommentStore::getStore()->getComment(
'log_comment', $this->row )->text;
360 return $this->row->log_deleted;
367 return $this->row->rc_logid;
371 return $this->row->rc_params;
375 return $this->row->rc_this_oldid;
379 return $this->row->rc_log_type;
383 return $this->row->rc_log_action;
387 if ( !$this->performer ) {
388 $actorId = isset( $this->row->rc_actor ) ? (int)$this->row->rc_actor : 0;
389 $userId = (int)$this->row->rc_user;
390 if ( $actorId !== 0 ) {
392 } elseif ( $userId !== 0 ) {
395 $userText = $this->row->rc_user_text;
405 $namespace = $this->row->rc_namespace;
406 $page = $this->row->rc_title;
407 $title = Title::makeTitle( $namespace, $page );
413 return wfTimestamp( TS_MW, $this->row->rc_timestamp );
417 return CommentStore::getStore()
423 return $this->row->rc_deleted;
518 $this->relations = $relations;
528 $this->performer = $performer;
538 $this->target = $target;
581 if ( is_string(
$tags ) ) {
597 $this->isPatrollable = (bool)$patrollable;
632 if ( $this->timestamp ===
null ) {
647 if ( !empty(
$relations[
'target_author_id'] ) ) {
652 if ( !empty(
$relations[
'target_author_ip'] ) ) {
653 foreach (
$relations[
'target_author_ip'] as $ip ) {
658 $relations[
'target_author_actor'] = $actorIds;
659 $params[
'authorActors'] = $actorIds;
675 'log_type' => $this->
getType(),
677 'log_timestamp' => $dbw->timestamp( $this->
getTimestamp() ),
678 'log_namespace' => $this->
getTarget()->getNamespace(),
679 'log_title' => $this->
getTarget()->getDBkey(),
680 'log_page' => $this->
getTarget()->getArticleID(),
683 if ( isset( $this->deleted ) ) {
684 $data[
'log_deleted'] = $this->deleted;
686 $data += CommentStore::getStore()->insert( $dbw,
'log_comment',
$comment );
687 $data += ActorMigration::newMigration()
688 ->getInsertValues( $dbw,
'log_user', $this->
getPerformer() );
690 $dbw->insert(
'logging', $data, __METHOD__ );
691 $this->
id = $dbw->insertId();
695 if ( !strlen( $tag ) ) {
696 throw new MWException(
"Got empty log search tag." );
699 if ( !is_array( $values ) ) {
700 $values = [ $values ];
703 foreach ( $values as
$value ) {
707 'ls_log_id' => $this->id
711 if ( count(
$rows ) ) {
712 $dbw->insert(
'log_search',
$rows, __METHOD__,
'IGNORE' );
730 $logpage = SpecialPage::getTitleFor(
'Log', $this->
getType() );
733 if ( $user->isAnon() ) {
736 if ( IP::isIPAddress( $user->getName() ) ) {
737 $ip = $user->getName();
741 return RecentChange::newLogEntry(
745 $formatter->getPlainActionText(),
753 $formatter->getIRCActionComment(),
754 $this->getAssociatedRevId(),
755 $this->getIsPatrollable()
765 public function publish( $newId, $to =
'rcandudp' ) {
766 DeferredUpdates::addCallableUpdate(
767 function () use ( $newId, $to ) {
769 if ( !$log->isRestricted() ) {
772 if ( $to ===
'rc' || $to ===
'rcandudp' ) {
775 if ( is_null(
$tags ) ) {
778 $rc->addTags(
$tags );
779 $rc->save(
'pleasedontudp' );
782 if ( $to ===
'udp' || $to ===
'rcandudp' ) {
783 $rc->notifyRCFeeds();
787 DeferredUpdates::POSTSEND,
797 return $this->subtype;
801 return $this->parameters;
808 return $this->performer;
815 return $this->target;
819 $ts = $this->timestamp !==
null ? $this->timestamp :
wfTimestampNow();
825 return $this->comment;
851 return $this->isPatrollable;
859 return $this->legacy;
863 return (
int)$this->deleted;
unserialize( $serialized)
int $wgActorTableSchemaMigrationStage
Actor table schema migration stage.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
This class wraps around database result row.
getParameters()
Get the extra parameters stored for this message.
isLegacy()
Whether the parameters for this log are stored in new or old format.
array $params
Parameters for log entry.
getSubtype()
The log subtype.
getDeleted()
Get the access restriction.
static newFromRow( $row)
Constructs new LogEntry from database result row.
getComment()
Get the user provided comment.
bool $legacy
Whether the parameters for this log entry are stored in new or old format.
int $revId
A rev id associated to the log entry.
getRawParameters()
Returns whatever is stored in the database field.
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
stdClass $row
Database result row.
getId()
Returns the unique database id.
getPerformer()
Get the user for performed this action.
getTarget()
Get the target page of this action.
getType()
The main log type.
static newFromId( $id, IDatabase $db)
Loads a LogEntry with the given id from database.
getTimestamp()
Get the timestamp when the action was executed.
Extends the LogEntryInterface with some basic functionality.
isLegacy()
Whether the parameters for this log are stored in new or old format.
static extractParams( $blob)
Extract a parameter array from a blob.
static makeParamBlob( $params)
Create a blob from a parameter array.
getFullType()
The full logtype in format maintype/subtype.
Class to simplify the use of log pages.
static extractParams( $blob)
Extract a parameter array from a blob.
Class for creating log entries manually, to inject them into the database.
getDeleted()
Get the access restriction.
getIsPatrollable()
Whether this log entry is patrollable.
setDeleted( $deleted)
Set the 'deleted' flag.
string $subtype
Sub type of log entry.
int $id
ID of the log entry.
string $type
Type of log entry.
setTarget(Title $target)
Set the title of the object changed.
setAssociatedRevId( $revId)
Set an associated revision id.
insert(IDatabase $dbw=null)
Insert the entry into the logging table.
string $comment
Comment for the log entry.
setTimestamp( $timestamp)
Set the timestamp of when the logged action took place.
array $parameters
Parameters for log entry.
getTimestamp()
Get the timestamp when the action was executed.
int $revId
A rev id associated to the log entry.
setComment( $comment)
Set a comment associated with the action being logged.
setParameters( $parameters)
Set extra log parameters.
getComment()
Get the user provided comment.
bool $isPatrollable
Can this log entry be patrolled?
getType()
The main log type.
Title $target
Target title for the log entry.
int $deleted
Deletion state of the log entry.
setLegacy( $legacy)
Set the 'legacy' flag.
setIsPatrollable( $patrollable)
Set whether this log entry should be made patrollable This shouldn't depend on config,...
getParameters()
Get the extra parameters stored for this message.
bool $legacy
Whether this is a legacy log entry.
string $timestamp
Timestamp of creation of the log entry.
getRecentChange( $newId=0)
Get a RecentChanges object for the log entry.
User $performer
Performer of the action for the log entry.
setRelations(array $relations)
Declare arbitrary tag/value relations to this log entry.
setPerformer(User $performer)
Set the user that performed the action being logged.
__construct( $type, $subtype)
setTags( $tags)
Set change tags for the log entry.
array $tags
Change tags add to the log entry.
publish( $newId, $to='rcandudp')
Publish the log entry.
getSubtype()
The log subtype.
getTimestamp()
Get the timestamp when the action was executed.
getTarget()
Get the target page of this action.
getSubtype()
The log subtype.
getComment()
Get the user provided comment.
getDeleted()
Get the access restriction.
getRawParameters()
Returns whatever is stored in the database field.
getId()
Returns the unique database id.
getPerformer()
Get the user for performed this action.
getType()
The main log type.
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static newFromRow( $row, $data=null)
Create a new user object from a user row.
static newFromId( $id)
Static factory method for creation from a given user ID.
static newFromActorId( $id)
Static factory method for creation from a given actor ID.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
namespace and then decline to actually register it file or subcat img or subcat $title
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object
const MIGRATION_WRITE_NEW
const MIGRATION_WRITE_BOTH
Interface for log entries.
getParameters()
Get the extra parameters stored for this message.
getTimestamp()
Get the timestamp when the action was executed.
getTarget()
Get the target page of this action.
getSubtype()
The log subtype.
getDeleted()
Get the access restriction.
getComment()
Get the user provided comment.
getFullType()
The full logtype in format maintype/subtype.
getPerformer()
Get the user for performed this action.
getType()
The main log type.
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type