MediaWiki REL1_33
LogEntry.php
Go to the documentation of this file.
1<?php
36
42interface LogEntry {
43
49 public function getType();
50
56 public function getSubtype();
57
63 public function getFullType();
64
70 public function getParameters();
71
77 public function getPerformer();
78
84 public function getTarget();
85
91 public function getTimestamp();
92
98 public function getComment();
99
105 public function getDeleted();
106
111 public function isDeleted( $field );
112}
113
119abstract class LogEntryBase implements LogEntry {
120
121 public function getFullType() {
122 return $this->getType() . '/' . $this->getSubtype();
123 }
124
125 public function isDeleted( $field ) {
126 return ( $this->getDeleted() & $field ) === $field;
127 }
128
135 public function isLegacy() {
136 return false;
137 }
138
146 public static function makeParamBlob( $params ) {
147 return serialize( (array)$params );
148 }
149
157 public static function extractParams( $blob ) {
158 return unserialize( $blob );
159 }
160}
161
169
177 public static function getSelectQueryData() {
178 $commentQuery = CommentStore::getStore()->getJoin( 'log_comment' );
179 $actorQuery = ActorMigration::newMigration()->getJoin( 'log_user' );
180
182 [ 'logging' ], $commentQuery['tables'], $actorQuery['tables'], [ 'user' ]
183 );
184 $fields = [
185 'log_id', 'log_type', 'log_action', 'log_timestamp',
186 'log_namespace', 'log_title', // unused log_page
187 'log_params', 'log_deleted',
188 'user_id', 'user_name', 'user_editcount',
189 ] + $commentQuery['fields'] + $actorQuery['fields'];
190
191 $joins = [
192 // IPs don't have an entry in user table
193 'user' => [ 'LEFT JOIN', 'user_id=' . $actorQuery['fields']['log_user'] ],
194 ] + $commentQuery['joins'] + $actorQuery['joins'];
195
196 return [
197 'tables' => $tables,
198 'fields' => $fields,
199 'conds' => [],
200 'options' => [],
201 'join_conds' => $joins,
202 ];
203 }
204
212 public static function newFromRow( $row ) {
213 $row = (object)$row;
214 if ( isset( $row->rc_logid ) ) {
215 return new RCDatabaseLogEntry( $row );
216 } else {
217 return new self( $row );
218 }
219 }
220
228 public static function newFromId( $id, IDatabase $db ) {
229 $queryInfo = self::getSelectQueryData();
230 $queryInfo['conds'] += [ 'log_id' => $id ];
231 $row = $db->selectRow(
232 $queryInfo['tables'],
233 $queryInfo['fields'],
234 $queryInfo['conds'],
235 __METHOD__,
236 $queryInfo['options'],
237 $queryInfo['join_conds']
238 );
239 if ( !$row ) {
240 return null;
241 }
242 return self::newFromRow( $row );
243 }
244
246 protected $row;
247
249 protected $performer;
250
252 protected $params;
253
255 protected $revId = null;
256
258 protected $legacy;
259
260 protected function __construct( $row ) {
261 $this->row = $row;
262 }
263
269 public function getId() {
270 return (int)$this->row->log_id;
271 }
272
278 protected function getRawParameters() {
279 return $this->row->log_params;
280 }
281
282 public function isLegacy() {
283 // This extracts the property
284 $this->getParameters();
285 return $this->legacy;
286 }
287
288 public function getType() {
289 return $this->row->log_type;
290 }
291
292 public function getSubtype() {
293 return $this->row->log_action;
294 }
295
296 public function getParameters() {
297 if ( !isset( $this->params ) ) {
298 $blob = $this->getRawParameters();
302 if ( $params !== false ) {
303 $this->params = $params;
304 $this->legacy = false;
305 } else {
306 $this->params = LogPage::extractParams( $blob );
307 $this->legacy = true;
308 }
309
310 if ( isset( $this->params['associated_rev_id'] ) ) {
311 $this->revId = $this->params['associated_rev_id'];
312 unset( $this->params['associated_rev_id'] );
313 }
314 }
315
316 return $this->params;
317 }
318
319 public function getAssociatedRevId() {
320 // This extracts the property
321 $this->getParameters();
322 return $this->revId;
323 }
324
325 public function getPerformer() {
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 ) {
330 // logged-in users
331 if ( isset( $this->row->user_name ) ) {
332 $this->performer = User::newFromRow( $this->row );
333 } elseif ( $actorId !== 0 ) {
334 $this->performer = User::newFromActorId( $actorId );
335 } else {
336 $this->performer = User::newFromId( $userId );
337 }
338 } else {
339 // IP users
340 $userText = $this->row->log_user_text;
341 $this->performer = User::newFromName( $userText, false );
342 }
343 }
344
345 return $this->performer;
346 }
347
348 public function getTarget() {
349 $namespace = $this->row->log_namespace;
350 $page = $this->row->log_title;
351 $title = Title::makeTitle( $namespace, $page );
352
353 return $title;
354 }
355
356 public function getTimestamp() {
357 return wfTimestamp( TS_MW, $this->row->log_timestamp );
358 }
359
360 public function getComment() {
361 return CommentStore::getStore()->getComment( 'log_comment', $this->row )->text;
362 }
363
364 public function getDeleted() {
365 return $this->row->log_deleted;
366 }
367}
368
374
375 public function getId() {
376 return $this->row->rc_logid;
377 }
378
379 protected function getRawParameters() {
380 return $this->row->rc_params;
381 }
382
383 public function getAssociatedRevId() {
384 return $this->row->rc_this_oldid;
385 }
386
387 public function getType() {
388 return $this->row->rc_log_type;
389 }
390
391 public function getSubtype() {
392 return $this->row->rc_log_action;
393 }
394
395 public function getPerformer() {
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 ) {
400 $this->performer = User::newFromActorId( $actorId );
401 } elseif ( $userId !== 0 ) {
402 $this->performer = User::newFromId( $userId );
403 } else {
404 $userText = $this->row->rc_user_text;
405 // Might be an IP, don't validate the username
406 $this->performer = User::newFromName( $userText, false );
407 }
408 }
409
410 return $this->performer;
411 }
412
413 public function getTarget() {
414 $namespace = $this->row->rc_namespace;
415 $page = $this->row->rc_title;
416 $title = Title::makeTitle( $namespace, $page );
417
418 return $title;
419 }
420
421 public function getTimestamp() {
422 return wfTimestamp( TS_MW, $this->row->rc_timestamp );
423 }
424
425 public function getComment() {
426 return CommentStore::getStore()
427 // Legacy because the row may have used RecentChange::selectFields()
428 ->getCommentLegacy( wfGetDB( DB_REPLICA ), 'rc_comment', $this->row )->text;
429 }
430
431 public function getDeleted() {
432 return $this->row->rc_deleted;
433 }
434}
435
441class ManualLogEntry extends LogEntryBase implements Taggable {
443 protected $type;
444
446 protected $subtype;
447
449 protected $parameters = [];
450
452 protected $relations = [];
453
455 protected $performer;
456
458 protected $target;
459
461 protected $timestamp;
462
464 protected $comment = '';
465
467 protected $revId = 0;
468
470 protected $tags = [];
471
473 protected $deleted;
474
476 protected $id;
477
479 protected $isPatrollable = false;
480
482 protected $legacy = false;
483
489 public function __construct( $type, $subtype ) {
490 $this->type = $type;
491 $this->subtype = $subtype;
492 }
493
515 public function setParameters( $parameters ) {
516 $this->parameters = $parameters;
517 }
518
526 public function setRelations( array $relations ) {
527 $this->relations = $relations;
528 }
529
536 public function setPerformer( UserIdentity $performer ) {
537 $this->performer = User::newFromIdentity( $performer );
538 }
539
546 public function setTarget( LinkTarget $target ) {
547 $this->target = Title::newFromLinkTarget( $target );
548 }
549
556 public function setTimestamp( $timestamp ) {
557 $this->timestamp = $timestamp;
558 }
559
566 public function setComment( $comment ) {
567 $this->comment = $comment;
568 }
569
579 public function setAssociatedRevId( $revId ) {
580 $this->revId = $revId;
581 }
582
593 public function setTags( $tags ) {
594 if ( $this->tags ) {
595 wfDebug( 'Overwriting existing ManualLogEntry tags' );
596 }
597 $this->tags = [];
598 if ( $tags !== null ) {
599 $this->addTags( $tags );
600 }
601 }
602
609 public function addTags( $tags ) {
610 if ( is_string( $tags ) ) {
611 $tags = [ $tags ];
612 }
613 Assert::parameterElementType( 'string', $tags, 'tags' );
614 $this->tags = array_unique( array_merge( $this->tags, $tags ) );
615 }
616
626 public function setIsPatrollable( $patrollable ) {
627 $this->isPatrollable = (bool)$patrollable;
628 }
629
636 public function setLegacy( $legacy ) {
637 $this->legacy = $legacy;
638 }
639
646 public function setDeleted( $deleted ) {
647 $this->deleted = $deleted;
648 }
649
657 public function insert( IDatabase $dbw = null ) {
659
660 $dbw = $dbw ?: wfGetDB( DB_MASTER );
661
662 if ( $this->timestamp === null ) {
663 $this->timestamp = wfTimestampNow();
664 }
665
666 // Trim spaces on user supplied text
667 $comment = trim( $this->getComment() );
668
669 $params = $this->getParameters();
670 $relations = $this->relations;
671
672 // Ensure actor relations are set
674 empty( $relations['target_author_actor'] )
675 ) {
676 $actorIds = [];
677 if ( !empty( $relations['target_author_id'] ) ) {
678 foreach ( $relations['target_author_id'] as $id ) {
679 $actorIds[] = User::newFromId( $id )->getActorId( $dbw );
680 }
681 }
682 if ( !empty( $relations['target_author_ip'] ) ) {
683 foreach ( $relations['target_author_ip'] as $ip ) {
684 $actorIds[] = User::newFromName( $ip, false )->getActorId( $dbw );
685 }
686 }
687 if ( $actorIds ) {
688 $relations['target_author_actor'] = $actorIds;
689 $params['authorActors'] = $actorIds;
690 }
691 }
693 unset( $relations['target_author_id'], $relations['target_author_ip'] );
694 unset( $params['authorIds'], $params['authorIPs'] );
695 }
696
697 // Additional fields for which there's no space in the database table schema
698 $revId = $this->getAssociatedRevId();
699 if ( $revId ) {
700 $params['associated_rev_id'] = $revId;
701 $relations['associated_rev_id'] = $revId;
702 }
703
704 $data = [
705 'log_type' => $this->getType(),
706 'log_action' => $this->getSubtype(),
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(),
711 'log_params' => LogEntryBase::makeParamBlob( $params ),
712 ];
713 if ( isset( $this->deleted ) ) {
714 $data['log_deleted'] = $this->deleted;
715 }
716 $data += CommentStore::getStore()->insert( $dbw, 'log_comment', $comment );
717 $data += ActorMigration::newMigration()
718 ->getInsertValues( $dbw, 'log_user', $this->getPerformer() );
719
720 $dbw->insert( 'logging', $data, __METHOD__ );
721 $this->id = $dbw->insertId();
722
723 $rows = [];
724 foreach ( $relations as $tag => $values ) {
725 if ( !strlen( $tag ) ) {
726 throw new MWException( "Got empty log search tag." );
727 }
728
729 if ( !is_array( $values ) ) {
730 $values = [ $values ];
731 }
732
733 foreach ( $values as $value ) {
734 $rows[] = [
735 'ls_field' => $tag,
736 'ls_value' => $value,
737 'ls_log_id' => $this->id
738 ];
739 }
740 }
741 if ( count( $rows ) ) {
742 $dbw->insert( 'log_search', $rows, __METHOD__, 'IGNORE' );
743 }
744
745 return $this->id;
746 }
747
755 public function getRecentChange( $newId = 0 ) {
756 $formatter = LogFormatter::newFromEntry( $this );
757 $context = RequestContext::newExtraneousContext( $this->getTarget() );
758 $formatter->setContext( $context );
759
760 $logpage = SpecialPage::getTitleFor( 'Log', $this->getType() );
761 $user = $this->getPerformer();
762 $ip = "";
763 if ( $user->isAnon() ) {
764 // "MediaWiki default" and friends may have
765 // no IP address in their name
766 if ( IP::isIPAddress( $user->getName() ) ) {
767 $ip = $user->getName();
768 }
769 }
770
771 return RecentChange::newLogEntry(
772 $this->getTimestamp(),
773 $logpage,
774 $user,
775 $formatter->getPlainActionText(),
776 $ip,
777 $this->getType(),
778 $this->getSubtype(),
779 $this->getTarget(),
780 $this->getComment(),
781 LogEntryBase::makeParamBlob( $this->getParameters() ),
782 $newId,
783 $formatter->getIRCActionComment(), // Used for IRC feeds
784 $this->getAssociatedRevId(), // Used for e.g. moves and uploads
785 $this->getIsPatrollable()
786 );
787 }
788
795 public function publish( $newId, $to = 'rcandudp' ) {
796 $canAddTags = true;
797 // FIXME: this code should be removed once all callers properly call publish()
798 if ( $to === 'udp' && !$newId && !$this->getAssociatedRevId() ) {
799 \MediaWiki\Logger\LoggerFactory::getInstance( 'logging' )->warning(
800 'newId and/or revId must be set when calling ManualLogEntry::publish()',
801 [
802 'newId' => $newId,
803 'to' => $to,
804 'revId' => $this->getAssociatedRevId(),
805 // pass a new exception to register the stack trace
806 'exception' => new RuntimeException()
807 ]
808 );
809 $canAddTags = false;
810 }
811
812 DeferredUpdates::addCallableUpdate(
813 function () use ( $newId, $to, $canAddTags ) {
814 $log = new LogPage( $this->getType() );
815 if ( !$log->isRestricted() ) {
816 Hooks::runWithoutAbort( 'ManualLogEntryBeforePublish', [ $this ] );
817 $rc = $this->getRecentChange( $newId );
818
819 if ( $to === 'rc' || $to === 'rcandudp' ) {
820 // save RC, passing tags so they are applied there
821 $rc->addTags( $this->getTags() );
822 $rc->save( $rc::SEND_NONE );
823 } else {
824 $tags = $this->getTags();
825 if ( $tags && $canAddTags ) {
826 $revId = $this->getAssociatedRevId();
828 $tags,
829 null,
830 $revId > 0 ? $revId : null,
831 $newId > 0 ? $newId : null
832 );
833 }
834 }
835
836 if ( $to === 'udp' || $to === 'rcandudp' ) {
837 $rc->notifyRCFeeds();
838 }
839 }
840 },
841 DeferredUpdates::POSTSEND,
843 );
844 }
845
846 public function getType() {
847 return $this->type;
848 }
849
850 public function getSubtype() {
851 return $this->subtype;
852 }
853
854 public function getParameters() {
855 return $this->parameters;
856 }
857
861 public function getPerformer() {
862 return $this->performer;
863 }
864
868 public function getTarget() {
869 return $this->target;
870 }
871
872 public function getTimestamp() {
873 $ts = $this->timestamp ?? wfTimestampNow();
874
875 return wfTimestamp( TS_MW, $ts );
876 }
877
878 public function getComment() {
879 return $this->comment;
880 }
881
886 public function getAssociatedRevId() {
887 return $this->revId;
888 }
889
894 public function getTags() {
895 return $this->tags;
896 }
897
904 public function getIsPatrollable() {
905 return $this->isPatrollable;
906 }
907
912 public function isLegacy() {
913 return $this->legacy;
914 }
915
916 public function getDeleted() {
917 return (int)$this->deleted;
918 }
919}
serialize()
unserialize( $serialized)
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
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.
static addTags( $tags, $rc_id=null, $rev_id=null, $log_id=null, $params=null, RecentChange $rc=null)
Add tags to a change given its rc_id, rev_id and/or log_id.
A value class to process existing log entries.
Definition LogEntry.php:168
getParameters()
Get the extra parameters stored for this message.
Definition LogEntry.php:296
isLegacy()
Whether the parameters for this log are stored in new or old format.
Definition LogEntry.php:282
array $params
Parameters for log entry.
Definition LogEntry.php:252
getSubtype()
The log subtype.
Definition LogEntry.php:292
getDeleted()
Get the access restriction.
Definition LogEntry.php:364
static newFromRow( $row)
Constructs new LogEntry from database result row.
Definition LogEntry.php:212
getComment()
Get the user provided comment.
Definition LogEntry.php:360
bool $legacy
Whether the parameters for this log entry are stored in new or old format.
Definition LogEntry.php:258
int $revId
A rev id associated to the log entry.
Definition LogEntry.php:255
getRawParameters()
Returns whatever is stored in the database field.
Definition LogEntry.php:278
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
Definition LogEntry.php:177
stdClass $row
Database result row.
Definition LogEntry.php:246
getId()
Returns the unique database id.
Definition LogEntry.php:269
getPerformer()
Get the user for performed this action.
Definition LogEntry.php:325
getTarget()
Get the target page of this action.
Definition LogEntry.php:348
getType()
The main log type.
Definition LogEntry.php:288
static newFromId( $id, IDatabase $db)
Loads a LogEntry with the given id from database.
Definition LogEntry.php:228
getTimestamp()
Get the timestamp when the action was executed.
Definition LogEntry.php:356
Extends the LogEntryInterface with some basic functionality.
Definition LogEntry.php:119
isDeleted( $field)
Definition LogEntry.php:125
isLegacy()
Whether the parameters for this log are stored in new or old format.
Definition LogEntry.php:135
static extractParams( $blob)
Extract a parameter array from a blob.
Definition LogEntry.php:157
static makeParamBlob( $params)
Create a blob from a parameter array.
Definition LogEntry.php:146
getFullType()
The full logtype in format maintype/subtype.
Definition LogEntry.php:121
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:441
getDeleted()
Get the access restriction.
Definition LogEntry.php:916
getIsPatrollable()
Whether this log entry is patrollable.
Definition LogEntry.php:904
setDeleted( $deleted)
Set the 'deleted' flag.
Definition LogEntry.php:646
string $subtype
Sub type of log entry.
Definition LogEntry.php:446
addTags( $tags)
Add change tags for the log entry.
Definition LogEntry.php:609
int $id
ID of the log entry.
Definition LogEntry.php:476
string[] $tags
Change tags add to the log entry.
Definition LogEntry.php:470
string $type
Type of log entry.
Definition LogEntry.php:443
setAssociatedRevId( $revId)
Set an associated revision id.
Definition LogEntry.php:579
insert(IDatabase $dbw=null)
Insert the entry into the logging table.
Definition LogEntry.php:657
string $comment
Comment for the log entry.
Definition LogEntry.php:464
setTimestamp( $timestamp)
Set the timestamp of when the logged action took place.
Definition LogEntry.php:556
array $parameters
Parameters for log entry.
Definition LogEntry.php:449
getTimestamp()
Get the timestamp when the action was executed.
Definition LogEntry.php:872
int $revId
A rev id associated to the log entry.
Definition LogEntry.php:467
setComment( $comment)
Set a comment associated with the action being logged.
Definition LogEntry.php:566
setParameters( $parameters)
Set extra log parameters.
Definition LogEntry.php:515
getComment()
Get the user provided comment.
Definition LogEntry.php:878
bool $isPatrollable
Can this log entry be patrolled?
Definition LogEntry.php:479
getType()
The main log type.
Definition LogEntry.php:846
Title $target
Target title for the log entry.
Definition LogEntry.php:458
int $deleted
Deletion state of the log entry.
Definition LogEntry.php:473
setLegacy( $legacy)
Set the 'legacy' flag.
Definition LogEntry.php:636
setIsPatrollable( $patrollable)
Set whether this log entry should be made patrollable This shouldn't depend on config,...
Definition LogEntry.php:626
getParameters()
Get the extra parameters stored for this message.
Definition LogEntry.php:854
bool $legacy
Whether this is a legacy log entry.
Definition LogEntry.php:482
string $timestamp
Timestamp of creation of the log entry.
Definition LogEntry.php:461
setPerformer(UserIdentity $performer)
Set the user that performed the action being logged.
Definition LogEntry.php:536
getRecentChange( $newId=0)
Get a RecentChanges object for the log entry.
Definition LogEntry.php:755
User $performer
Performer of the action for the log entry.
Definition LogEntry.php:455
setRelations(array $relations)
Declare arbitrary tag/value relations to this log entry.
Definition LogEntry.php:526
__construct( $type, $subtype)
Definition LogEntry.php:489
setTags( $tags)
Set change tags for the log entry.
Definition LogEntry.php:593
setTarget(LinkTarget $target)
Set the title of the object changed.
Definition LogEntry.php:546
publish( $newId, $to='rcandudp')
Publish the log entry.
Definition LogEntry.php:795
getSubtype()
The log subtype.
Definition LogEntry.php:850
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...
Definition LogEntry.php:373
getTimestamp()
Get the timestamp when the action was executed.
Definition LogEntry.php:421
getTarget()
Get the target page of this action.
Definition LogEntry.php:413
getSubtype()
The log subtype.
Definition LogEntry.php:391
getComment()
Get the user provided comment.
Definition LogEntry.php:425
getDeleted()
Get the access restriction.
Definition LogEntry.php:431
getRawParameters()
Returns whatever is stored in the database field.
Definition LogEntry.php:379
getId()
Returns the unique database id.
Definition LogEntry.php:375
getPerformer()
Get the user for performed this action.
Definition LogEntry.php:395
getType()
The main log type.
Definition LogEntry.php:387
Represents a title within MediaWiki.
Definition Title.php:40
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:48
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition User.php:585
static newFromRow( $row, $data=null)
Create a new user object from a user row.
Definition User.php:772
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition User.php:609
static newFromIdentity(UserIdentity $identity)
Returns a User object corresponding to the given UserIdentity.
Definition User.php:652
static newFromActorId( $id)
Static factory method for creation from a given actor ID.
Definition User.php:624
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:2818
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:2848
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:955
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:996
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
Definition hooks.txt:783
$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
Definition globals.txt:62
const SCHEMA_COMPAT_WRITE_OLD
Definition Defines.php:293
const SCHEMA_COMPAT_WRITE_NEW
Definition Defines.php:295
Interface for log entries.
Definition LogEntry.php:42
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.
Interface that defines how to tag objects.
Definition Taggable.php:32
Interface for objects representing user identity.
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 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:30
const DB_REPLICA
Definition defines.php:25
const DB_MASTER
Definition defines.php:26
$params