MediaWiki master
|
Base class for domain events representing changes to page state. More...
Inherits MediaWiki\DomainEvent\DomainEvent.
Inherited by MediaWiki\Page\Event\PageDeletedEvent, MediaWiki\Page\Event\PageMovedEvent, and MediaWiki\Page\Event\PageRevisionUpdatedEvent.
Public Member Functions | |
__construct (string $cause, ?ExistingPageRecord $pageRecordBefore, ?ExistingPageRecord $pageRecordAfter, 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. | |
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. | |
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. | |
![]() | |
__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 = 'PageState' |
![]() | |
const | ANY = '*' |
Protected Member Functions | |
hasFlag (string $name) | |
Checks flags describing the page update. | |
![]() | |
declareEventType (string $eventType) | |
Declares the event type. | |
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).
The basic page state before and after the change is represented by PageRecord objects. However, not all changes that trigger a PageStateEvents will cause differences in the page record.
Definition at line 43 of file PageStateEvent.php.
MediaWiki\Page\Event\PageStateEvent::__construct | ( | string | $cause, |
?ExistingPageRecord | $pageRecordBefore, | ||
?ExistingPageRecord | $pageRecordAfter, | ||
UserIdentity | $performer, | ||
array | $tags = [], | ||
array | $flags = [], | ||
$timestamp = false ) |
string | $cause | See the self::CAUSE_XXX constants. |
?ExistingPageRecord | $pageRecordBefore | The page record before the change, or null if the page didn't exist before. |
?ExistingPageRecord | $pageRecordAfter | The page record after the change, or null if the page no longer exists after. |
UserIdentity | $performer | The 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 77 of file PageStateEvent.php.
References MediaWiki\DomainEvent\DomainEvent\declareEventType().
MediaWiki\Page\Event\PageStateEvent::getCause | ( | ) |
Indicates the cause of the update.
See the self::CAUSE_XXX constants.
Definition at line 167 of file PageStateEvent.php.
MediaWiki\Page\Event\PageStateEvent::getPageId | ( | ) |
Returns the ID of the page affected by the change.
Note that the ID may no longer be valid after the change (e.g. if the page was deleted).
Definition at line 139 of file PageStateEvent.php.
Referenced by MediaWiki\Search\SearchEventIngress\handlePageDeletedEvent(), and MediaWiki\Search\SearchEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageStateEvent::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\PageDeletedEvent, MediaWiki\Page\Event\PageMovedEvent, and MediaWiki\Page\Event\PageRevisionUpdatedEvent.
Definition at line 130 of file PageStateEvent.php.
MediaWiki\Page\Event\PageStateEvent::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\PageDeletedEvent, and MediaWiki\Page\Event\PageMovedEvent.
Definition at line 117 of file PageStateEvent.php.
MediaWiki\Page\Event\PageStateEvent::getPerformer | ( | ) |
Returns the user that performed the update.
For an edit, this will be the same as the user returned by getAuthor(). However, it may be a different user for update events caused e.g. by undeletion or imports.
Definition at line 150 of file PageStateEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageStateEvent::getTags | ( | ) |
Returns any tags applied to the edit.
Definition at line 184 of file PageStateEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageStateEvent::hasCause | ( | string | $cause | ) |
Checks whether the update had the given cause.
Definition at line 176 of file PageStateEvent.php.
Referenced by MediaWiki\Languages\LanguageEventIngress\handlePageRevisionUpdatedEvent(), MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageRevisionUpdatedEvent(), and MediaWiki\Search\SearchEventIngress\handlePageRevisionUpdatedEvent().
|
protected |
Checks flags describing the page update.
Use with FLAG_XXX constants declared by subclasses.
Definition at line 158 of file PageStateEvent.php.
MediaWiki\Page\Event\PageStateEvent::hasTag | ( | string | $name | ) |
Checks for a tag associated the page update.
Definition at line 193 of file PageStateEvent.php.
const MediaWiki\Page\Event\PageStateEvent::TYPE = 'PageState' |
Definition at line 45 of file PageStateEvent.php.