120 return ( $this->
getDeleted() & $field ) === $field;
171 $tables = [
'logging',
'user' ];
173 'log_id',
'log_type',
'log_action',
'log_timestamp',
174 'log_user',
'log_user_text',
175 'log_namespace',
'log_title',
176 'log_comment',
'log_params',
'log_deleted',
177 'user_id',
'user_name',
'user_editcount',
182 'user' => [
'LEFT JOIN',
'log_user=user_id' ],
190 'join_conds' => $joins,
203 if ( isset(
$row->rc_logid ) ) {
206 return new self(
$row );
235 return (
int)$this->row->log_id;
244 return $this->row->log_params;
254 return $this->row->log_type;
258 return $this->row->log_action;
262 if ( !isset( $this->params ) ) {
264 MediaWiki\suppressWarnings();
266 MediaWiki\restoreWarnings();
269 $this->legacy =
false;
272 $this->legacy =
true;
275 if ( isset( $this->params[
'associated_rev_id'] ) ) {
276 $this->revId = $this->params[
'associated_rev_id'];
277 unset( $this->params[
'associated_rev_id'] );
291 if ( !$this->performer ) {
292 $userId = (int)$this->row->log_user;
293 if ( $userId !== 0 ) {
295 if ( isset( $this->row->user_name ) ) {
296 $this->performer = User::newFromRow( $this->row );
298 $this->performer = User::newFromId( $userId );
302 $userText = $this->row->log_user_text;
303 $this->performer = User::newFromName( $userText,
false );
311 $namespace = $this->row->log_namespace;
312 $page = $this->row->log_title;
323 return $this->row->log_comment;
327 return $this->row->log_deleted;
334 return $this->row->rc_logid;
338 return $this->row->rc_params;
342 return $this->row->rc_this_oldid;
346 return $this->row->rc_log_type;
350 return $this->row->rc_log_action;
354 if ( !$this->performer ) {
355 $userId = (int)$this->row->rc_user;
356 if ( $userId !== 0 ) {
357 $this->performer = User::newFromId( $userId );
359 $userText = $this->row->rc_user_text;
361 $this->performer = User::newFromName( $userText,
false );
369 $namespace = $this->row->rc_namespace;
370 $page = $this->row->rc_title;
381 return $this->row->rc_comment;
385 return $this->row->rc_deleted;
545 if ( is_string(
$tags ) ) {
561 $this->isPatrollable = (bool)$patrollable;
595 $id = $dbw->nextSequenceValue(
'logging_log_id_seq' );
597 if ( $this->timestamp ===
null ) {
619 'log_type' => $this->
getType(),
621 'log_timestamp' => $dbw->timestamp( $this->
getTimestamp() ),
624 'log_namespace' => $this->
getTarget()->getNamespace(),
625 'log_title' => $this->
getTarget()->getDBkey(),
626 'log_page' => $this->
getTarget()->getArticleID(),
630 if ( isset( $this->deleted ) ) {
634 $dbw->insert(
'logging', $data, __METHOD__ );
635 $this->
id = !is_null(
$id ) ?
$id : $dbw->insertId();
639 if ( !strlen(
$tag ) ) {
640 throw new MWException(
"Got empty log search tag." );
643 if ( !is_array( $values ) ) {
644 $values = [ $values ];
655 if ( count( $rows ) ) {
656 $dbw->insert(
'log_search', $rows, __METHOD__,
'IGNORE' );
677 if (
$user->isAnon() ) {
681 $ip =
$user->getName();
689 $formatter->getPlainActionText(),
697 $formatter->getIRCActionComment(),
698 $this->getAssociatedRevId(),
699 $this->getIsPatrollable()
709 public function publish( $newId, $to =
'rcandudp' ) {
710 DeferredUpdates::addCallableUpdate(
711 function ()
use ( $newId, $to ) {
713 if ( !$log->isRestricted() ) {
716 if ( $to ===
'rc' || $to ===
'rcandudp' ) {
719 if ( is_null(
$tags ) ) {
722 $rc->addTags(
$tags );
723 $rc->save(
'pleasedontudp' );
726 if ( $to ===
'udp' || $to ===
'rcandudp' ) {
727 $rc->notifyRCFeeds();
732 $rc->getAttribute(
'rc_patrolled' ) === 1
738 DeferredUpdates::POSTSEND,
709 public function publish( $newId, $to =
'rcandudp' ) {
…}
770 $ts = $this->timestamp !==
null ? $this->timestamp :
wfTimestampNow();
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
unserialize( $serialized)
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.
getTimestamp()
Get the timestamp when the action was executed.
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
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.
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.
Can $isPatrollable
this log entry be patrolled?
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)
Constructor.
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.
static record( $rc, $auto=false, User $user=null, $tags=null)
Record a log event for a change being patrolled.
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 newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='', $revId=0, $isPatrollable=false)
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,...
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
when a variable name is used in a it is silently declared as a new local masking the global
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
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
the array() calling protocol came about after MediaWiki 1.4rc1.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive false for true for descending in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. 'CustomEditor' $rcid is used in generating this variable which contains information about the new such as the revision s whether the revision was marked as a minor edit or etc which include things like revision author revision comment
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Basic database interface for live and lazy-loaded relation database handles.
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 as and are nearing end of 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
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)