MediaWiki REL1_32
LogEntry.php
Go to the documentation of this file.
1<?php
32
38interface LogEntry {
39
45 public function getType();
46
52 public function getSubtype();
53
59 public function getFullType();
60
66 public function getParameters();
67
73 public function getPerformer();
74
80 public function getTarget();
81
87 public function getTimestamp();
88
94 public function getComment();
95
101 public function getDeleted();
102
107 public function isDeleted( $field );
108}
109
115abstract class LogEntryBase implements LogEntry {
116
117 public function getFullType() {
118 return $this->getType() . '/' . $this->getSubtype();
119 }
120
121 public function isDeleted( $field ) {
122 return ( $this->getDeleted() & $field ) === $field;
123 }
124
131 public function isLegacy() {
132 return false;
133 }
134
142 public static function makeParamBlob( $params ) {
143 return serialize( (array)$params );
144 }
145
153 public static function extractParams( $blob ) {
154 return unserialize( $blob );
155 }
156}
157
165
173 public static function getSelectQueryData() {
174 $commentQuery = CommentStore::getStore()->getJoin( 'log_comment' );
175 $actorQuery = ActorMigration::newMigration()->getJoin( 'log_user' );
176
177 $tables = array_merge(
178 [ 'logging' ], $commentQuery['tables'], $actorQuery['tables'], [ 'user' ]
179 );
180 $fields = [
181 'log_id', 'log_type', 'log_action', 'log_timestamp',
182 'log_namespace', 'log_title', // unused log_page
183 'log_params', 'log_deleted',
184 'user_id', 'user_name', 'user_editcount',
185 ] + $commentQuery['fields'] + $actorQuery['fields'];
186
187 $joins = [
188 // IPs don't have an entry in user table
189 'user' => [ 'LEFT JOIN', 'user_id=' . $actorQuery['fields']['log_user'] ],
190 ] + $commentQuery['joins'] + $actorQuery['joins'];
191
192 return [
193 'tables' => $tables,
194 'fields' => $fields,
195 'conds' => [],
196 'options' => [],
197 'join_conds' => $joins,
198 ];
199 }
200
208 public static function newFromRow( $row ) {
209 $row = (object)$row;
210 if ( isset( $row->rc_logid ) ) {
211 return new RCDatabaseLogEntry( $row );
212 } else {
213 return new self( $row );
214 }
215 }
216
224 public static function newFromId( $id, IDatabase $db ) {
225 $queryInfo = self::getSelectQueryData();
226 $queryInfo['conds'] += [ 'log_id' => $id ];
227 $row = $db->selectRow(
228 $queryInfo['tables'],
229 $queryInfo['fields'],
230 $queryInfo['conds'],
231 __METHOD__,
232 $queryInfo['options'],
233 $queryInfo['join_conds']
234 );
235 if ( !$row ) {
236 return null;
237 }
238 return self::newFromRow( $row );
239 }
240
242 protected $row;
243
245 protected $performer;
246
248 protected $params;
249
251 protected $revId = null;
252
254 protected $legacy;
255
256 protected function __construct( $row ) {
257 $this->row = $row;
258 }
259
265 public function getId() {
266 return (int)$this->row->log_id;
267 }
268
274 protected function getRawParameters() {
275 return $this->row->log_params;
276 }
277
278 public function isLegacy() {
279 // This extracts the property
280 $this->getParameters();
281 return $this->legacy;
282 }
283
284 public function getType() {
285 return $this->row->log_type;
286 }
287
288 public function getSubtype() {
289 return $this->row->log_action;
290 }
291
292 public function getParameters() {
293 if ( !isset( $this->params ) ) {
294 $blob = $this->getRawParameters();
295 Wikimedia\suppressWarnings();
297 Wikimedia\restoreWarnings();
298 if ( $params !== false ) {
299 $this->params = $params;
300 $this->legacy = false;
301 } else {
302 $this->params = LogPage::extractParams( $blob );
303 $this->legacy = true;
304 }
305
306 if ( isset( $this->params['associated_rev_id'] ) ) {
307 $this->revId = $this->params['associated_rev_id'];
308 unset( $this->params['associated_rev_id'] );
309 }
310 }
311
312 return $this->params;
313 }
314
315 public function getAssociatedRevId() {
316 // This extracts the property
317 $this->getParameters();
318 return $this->revId;
319 }
320
321 public function getPerformer() {
322 if ( !$this->performer ) {
323 $actorId = isset( $this->row->log_actor ) ? (int)$this->row->log_actor : 0;
324 $userId = (int)$this->row->log_user;
325 if ( $userId !== 0 || $actorId !== 0 ) {
326 // logged-in users
327 if ( isset( $this->row->user_name ) ) {
328 $this->performer = User::newFromRow( $this->row );
329 } elseif ( $actorId !== 0 ) {
330 $this->performer = User::newFromActorId( $actorId );
331 } else {
332 $this->performer = User::newFromId( $userId );
333 }
334 } else {
335 // IP users
336 $userText = $this->row->log_user_text;
337 $this->performer = User::newFromName( $userText, false );
338 }
339 }
340
341 return $this->performer;
342 }
343
344 public function getTarget() {
345 $namespace = $this->row->log_namespace;
346 $page = $this->row->log_title;
347 $title = Title::makeTitle( $namespace, $page );
348
349 return $title;
350 }
351
352 public function getTimestamp() {
353 return wfTimestamp( TS_MW, $this->row->log_timestamp );
354 }
355
356 public function getComment() {
357 return CommentStore::getStore()->getComment( 'log_comment', $this->row )->text;
358 }
359
360 public function getDeleted() {
361 return $this->row->log_deleted;
362 }
363}
364
370
371 public function getId() {
372 return $this->row->rc_logid;
373 }
374
375 protected function getRawParameters() {
376 return $this->row->rc_params;
377 }
378
379 public function getAssociatedRevId() {
380 return $this->row->rc_this_oldid;
381 }
382
383 public function getType() {
384 return $this->row->rc_log_type;
385 }
386
387 public function getSubtype() {
388 return $this->row->rc_log_action;
389 }
390
391 public function getPerformer() {
392 if ( !$this->performer ) {
393 $actorId = isset( $this->row->rc_actor ) ? (int)$this->row->rc_actor : 0;
394 $userId = (int)$this->row->rc_user;
395 if ( $actorId !== 0 ) {
396 $this->performer = User::newFromActorId( $actorId );
397 } elseif ( $userId !== 0 ) {
398 $this->performer = User::newFromId( $userId );
399 } else {
400 $userText = $this->row->rc_user_text;
401 // Might be an IP, don't validate the username
402 $this->performer = User::newFromName( $userText, false );
403 }
404 }
405
406 return $this->performer;
407 }
408
409 public function getTarget() {
410 $namespace = $this->row->rc_namespace;
411 $page = $this->row->rc_title;
412 $title = Title::makeTitle( $namespace, $page );
413
414 return $title;
415 }
416
417 public function getTimestamp() {
418 return wfTimestamp( TS_MW, $this->row->rc_timestamp );
419 }
420
421 public function getComment() {
422 return CommentStore::getStore()
423 // Legacy because the row may have used RecentChange::selectFields()
424 ->getCommentLegacy( wfGetDB( DB_REPLICA ), 'rc_comment', $this->row )->text;
425 }
426
427 public function getDeleted() {
428 return $this->row->rc_deleted;
429 }
430}
431
439 protected $type;
440
442 protected $subtype;
443
445 protected $parameters = [];
446
448 protected $relations = [];
449
451 protected $performer;
452
454 protected $target;
455
457 protected $timestamp;
458
460 protected $comment = '';
461
463 protected $revId = 0;
464
466 protected $tags = null;
467
469 protected $deleted;
470
472 protected $id;
473
475 protected $isPatrollable = false;
476
478 protected $legacy = false;
479
485 public function __construct( $type, $subtype ) {
486 $this->type = $type;
487 $this->subtype = $subtype;
488 }
489
511 public function setParameters( $parameters ) {
512 $this->parameters = $parameters;
513 }
514
522 public function setRelations( array $relations ) {
523 $this->relations = $relations;
524 }
525
532 public function setPerformer( User $performer ) {
533 $this->performer = $performer;
534 }
535
542 public function setTarget( Title $target ) {
543 $this->target = $target;
544 }
545
552 public function setTimestamp( $timestamp ) {
553 $this->timestamp = $timestamp;
554 }
555
562 public function setComment( $comment ) {
563 $this->comment = $comment;
564 }
565
575 public function setAssociatedRevId( $revId ) {
576 $this->revId = $revId;
577 }
578
585 public function setTags( $tags ) {
586 if ( is_string( $tags ) ) {
587 $tags = [ $tags ];
588 }
589 $this->tags = $tags;
590 }
591
601 public function setIsPatrollable( $patrollable ) {
602 $this->isPatrollable = (bool)$patrollable;
603 }
604
611 public function setLegacy( $legacy ) {
612 $this->legacy = $legacy;
613 }
614
621 public function setDeleted( $deleted ) {
622 $this->deleted = $deleted;
623 }
624
632 public function insert( IDatabase $dbw = null ) {
634
635 $dbw = $dbw ?: wfGetDB( DB_MASTER );
636
637 if ( $this->timestamp === null ) {
638 $this->timestamp = wfTimestampNow();
639 }
640
641 // Trim spaces on user supplied text
642 $comment = trim( $this->getComment() );
643
644 $params = $this->getParameters();
645 $relations = $this->relations;
646
647 // Ensure actor relations are set
649 empty( $relations['target_author_actor'] )
650 ) {
651 $actorIds = [];
652 if ( !empty( $relations['target_author_id'] ) ) {
653 foreach ( $relations['target_author_id'] as $id ) {
654 $actorIds[] = User::newFromId( $id )->getActorId( $dbw );
655 }
656 }
657 if ( !empty( $relations['target_author_ip'] ) ) {
658 foreach ( $relations['target_author_ip'] as $ip ) {
659 $actorIds[] = User::newFromName( $ip, false )->getActorId( $dbw );
660 }
661 }
662 if ( $actorIds ) {
663 $relations['target_author_actor'] = $actorIds;
664 $params['authorActors'] = $actorIds;
665 }
666 }
668 unset( $relations['target_author_id'], $relations['target_author_ip'] );
669 unset( $params['authorIds'], $params['authorIPs'] );
670 }
671
672 // Additional fields for which there's no space in the database table schema
673 $revId = $this->getAssociatedRevId();
674 if ( $revId ) {
675 $params['associated_rev_id'] = $revId;
676 $relations['associated_rev_id'] = $revId;
677 }
678
679 $data = [
680 'log_type' => $this->getType(),
681 'log_action' => $this->getSubtype(),
682 'log_timestamp' => $dbw->timestamp( $this->getTimestamp() ),
683 'log_namespace' => $this->getTarget()->getNamespace(),
684 'log_title' => $this->getTarget()->getDBkey(),
685 'log_page' => $this->getTarget()->getArticleID(),
686 'log_params' => LogEntryBase::makeParamBlob( $params ),
687 ];
688 if ( isset( $this->deleted ) ) {
689 $data['log_deleted'] = $this->deleted;
690 }
691 $data += CommentStore::getStore()->insert( $dbw, 'log_comment', $comment );
692 $data += ActorMigration::newMigration()
693 ->getInsertValues( $dbw, 'log_user', $this->getPerformer() );
694
695 $dbw->insert( 'logging', $data, __METHOD__ );
696 $this->id = $dbw->insertId();
697
698 $rows = [];
699 foreach ( $relations as $tag => $values ) {
700 if ( !strlen( $tag ) ) {
701 throw new MWException( "Got empty log search tag." );
702 }
703
704 if ( !is_array( $values ) ) {
705 $values = [ $values ];
706 }
707
708 foreach ( $values as $value ) {
709 $rows[] = [
710 'ls_field' => $tag,
711 'ls_value' => $value,
712 'ls_log_id' => $this->id
713 ];
714 }
715 }
716 if ( count( $rows ) ) {
717 $dbw->insert( 'log_search', $rows, __METHOD__, 'IGNORE' );
718 }
719
720 return $this->id;
721 }
722
730 public function getRecentChange( $newId = 0 ) {
731 $formatter = LogFormatter::newFromEntry( $this );
732 $context = RequestContext::newExtraneousContext( $this->getTarget() );
733 $formatter->setContext( $context );
734
735 $logpage = SpecialPage::getTitleFor( 'Log', $this->getType() );
736 $user = $this->getPerformer();
737 $ip = "";
738 if ( $user->isAnon() ) {
739 // "MediaWiki default" and friends may have
740 // no IP address in their name
741 if ( IP::isIPAddress( $user->getName() ) ) {
742 $ip = $user->getName();
743 }
744 }
745
746 return RecentChange::newLogEntry(
747 $this->getTimestamp(),
748 $logpage,
749 $user,
750 $formatter->getPlainActionText(),
751 $ip,
752 $this->getType(),
753 $this->getSubtype(),
754 $this->getTarget(),
755 $this->getComment(),
756 LogEntryBase::makeParamBlob( $this->getParameters() ),
757 $newId,
758 $formatter->getIRCActionComment(), // Used for IRC feeds
759 $this->getAssociatedRevId(), // Used for e.g. moves and uploads
760 $this->getIsPatrollable()
761 );
762 }
763
770 public function publish( $newId, $to = 'rcandudp' ) {
771 DeferredUpdates::addCallableUpdate(
772 function () use ( $newId, $to ) {
773 $log = new LogPage( $this->getType() );
774 if ( !$log->isRestricted() ) {
775 $rc = $this->getRecentChange( $newId );
776
777 if ( $to === 'rc' || $to === 'rcandudp' ) {
778 // save RC, passing tags so they are applied there
779 $tags = $this->getTags();
780 if ( is_null( $tags ) ) {
781 $tags = [];
782 }
783 $rc->addTags( $tags );
784 $rc->save( $rc::SEND_NONE );
785 }
786
787 if ( $to === 'udp' || $to === 'rcandudp' ) {
788 $rc->notifyRCFeeds();
789 }
790 }
791 },
792 DeferredUpdates::POSTSEND,
794 );
795 }
796
797 public function getType() {
798 return $this->type;
799 }
800
801 public function getSubtype() {
802 return $this->subtype;
803 }
804
805 public function getParameters() {
806 return $this->parameters;
807 }
808
812 public function getPerformer() {
813 return $this->performer;
814 }
815
819 public function getTarget() {
820 return $this->target;
821 }
822
823 public function getTimestamp() {
824 $ts = $this->timestamp ?? wfTimestampNow();
825
826 return wfTimestamp( TS_MW, $ts );
827 }
828
829 public function getComment() {
830 return $this->comment;
831 }
832
837 public function getAssociatedRevId() {
838 return $this->revId;
839 }
840
845 public function getTags() {
846 return $this->tags;
847 }
848
855 public function getIsPatrollable() {
856 return $this->isPatrollable;
857 }
858
863 public function isLegacy() {
864 return $this->legacy;
865 }
866
867 public function getDeleted() {
868 return (int)$this->deleted;
869 }
870}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
serialize()
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.
A value class to process existing log entries.
Definition LogEntry.php:164
getParameters()
Get the extra parameters stored for this message.
Definition LogEntry.php:292
isLegacy()
Whether the parameters for this log are stored in new or old format.
Definition LogEntry.php:278
array $params
Parameters for log entry.
Definition LogEntry.php:248
getSubtype()
The log subtype.
Definition LogEntry.php:288
getDeleted()
Get the access restriction.
Definition LogEntry.php:360
static newFromRow( $row)
Constructs new LogEntry from database result row.
Definition LogEntry.php:208
getComment()
Get the user provided comment.
Definition LogEntry.php:356
bool $legacy
Whether the parameters for this log entry are stored in new or old format.
Definition LogEntry.php:254
int $revId
A rev id associated to the log entry.
Definition LogEntry.php:251
getRawParameters()
Returns whatever is stored in the database field.
Definition LogEntry.php:274
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
Definition LogEntry.php:173
stdClass $row
Database result row.
Definition LogEntry.php:242
getId()
Returns the unique database id.
Definition LogEntry.php:265
getPerformer()
Get the user for performed this action.
Definition LogEntry.php:321
getTarget()
Get the target page of this action.
Definition LogEntry.php:344
getType()
The main log type.
Definition LogEntry.php:284
static newFromId( $id, IDatabase $db)
Loads a LogEntry with the given id from database.
Definition LogEntry.php:224
getTimestamp()
Get the timestamp when the action was executed.
Definition LogEntry.php:352
Extends the LogEntryInterface with some basic functionality.
Definition LogEntry.php:115
isDeleted( $field)
Definition LogEntry.php:121
isLegacy()
Whether the parameters for this log are stored in new or old format.
Definition LogEntry.php:131
static extractParams( $blob)
Extract a parameter array from a blob.
Definition LogEntry.php:153
static makeParamBlob( $params)
Create a blob from a parameter array.
Definition LogEntry.php:142
getFullType()
The full logtype in format maintype/subtype.
Definition LogEntry.php:117
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
Class to simplify the use of log pages.
Definition LogPage.php:33
static extractParams( $blob)
Extract a parameter array from a blob.
Definition LogPage.php:423
MediaWiki exception.
Class for creating new log entries and inserting them into the database.
Definition LogEntry.php:437
getDeleted()
Get the access restriction.
Definition LogEntry.php:867
getIsPatrollable()
Whether this log entry is patrollable.
Definition LogEntry.php:855
setDeleted( $deleted)
Set the 'deleted' flag.
Definition LogEntry.php:621
string $subtype
Sub type of log entry.
Definition LogEntry.php:442
int $id
ID of the log entry.
Definition LogEntry.php:472
string $type
Type of log entry.
Definition LogEntry.php:439
setTarget(Title $target)
Set the title of the object changed.
Definition LogEntry.php:542
setAssociatedRevId( $revId)
Set an associated revision id.
Definition LogEntry.php:575
insert(IDatabase $dbw=null)
Insert the entry into the logging table.
Definition LogEntry.php:632
string $comment
Comment for the log entry.
Definition LogEntry.php:460
setTimestamp( $timestamp)
Set the timestamp of when the logged action took place.
Definition LogEntry.php:552
array $parameters
Parameters for log entry.
Definition LogEntry.php:445
getTimestamp()
Get the timestamp when the action was executed.
Definition LogEntry.php:823
int $revId
A rev id associated to the log entry.
Definition LogEntry.php:463
setComment( $comment)
Set a comment associated with the action being logged.
Definition LogEntry.php:562
setParameters( $parameters)
Set extra log parameters.
Definition LogEntry.php:511
getComment()
Get the user provided comment.
Definition LogEntry.php:829
bool $isPatrollable
Can this log entry be patrolled?
Definition LogEntry.php:475
getType()
The main log type.
Definition LogEntry.php:797
Title $target
Target title for the log entry.
Definition LogEntry.php:454
int $deleted
Deletion state of the log entry.
Definition LogEntry.php:469
setLegacy( $legacy)
Set the 'legacy' flag.
Definition LogEntry.php:611
setIsPatrollable( $patrollable)
Set whether this log entry should be made patrollable This shouldn't depend on config,...
Definition LogEntry.php:601
getParameters()
Get the extra parameters stored for this message.
Definition LogEntry.php:805
bool $legacy
Whether this is a legacy log entry.
Definition LogEntry.php:478
string $timestamp
Timestamp of creation of the log entry.
Definition LogEntry.php:457
getRecentChange( $newId=0)
Get a RecentChanges object for the log entry.
Definition LogEntry.php:730
User $performer
Performer of the action for the log entry.
Definition LogEntry.php:451
setRelations(array $relations)
Declare arbitrary tag/value relations to this log entry.
Definition LogEntry.php:522
setPerformer(User $performer)
Set the user that performed the action being logged.
Definition LogEntry.php:532
__construct( $type, $subtype)
Definition LogEntry.php:485
setTags( $tags)
Set change tags for the log entry.
Definition LogEntry.php:585
array $tags
Change tags add to the log entry.
Definition LogEntry.php:466
publish( $newId, $to='rcandudp')
Publish the log entry.
Definition LogEntry.php:770
getSubtype()
The log subtype.
Definition LogEntry.php:801
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...
Definition LogEntry.php:369
getTimestamp()
Get the timestamp when the action was executed.
Definition LogEntry.php:417
getTarget()
Get the target page of this action.
Definition LogEntry.php:409
getSubtype()
The log subtype.
Definition LogEntry.php:387
getComment()
Get the user provided comment.
Definition LogEntry.php:421
getDeleted()
Get the access restriction.
Definition LogEntry.php:427
getRawParameters()
Returns whatever is stored in the database field.
Definition LogEntry.php:375
getId()
Returns the unique database id.
Definition LogEntry.php:371
getPerformer()
Get the user for performed this action.
Definition LogEntry.php:391
getType()
The main log type.
Definition LogEntry.php:383
Represents a title within MediaWiki.
Definition Title.php:39
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:47
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition User.php:592
static newFromRow( $row, $data=null)
Create a new user object from a user row.
Definition User.php:778
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition User.php:615
static newFromActorId( $id)
Static factory method for creation from a given actor ID.
Definition User.php:630
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 $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
Definition globals.txt:62
const SCHEMA_COMPAT_WRITE_OLD
Definition Defines.php:284
const SCHEMA_COMPAT_WRITE_NEW
Definition Defines.php:286
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
Definition hooks.txt:2857
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
Definition hooks.txt:2885
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:994
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
Definition hooks.txt:1035
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
Definition hooks.txt:247
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
Definition injection.txt:37
Interface for log entries.
Definition LogEntry.php:38
isDeleted( $field)
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.
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
selectRow( $table, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[])
Single row SELECT wrapper.
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 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
Definition postgres.txt:36
const DB_REPLICA
Definition defines.php:25
const DB_MASTER
Definition defines.php:26
$params