35use Wikimedia\Assert\Assert;
126 return ( $this->
getDeleted() & $field ) === $field;
178 $commentQuery = CommentStore::getStore()->getJoin(
'log_comment' );
179 $actorQuery = ActorMigration::newMigration()->getJoin(
'log_user' );
182 [
'logging' ], $commentQuery[
'tables'], $actorQuery[
'tables'], [
'user' ]
185 'log_id',
'log_type',
'log_action',
'log_timestamp',
186 'log_namespace',
'log_title',
187 'log_params',
'log_deleted',
188 'user_id',
'user_name',
'user_editcount',
189 ] + $commentQuery[
'fields'] + $actorQuery[
'fields'];
193 'user' => [
'LEFT JOIN',
'user_id=' . $actorQuery[
'fields'][
'log_user'] ],
194 ] + $commentQuery[
'joins'] + $actorQuery[
'joins'];
201 'join_conds' => $joins,
214 if ( isset(
$row->rc_logid ) ) {
217 return new self(
$row );
230 $queryInfo[
'conds'] += [
'log_id' => $id ];
232 $queryInfo[
'tables'],
233 $queryInfo[
'fields'],
236 $queryInfo[
'options'],
237 $queryInfo[
'join_conds']
270 return (
int)$this->row->log_id;
279 return $this->row->log_params;
289 return $this->row->log_type;
293 return $this->row->log_action;
297 if ( !isset( $this->params ) ) {
299 Wikimedia\suppressWarnings();
301 Wikimedia\restoreWarnings();
304 $this->legacy =
false;
307 $this->legacy =
true;
310 if ( isset( $this->params[
'associated_rev_id'] ) ) {
311 $this->revId = $this->params[
'associated_rev_id'];
312 unset( $this->params[
'associated_rev_id'] );
326 if ( !$this->performer ) {
327 $actorId = isset( $this->row->log_actor ) ? (int)$this->row->log_actor : 0;
328 $userId = (int)$this->row->log_user;
329 if ( $userId !== 0 || $actorId !== 0 ) {
331 if ( isset( $this->row->user_name ) ) {
333 } elseif ( $actorId !== 0 ) {
340 $userText = $this->row->log_user_text;
349 $namespace = $this->row->log_namespace;
350 $page = $this->row->log_title;
351 $title = Title::makeTitle( $namespace, $page );
357 return wfTimestamp( TS_MW, $this->row->log_timestamp );
361 return CommentStore::getStore()->getComment(
'log_comment', $this->row )->text;
365 return $this->row->log_deleted;
376 return $this->row->rc_logid;
380 return $this->row->rc_params;
384 return $this->row->rc_this_oldid;
388 return $this->row->rc_log_type;
392 return $this->row->rc_log_action;
396 if ( !$this->performer ) {
397 $actorId = isset( $this->row->rc_actor ) ? (int)$this->row->rc_actor : 0;
398 $userId = (int)$this->row->rc_user;
399 if ( $actorId !== 0 ) {
401 } elseif ( $userId !== 0 ) {
404 $userText = $this->row->rc_user_text;
414 $namespace = $this->row->rc_namespace;
415 $page = $this->row->rc_title;
416 $title = Title::makeTitle( $namespace, $page );
422 return wfTimestamp( TS_MW, $this->row->rc_timestamp );
426 return CommentStore::getStore()
432 return $this->row->rc_deleted;
527 $this->relations = $relations;
547 $this->target = Title::newFromLinkTarget( $target );
595 wfDebug(
'Overwriting existing ManualLogEntry tags' );
598 if (
$tags !==
null ) {
610 if ( is_string(
$tags ) ) {
613 Assert::parameterElementType(
'string',
$tags,
'tags' );
614 $this->tags = array_unique( array_merge( $this->tags,
$tags ) );
627 $this->isPatrollable = (bool)$patrollable;
662 if ( $this->timestamp ===
null ) {
677 if ( !empty(
$relations[
'target_author_id'] ) ) {
682 if ( !empty(
$relations[
'target_author_ip'] ) ) {
688 $relations[
'target_author_actor'] = $actorIds;
689 $params[
'authorActors'] = $actorIds;
705 'log_type' => $this->
getType(),
707 'log_timestamp' => $dbw->timestamp( $this->
getTimestamp() ),
708 'log_namespace' => $this->
getTarget()->getNamespace(),
709 'log_title' => $this->
getTarget()->getDBkey(),
710 'log_page' => $this->
getTarget()->getArticleID(),
713 if ( isset( $this->deleted ) ) {
714 $data[
'log_deleted'] = $this->deleted;
716 $data += CommentStore::getStore()->insert( $dbw,
'log_comment',
$comment );
717 $data += ActorMigration::newMigration()
718 ->getInsertValues( $dbw,
'log_user', $this->
getPerformer() );
720 $dbw->insert(
'logging',
$data, __METHOD__ );
721 $this->
id = $dbw->insertId();
725 if ( !strlen( $tag ) ) {
726 throw new MWException(
"Got empty log search tag." );
729 if ( !is_array( $values ) ) {
730 $values = [ $values ];
737 'ls_log_id' => $this->id
741 if ( count(
$rows ) ) {
742 $dbw->insert(
'log_search',
$rows, __METHOD__,
'IGNORE' );
760 $logpage = SpecialPage::getTitleFor(
'Log', $this->
getType() );
763 if (
$user->isAnon() ) {
766 if ( IP::isIPAddress(
$user->getName() ) ) {
767 $ip =
$user->getName();
771 return RecentChange::newLogEntry(
775 $formatter->getPlainActionText(),
783 $formatter->getIRCActionComment(),
784 $this->getAssociatedRevId(),
785 $this->getIsPatrollable()
795 public function publish( $newId, $to =
'rcandudp' ) {
799 \MediaWiki\Logger\LoggerFactory::getInstance(
'logging' )->warning(
800 'newId and/or revId must be set when calling ManualLogEntry::publish()',
806 'exception' =>
new RuntimeException()
812 DeferredUpdates::addCallableUpdate(
813 function ()
use ( $newId, $to, $canAddTags ) {
815 if ( !$log->isRestricted() ) {
816 Hooks::runWithoutAbort(
'ManualLogEntryBeforePublish', [ $this ] );
819 if ( $to ===
'rc' || $to ===
'rcandudp' ) {
821 $rc->addTags( $this->
getTags() );
822 $rc->save( $rc::SEND_NONE );
825 if (
$tags && $canAddTags ) {
831 $newId > 0 ? $newId :
null
836 if ( $to ===
'udp' || $to ===
'rcandudp' ) {
837 $rc->notifyRCFeeds();
841 DeferredUpdates::POSTSEND,
851 return $this->subtype;
855 return $this->parameters;
862 return $this->performer;
869 return $this->target;
879 return $this->comment;
905 return $this->isPatrollable;
913 return $this->legacy;
917 return (
int)$this->deleted;
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
unserialize( $serialized)
int $wgActorTableSchemaMigrationStage
Actor table schema migration stage.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
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.
A value class to process existing log entries.
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 new log entries and inserting 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.
addTags( $tags)
Add change tags for the log entry.
int $id
ID of the log entry.
string[] $tags
Change tags add to the log entry.
string $type
Type of log entry.
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.
setPerformer(UserIdentity $performer)
Set the user that performed the action being logged.
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.
__construct( $type, $subtype)
setTags( $tags)
Set change tags for the log entry.
setTarget(LinkTarget $target)
Set the title of the object changed.
publish( $newId, $to='rcandudp')
Publish the log entry.
getSubtype()
The log subtype.
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...
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.
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 newFromIdentity(UserIdentity $identity)
Returns a User object corresponding to the given UserIdentity.
static newFromActorId( $id)
Static factory method for creation from a given actor ID.
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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
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 $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 SCHEMA_COMPAT_WRITE_OLD
const SCHEMA_COMPAT_WRITE_NEW
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
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
this hook is for auditing only 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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
return true to allow those checks to and false if checking is done & $user
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
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.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
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