MediaWiki master
|
Domain event representing a page update. More...
Inherits MediaWiki\Page\Event\PageStateEvent, and MediaWiki\Storage\PageUpdateCauses.
Public Member Functions | |
__construct (string $cause, ?ExistingPageRecord $pageRecordBefore, ExistingPageRecord $pageRecordAfter, ?RevisionRecord $latestRevisionBefore, RevisionRecord $latestRevisionAfter, RevisionSlotsUpdate $slotsUpdate, ?EditResult $editResult, UserIdentity $performer, array $tags=[], array $flags=[], int $patrolStatus=0) | |
changedLatestRevisionId () | |
Whether this event represents a change to the latest revision ID associated with the page. | |
getAuthor () | |
Returns the author of the new revision. | |
getEditResult () | |
An EditResult representing the effects of the update. | |
getLatestRevisionAfter () | |
The revision that became the latest as a result of the update. | |
getLatestRevisionBefore () | |
Returned the revision that used to be latest before the update. | |
getNewRevision () | |
getOldRevision () | |
getPage () | |
Returns the page that was updated. | |
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. | |
getPatrolStatus () | |
Returns the page update's initial patrol status. | |
getSlotsUpdate () | |
Returns which slots were changed, added, or removed by the update. | |
isBotUpdate () | |
Whether the update was performed by a bot. | |
isCreation () | |
Whether the updated created the page. | |
isEffectiveContentChange () | |
Whether the update effectively changed the content of the page. | |
isImplicit () | |
Whether the update was performed automatically without the user's initiative. | |
isModifiedSlot (string $slotRole) | |
Whether the given slot was modified by the page update. | |
isNominalContentChange () | |
Whether the update nominally changed the content of the page. | |
isRevert () | |
Whether the update reverts an earlier update to the same page. | |
isSilent () | |
Whether the update should be omitted from update feeds presented to the user. | |
![]() | |
__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. | |
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 | DEFAULT_FLAGS |
All available flags and their default values. | |
const | TYPE = 'PageRevisionUpdated' |
![]() | |
const | TYPE = 'PageState' |
![]() | |
const | ANY = '*' |
Additional Inherited Members | |
![]() | |
hasFlag (string $name) | |
Checks flags describing the page update. | |
![]() | |
declareEventType (string $eventType) | |
Declares the event type. | |
Domain event representing a page update.
A PageRevisionUpdatedEvent is triggered when a page's latest revision changes, even if the content did not change (for a dummy revision). A reconciliation version of this event may be triggered even when the page's latest version did not change (on null edits), to provide an opportunity to listeners to recover from data loss and corruption by re-generating any derived data.
PageRevisionUpdatedEvent is emitted by DerivedPageDataUpdater, typically triggered by PageUpdater. User activities that trigger a PageRevisionUpdated event include:
Extensions that want to subscribe to this event should list "PageRevisionUpdated" as a subscribed event type. Subscribers based on DomainEventIngress should implement the handlePageRevisionUpdatedEvent() listener method to be informed when a page update has been committed to the database.
See the documentation of DomainEventIngress and DomainEventSource for more options and details.
Definition at line 60 of file PageRevisionUpdatedEvent.php.
MediaWiki\Page\Event\PageRevisionUpdatedEvent::__construct | ( | string | $cause, |
?ExistingPageRecord | $pageRecordBefore, | ||
ExistingPageRecord | $pageRecordAfter, | ||
?RevisionRecord | $latestRevisionBefore, | ||
RevisionRecord | $latestRevisionAfter, | ||
RevisionSlotsUpdate | $slotsUpdate, | ||
?EditResult | $editResult, | ||
UserIdentity | $performer, | ||
array | $tags = [], | ||
array | $flags = [], | ||
int | $patrolStatus = 0 ) |
string | $cause | See the self::CAUSE_XXX constants. |
?ExistingPageRecord | $pageRecordBefore | The page record before the change. |
ExistingPageRecord | $pageRecordAfter | The page record after the change. |
?RevisionRecord | $latestRevisionBefore | The revision that used to be the latest before the updated. |
RevisionRecord | $latestRevisionAfter | The revision object that became the latest as a result of the update. |
RevisionSlotsUpdate | $slotsUpdate | Page content changed by the update. |
?EditResult | $editResult | An EditResult representing the effects of an edit. |
UserIdentity | $performer | The user performing the update. |
array<string> | $tags Applicable tags, see ChangeTags. | |
array<string,bool> | $flags See the self::FLAG_XXX constants. | |
int | $patrolStatus | See PageUpdater::setRcPatrolStatus() |
Definition at line 116 of file PageRevisionUpdatedEvent.php.
References MediaWiki\DomainEvent\DomainEvent\declareEventType(), MediaWiki\Revision\RevisionRecord\getPage(), MediaWiki\Revision\RevisionRecord\getTimestamp(), and MediaWiki\Page\PageReference\isSamePageAs().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::changedLatestRevisionId | ( | ) |
Whether this event represents a change to the latest revision ID associated with the page.
In other words, the page's latest revision after the change is different from the page's latest revision before the change.
This method will return true under most circumstances. It will however return false for reconciliation requests like null edits. In that case, isReconciliationRequest() should return true.
Definition at line 219 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getAuthor | ( | ) |
Returns the author of the new revision.
Note that this may be different from the user returned by getPerformer() for update events caused e.g. by undeletion or imports.
Definition at line 271 of file PageRevisionUpdatedEvent.php.
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getEditResult | ( | ) |
An EditResult representing the effects of the update.
Can be used to determine whether the edit was a revert and which edits were reverted.
This may return null for updates that do not result from edits, such as imports or undeletions.
Definition at line 300 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getLatestRevisionAfter | ( | ) |
The revision that became the latest as a result of the update.
Definition at line 326 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\Languages\LanguageEventIngress\handlePageRevisionUpdatedEvent(), MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent(), MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageRevisionUpdatedEvent(), and MediaWiki\Search\SearchEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getLatestRevisionBefore | ( | ) |
Returned the revision that used to be latest before the update.
Will be null if the edit created the page. Will be the same as getLatestRevisionAfter() if the edit was a "null-edit".
Note that this is not necessarily the new revision's parent revision. For instance, when undeleting a page, getLatestRevisionBefore() will return null because the page didn't exist before, even if the undeleted page has many revisions and the new latest revision indeed has a parent revision.
The parent revision can be determined by calling getLatestRevisionAfter()->getParentId().
Definition at line 319 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent(), and MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getNewRevision | ( | ) |
Definition at line 340 of file PageRevisionUpdatedEvent.php.
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getOldRevision | ( | ) |
Definition at line 333 of file PageRevisionUpdatedEvent.php.
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getPage | ( | ) |
Returns the page that was updated.
Definition at line 185 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\Languages\LanguageEventIngress\handlePageRevisionUpdatedEvent(), and MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::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 from MediaWiki\Page\Event\PageStateEvent.
Definition at line 176 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\Search\SearchEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getPatrolStatus | ( | ) |
Returns the page update's initial patrol status.
Definition at line 349 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::getSlotsUpdate | ( | ) |
Returns which slots were changed, added, or removed by the update.
Definition at line 278 of file PageRevisionUpdatedEvent.php.
MediaWiki\Page\Event\PageRevisionUpdatedEvent::isBotUpdate | ( | ) |
Whether the update was performed by a bot.
Definition at line 384 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::isCreation | ( | ) |
Whether the updated created the page.
A deleted/archived page is not considered to "exist". When undeleting a page, the page will be restored using its old page ID, so the "created" page may have an ID that was seen previously.
Definition at line 196 of file PageRevisionUpdatedEvent.php.
MediaWiki\Page\Event\PageRevisionUpdatedEvent::isEffectiveContentChange | ( | ) |
Whether the update effectively changed the content of the page.
This will return false for "dummy revisions" that represent an entry in the page history but do not modify the content. It will also be false for reconciliation events (null edits).
Definition at line 260 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::isImplicit | ( | ) |
Whether the update was performed automatically without the user's initiative.
Definition at line 365 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::isModifiedSlot | ( | string | $slotRole | ) |
Whether the given slot was modified by the page update.
Slots that were removed do not count as modified. This is a convenience method for $this->getSlotsUpdate()->isModifiedSlot( $slotRole ).
Definition at line 288 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\Languages\LanguageEventIngress\handlePageRevisionUpdatedEvent(), and MediaWiki\Search\SearchEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::isNominalContentChange | ( | ) |
Whether the update nominally changed the content of the page.
This is the case if:
On other words, this will return true for actual changes and null edits, but will return false for "dummy revisions".
Definition at line 242 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::isRevert | ( | ) |
Whether the update reverts an earlier update to the same page.
Note that an "undo" style revert may create a new revision that is different from any previous revision by applying the inverse of a past update to the latest revision.
Definition at line 377 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
MediaWiki\Page\Event\PageRevisionUpdatedEvent::isSilent | ( | ) |
Whether the update should be omitted from update feeds presented to the user.
Definition at line 357 of file PageRevisionUpdatedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageRevisionUpdatedEvent().
const MediaWiki\Page\Event\PageRevisionUpdatedEvent::DEFAULT_FLAGS |
All available flags and their default values.
Definition at line 87 of file PageRevisionUpdatedEvent.php.
const MediaWiki\Page\Event\PageRevisionUpdatedEvent::TYPE = 'PageRevisionUpdated' |
Definition at line 62 of file PageRevisionUpdatedEvent.php.