MediaWiki master
MediaWiki\Page\Event\PageRecordChangedEvent Class Reference

Base class for domain events representing changes to page state. More...

Inherits MediaWiki\Page\Event\PageEvent.

Inherited by MediaWiki\Page\Event\PageCreatedEvent, MediaWiki\Page\Event\PageDeletedEvent, MediaWiki\Page\Event\PageLatestRevisionChangedEvent, and MediaWiki\Page\Event\PageMovedEvent.

Collaboration diagram for MediaWiki\Page\Event\PageRecordChangedEvent:

Public Member Functions

 __construct (string $cause, ?ExistingPageRecord $pageRecordBefore, ?ExistingPageRecord $pageRecordAfter, UserIdentity $performer, array $tags=[], array $flags=[], $timestamp=false)
 
 getPageRecordAfter ()
 Returns a PageRecord representing the state of the page after the change, or null if the page no longer exists after.
 
 getPageRecordBefore ()
 Returns a PageRecord representing the state of the page before the change, or null if the page did not exist before.
 
- Public Member Functions inherited from MediaWiki\Page\Event\PageEvent
 __construct (string $cause, int $pageId, UserIdentity $performer, array $tags=[], array $flags=[], $timestamp=false)
 
 getCause ()
 Indicates the cause of the update.
 
 getPageId ()
 Returns the ID of the page affected by the change.
 
 getPerformer ()
 Returns the user that performed the update.
 
 getTags ()
 Returns any tags applied to the edit.
 
 hasCause (string $cause)
 Checks whether the update had the given cause.
 
 hasTag (string $name)
 Checks for a tag associated the page update.
 
- Public Member Functions inherited from MediaWiki\DomainEvent\DomainEvent
 __construct ( $timestamp=false, bool $isReconciliationRequest=false)
 
 getEventTimestamp ()
 Returns the time at which the event was emitted.
 
 getEventType ()
 Returns this event's type.
 
 getEventTypeChain ()
 Returns the event types this event is compatible with.
 
 isReconciliationRequest ()
 Determines whether this is a reconciliation event, triggered artificially in order to give listeners an opportunity to catch up on missed events or recreate corrupted data.
 

Public Attributes

const TYPE = 'PageRecordChanged'
 
- Public Attributes inherited from MediaWiki\Page\Event\PageEvent
const TYPE = 'Page'
 
- Public Attributes inherited from MediaWiki\DomainEvent\DomainEvent
const ANY = '*'
 

Additional Inherited Members

- Protected Member Functions inherited from MediaWiki\Page\Event\PageEvent
 hasFlag (string $name)
 Checks flags describing the page update.
 
- Protected Member Functions inherited from MediaWiki\DomainEvent\DomainEvent
 declareEventType (string $eventType)
 Declares the event type.
 

Detailed Description

Base class for domain events representing changes to page state.

Page state events include life cycle changes to the page (e.g. create, move, delete) as well as changing a page's latest revision. They do not include changes to the page's revision history (except for changes to the latest revision).

A sequence of PageRecordChanged events for the same page represent a complete history of changes to pages' PageRecord. However, some subtypes may represent changes that do not affect the PageRecord. Also, state changes may overlap, so the PageRecord returned by getPageRecordBefore() doesn't always match the return value of getPageRecordAfter() of the previous event for the same page ID. The return values of getPageRecordAfter() however form a complete history.

Since
1.45

Definition at line 32 of file PageRecordChangedEvent.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\Event\PageRecordChangedEvent::__construct ( string $cause,
?ExistingPageRecord $pageRecordBefore,
?ExistingPageRecord $pageRecordAfter,
UserIdentity $performer,
array $tags = [],
array $flags = [],
$timestamp = false )
Parameters
string$causeSee the self::CAUSE_XXX constants.
?ExistingPageRecord$pageRecordBeforeThe page record before the change, or null if the page didn't exist before.
?ExistingPageRecord$pageRecordAfterThe page record after the change, or null if the page no longer exists after.
UserIdentity$performerThe user performing the update.
array<string>$tags Applicable tags, see ChangeTags.
array<string,bool>$flags See the self::FLAG_XXX constants.
string | ConvertibleTimestamp | false$timestamp

Definition at line 49 of file PageRecordChangedEvent.php.

References MediaWiki\DomainEvent\DomainEvent\declareEventType(), and MediaWiki\Page\ProperPageIdentity\getId().

Member Function Documentation

◆ getPageRecordAfter()

MediaWiki\Page\Event\PageRecordChangedEvent::getPageRecordAfter ( )

Returns a PageRecord representing the state of the page after the change, or null if the page no longer exists after.

Note that the PageRecord returned by this method may be the same as the one returned by getPageRecordBefore(). This may be the case for reconciliation events, but also for events that represent changes that are not reflected in the PageRecord.

Reimplemented in MediaWiki\Page\Event\PageCreatedEvent, MediaWiki\Page\Event\PageDeletedEvent, MediaWiki\Page\Event\PageLatestRevisionChangedEvent, and MediaWiki\Page\Event\PageMovedEvent.

Definition at line 97 of file PageRecordChangedEvent.php.

◆ getPageRecordBefore()

MediaWiki\Page\Event\PageRecordChangedEvent::getPageRecordBefore ( )

Returns a PageRecord representing the state of the page before the change, or null if the page did not exist before.

Reimplemented in MediaWiki\Page\Event\PageCreatedEvent, MediaWiki\Page\Event\PageDeletedEvent, and MediaWiki\Page\Event\PageMovedEvent.

Definition at line 84 of file PageRecordChangedEvent.php.

Member Data Documentation

◆ TYPE

const MediaWiki\Page\Event\PageRecordChangedEvent::TYPE = 'PageRecordChanged'

Definition at line 34 of file PageRecordChangedEvent.php.


The documentation for this class was generated from the following file: