MediaWiki  1.33.0
LogEntry.php
Go to the documentation of this file.
1 <?php
35 use Wikimedia\Assert\Assert;
36 
42 interface 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 
119 abstract 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 
181  $tables = array_merge(
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();
299  Wikimedia\suppressWarnings();
301  Wikimedia\restoreWarnings();
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 
441 class 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();
671 
672  // Ensure actor relations are set
673  if ( ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) &&
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 );
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 );
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 
772  $this->getTimestamp(),
773  $logpage,
774  $user,
775  $formatter->getPlainActionText(),
776  $ip,
777  $this->getType(),
778  $this->getSubtype(),
779  $this->getTarget(),
780  $this->getComment(),
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 
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  },
842  wfGetDB( DB_MASTER )
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 }
ManualLogEntry\setTimestamp
setTimestamp( $timestamp)
Set the timestamp of when the logged action took place.
Definition: LogEntry.php:556
ManualLogEntry\__construct
__construct( $type, $subtype)
Definition: LogEntry.php:489
$user
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1476
User\newFromId
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition: User.php:609
ManualLogEntry\getTarget
getTarget()
Definition: LogEntry.php:868
RCDatabaseLogEntry
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...
Definition: LogEntry.php:373
RCDatabaseLogEntry\getAssociatedRevId
getAssociatedRevId()
Definition: LogEntry.php:383
ManualLogEntry\$deleted
int $deleted
Deletion state of the log entry.
Definition: LogEntry.php:473
$context
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:2636
ManualLogEntry\getType
getType()
The main log type.
Definition: LogEntry.php:846
LogEntry\getTimestamp
getTimestamp()
Get the timestamp when the action was executed.
ManualLogEntry\insert
insert(IDatabase $dbw=null)
Insert the entry into the logging table.
Definition: LogEntry.php:657
DatabaseLogEntry\getId
getId()
Returns the unique database id.
Definition: LogEntry.php:269
DatabaseLogEntry\$params
array $params
Parameters for log entry.
Definition: LogEntry.php:252
LogPage\extractParams
static extractParams( $blob)
Extract a parameter array from a blob.
Definition: LogPage.php:423
DatabaseLogEntry\getParameters
getParameters()
Get the extra parameters stored for this message.
Definition: LogEntry.php:296
LogEntry\getParameters
getParameters()
Get the extra parameters stored for this message.
captcha-old.count
count
Definition: captcha-old.py:249
MediaWiki\Logger\LoggerFactory\getInstance
static getInstance( $channel)
Get a named logger instance from the currently configured logger factory.
Definition: LoggerFactory.php:92
LogEntry\isDeleted
isDeleted( $field)
ManualLogEntry\setAssociatedRevId
setAssociatedRevId( $revId)
Set an associated revision id.
Definition: LogEntry.php:579
ManualLogEntry\getParameters
getParameters()
Get the extra parameters stored for this message.
Definition: LogEntry.php:854
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1912
LogEntryBase\isLegacy
isLegacy()
Whether the parameters for this log are stored in new or old format.
Definition: LogEntry.php:135
DatabaseLogEntry\getSelectQueryData
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
Definition: LogEntry.php:177
RCDatabaseLogEntry\getRawParameters
getRawParameters()
Returns whatever is stored in the database field.
Definition: LogEntry.php:379
RCDatabaseLogEntry\getSubtype
getSubtype()
The log subtype.
Definition: LogEntry.php:391
LogEntry\getTarget
getTarget()
Get the target page of this action.
DatabaseLogEntry\newFromId
static newFromId( $id, IDatabase $db)
Loads a LogEntry with the given id from database.
Definition: LogEntry.php:228
$tables
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:979
LogEntry\getComment
getComment()
Get the user provided comment.
$params
$params
Definition: styleTest.css.php:44
ManualLogEntry\getComment
getComment()
Get the user provided comment.
Definition: LogEntry.php:878
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:585
DatabaseLogEntry\getComment
getComment()
Get the user provided comment.
Definition: LogEntry.php:360
RequestContext\newExtraneousContext
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
Definition: RequestContext.php:600
LogEntry\getFullType
getFullType()
The full logtype in format maintype/subtype.
SpecialPage\getTitleFor
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,...
Definition: SpecialPage.php:82
User\newFromIdentity
static newFromIdentity(UserIdentity $identity)
Returns a User object corresponding to the given UserIdentity.
Definition: User.php:652
MediaWiki\ChangeTags\Taggable
Interface that defines how to tag objects.
Definition: Taggable.php:32
ManualLogEntry\setRelations
setRelations(array $relations)
Declare arbitrary tag/value relations to this log entry.
Definition: LogEntry.php:526
serialize
serialize()
Definition: ApiMessageTrait.php:134
ManualLogEntry\addTags
addTags( $tags)
Add change tags for the log entry.
Definition: LogEntry.php:609
User\newFromRow
static newFromRow( $row, $data=null)
Create a new user object from a user row.
Definition: User.php:772
DatabaseLogEntry\getSubtype
getSubtype()
The log subtype.
Definition: LogEntry.php:292
MediaWiki\User\UserIdentity
Interface for objects representing user identity.
Definition: UserIdentity.php:32
ManualLogEntry\getTimestamp
getTimestamp()
Get the timestamp when the action was executed.
Definition: LogEntry.php:872
ActorMigration\newMigration
static newMigration()
Static constructor.
Definition: ActorMigration.php:111
ManualLogEntry\$legacy
bool $legacy
Whether this is a legacy log entry.
Definition: LogEntry.php:482
php
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:35
DatabaseLogEntry\getTimestamp
getTimestamp()
Get the timestamp when the action was executed.
Definition: LogEntry.php:356
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
ManualLogEntry\setTags
setTags( $tags)
Set change tags for the log entry.
Definition: LogEntry.php:593
LogEntry\getType
getType()
The main log type.
RCDatabaseLogEntry\getId
getId()
Returns the unique database id.
Definition: LogEntry.php:375
RCDatabaseLogEntry\getTimestamp
getTimestamp()
Get the timestamp when the action was executed.
Definition: LogEntry.php:421
ManualLogEntry\$comment
string $comment
Comment for the log entry.
Definition: LogEntry.php:464
$data
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
Definition: generatePhpCharToUpperMappings.php:13
ManualLogEntry\$parameters
array $parameters
Parameters for log entry.
Definition: LogEntry.php:449
ManualLogEntry\getRecentChange
getRecentChange( $newId=0)
Get a RecentChanges object for the log entry.
Definition: LogEntry.php:755
RCDatabaseLogEntry\getTarget
getTarget()
Get the target page of this action.
Definition: LogEntry.php:413
ManualLogEntry\isLegacy
isLegacy()
Definition: LogEntry.php:912
MWException
MediaWiki exception.
Definition: MWException.php:26
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
DatabaseLogEntry\newFromRow
static newFromRow( $row)
Constructs new LogEntry from database result row.
Definition: LogEntry.php:212
ManualLogEntry\setComment
setComment( $comment)
Set a comment associated with the action being logged.
Definition: LogEntry.php:566
ManualLogEntry\$tags
string[] $tags
Change tags add to the log entry.
Definition: LogEntry.php:470
ManualLogEntry\$id
int $id
ID of the log entry.
Definition: LogEntry.php:476
$blob
$blob
Definition: testCompression.php:65
LogEntry
Interface for log entries.
Definition: LogEntry.php:42
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2636
DatabaseLogEntry\getType
getType()
The main log type.
Definition: LogEntry.php:288
LogEntryBase\isDeleted
isDeleted( $field)
Definition: LogEntry.php:125
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:33
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
RCDatabaseLogEntry\getComment
getComment()
Get the user provided comment.
Definition: LogEntry.php:425
DeferredUpdates\POSTSEND
const POSTSEND
Definition: DeferredUpdates.php:64
ManualLogEntry\getSubtype
getSubtype()
The log subtype.
Definition: LogEntry.php:850
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:576
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
wfTimestampNow
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
Definition: GlobalFunctions.php:1941
DB_MASTER
const DB_MASTER
Definition: defines.php:26
ManualLogEntry\$subtype
string $subtype
Sub type of log entry.
Definition: LogEntry.php:446
array
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))
wfDebug
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:949
ManualLogEntry\setParameters
setParameters( $parameters)
Set extra log parameters.
Definition: LogEntry.php:515
ManualLogEntry\publish
publish( $newId, $to='rcandudp')
Publish the log entry.
Definition: LogEntry.php:795
ManualLogEntry\$relations
array $relations
Definition: LogEntry.php:452
LogEntryBase
Extends the LogEntryInterface with some basic functionality.
Definition: LogEntry.php:119
LogEntry\getDeleted
getDeleted()
Get the access restriction.
ManualLogEntry\setIsPatrollable
setIsPatrollable( $patrollable)
Set whether this log entry should be made patrollable This shouldn't depend on config,...
Definition: LogEntry.php:626
Hooks\runWithoutAbort
static runWithoutAbort( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:231
LogEntryBase\extractParams
static extractParams( $blob)
Extract a parameter array from a blob.
Definition: LogEntry.php:157
$value
$value
Definition: styleTest.css.php:49
Wikimedia\Rdbms\IDatabase\selectRow
selectRow( $table, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[])
Single row SELECT wrapper.
ManualLogEntry\setDeleted
setDeleted( $deleted)
Set the 'deleted' flag.
Definition: LogEntry.php:646
SCHEMA_COMPAT_WRITE_OLD
const SCHEMA_COMPAT_WRITE_OLD
Definition: Defines.php:284
DatabaseLogEntry\getPerformer
getPerformer()
Get the user for performed this action.
Definition: LogEntry.php:325
ManualLogEntry\$timestamp
string $timestamp
Timestamp of creation of the log entry.
Definition: LogEntry.php:461
SCHEMA_COMPAT_WRITE_NEW
const SCHEMA_COMPAT_WRITE_NEW
Definition: Defines.php:286
LogEntryBase\getFullType
getFullType()
The full logtype in format maintype/subtype.
Definition: LogEntry.php:121
Title\newFromLinkTarget
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Definition: Title.php:269
RCDatabaseLogEntry\getType
getType()
The main log type.
Definition: LogEntry.php:387
ManualLogEntry\getTags
getTags()
Definition: LogEntry.php:894
LogEntry\getSubtype
getSubtype()
The log subtype.
ManualLogEntry\getPerformer
getPerformer()
Definition: LogEntry.php:861
ManualLogEntry\setTarget
setTarget(LinkTarget $target)
Set the title of the object changed.
Definition: LogEntry.php:546
RecentChange\newLogEntry
static newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='', $revId=0, $isPatrollable=false)
Definition: RecentChange.php:863
unserialize
unserialize( $serialized)
Definition: ApiMessageTrait.php:142
Title
Represents a title within MediaWiki.
Definition: Title.php:40
$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 $rows
Definition: hooks.txt:2636
DatabaseLogEntry\__construct
__construct( $row)
Definition: LogEntry.php:260
DatabaseLogEntry\$revId
int $revId
A rev id associated to the log entry.
Definition: LogEntry.php:255
DatabaseLogEntry\$legacy
bool $legacy
Whether the parameters for this log entry are stored in new or old format.
Definition: LogEntry.php:258
ManualLogEntry\getDeleted
getDeleted()
Get the access restriction.
Definition: LogEntry.php:916
LogEntryBase\makeParamBlob
static makeParamBlob( $params)
Create a blob from a parameter array.
Definition: LogEntry.php:146
as
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
Definition: distributors.txt:9
ManualLogEntry\$revId
int $revId
A rev id associated to the log entry.
Definition: LogEntry.php:467
User\newFromActorId
static newFromActorId( $id)
Static factory method for creation from a given actor ID.
Definition: User.php:624
DatabaseLogEntry
A value class to process existing log entries.
Definition: LogEntry.php:168
ManualLogEntry\getIsPatrollable
getIsPatrollable()
Whether this log entry is patrollable.
Definition: LogEntry.php:904
DatabaseLogEntry\isLegacy
isLegacy()
Whether the parameters for this log are stored in new or old format.
Definition: LogEntry.php:282
ManualLogEntry\$target
Title $target
Target title for the log entry.
Definition: LogEntry.php:458
ManualLogEntry
Class for creating new log entries and inserting them into the database.
Definition: LogEntry.php:441
RCDatabaseLogEntry\getPerformer
getPerformer()
Get the user for performed this action.
Definition: LogEntry.php:395
DatabaseLogEntry\getTarget
getTarget()
Get the target page of this action.
Definition: LogEntry.php:348
ManualLogEntry\setLegacy
setLegacy( $legacy)
Set the 'legacy' flag.
Definition: LogEntry.php:636
DatabaseLogEntry\$row
stdClass $row
Database result row.
Definition: LogEntry.php:246
object
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:25
MediaWiki\Linker\LinkTarget
Definition: LinkTarget.php:26
ManualLogEntry\getAssociatedRevId
getAssociatedRevId()
Definition: LogEntry.php:886
RCDatabaseLogEntry\getDeleted
getDeleted()
Get the access restriction.
Definition: LogEntry.php:431
DatabaseLogEntry\getDeleted
getDeleted()
Get the access restriction.
Definition: LogEntry.php:364
CommentStore\getStore
static getStore()
Definition: CommentStore.php:130
ManualLogEntry\setPerformer
setPerformer(UserIdentity $performer)
Set the user that performed the action being logged.
Definition: LogEntry.php:536
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:48
DeferredUpdates\addCallableUpdate
static addCallableUpdate( $callable, $stage=self::POSTSEND, $dbw=null)
Add a callable update.
Definition: DeferredUpdates.php:118
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
Definition: postgres.txt:22
LogEntry\getPerformer
getPerformer()
Get the user for performed this action.
DatabaseLogEntry\getAssociatedRevId
getAssociatedRevId()
Definition: LogEntry.php:319
DatabaseLogEntry\$performer
User $performer
Definition: LogEntry.php:249
DatabaseLogEntry\getRawParameters
getRawParameters()
Returns whatever is stored in the database field.
Definition: LogEntry.php:278
ManualLogEntry\$type
string $type
Type of log entry.
Definition: LogEntry.php:443
ManualLogEntry\$isPatrollable
bool $isPatrollable
Can this log entry be patrolled?
Definition: LogEntry.php:479
ChangeTags\addTags
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.
Definition: ChangeTags.php:226
ManualLogEntry\$performer
User $performer
Performer of the action for the log entry.
Definition: LogEntry.php:455
IP\isIPAddress
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
Definition: IP.php:77
LogFormatter\newFromEntry
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
Definition: LogFormatter.php:50
$wgActorTableSchemaMigrationStage
int $wgActorTableSchemaMigrationStage
Actor table schema migration stage.
Definition: DefaultSettings.php:8979