MediaWiki master
|
Domain event representing a change to the page's latest revision. More...
Inherits MediaWiki\Page\Event\PageRecordChangedEvent, 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. | |
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) | |
getPageRecordBefore () | |
Returns a PageRecord representing the state of the page before the change, or null if the page did not exist before. | |
![]() | |
__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. | |
![]() | |
__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 = 'PageLatestRevisionChanged' |
![]() | |
const | TYPE = 'PageRecordChanged' |
![]() | |
const | TYPE = 'Page' |
![]() | |
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 change to the page's latest revision.
PageLatestRevisionChanged events emitted for the same page ID represent a continuous chain of changes to pages' latest revision, even if the content did not change (for a dummy revision). This change is observable as the difference between getPageRecordBefore()->getLatest() and getPageRecordAfter()->getLatest(), resp. between getLatestRevisionBefore() and getLatestRevisionAfter().
For two consecutive PageLatestRevisionChangedEvents for the same page ID, the return value of getLatestRevisionAfter() on the first event will match the return value of getLatestRevisionBefore() on the second event. Other aspects of the page, such as the title, may change independently.
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. In that case, getPageRecordBefore() and getPageRecordAfter() return the same value.
PageLatestRevisionChangedEvents are emitted by DerivedPageDataUpdater, typically triggered by PageUpdater.
User activities that trigger PageLatestRevisionChangeds event include:
Definition at line 72 of file PageLatestRevisionChangedEvent.php.
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::__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 128 of file PageLatestRevisionChangedEvent.php.
References MediaWiki\DomainEvent\DomainEvent\declareEventType(), MediaWiki\Revision\RevisionRecord\getPage(), MediaWiki\Revision\RevisionRecord\getTimestamp(), and MediaWiki\Page\PageReference\isSamePageAs().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 231 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 283 of file PageLatestRevisionChangedEvent.php.
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 312 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::getLatestRevisionAfter | ( | ) |
The revision that became the latest as a result of the update.
Definition at line 338 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\Language\LanguageEventIngress\handlePageLatestRevisionChangedEvent(), MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent(), MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageLatestRevisionChangedEvent(), and MediaWiki\Search\SearchEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 331 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent(), and MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::getPage | ( | ) |
Returns the page that was updated.
Definition at line 197 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\Language\LanguageEventIngress\handlePageLatestRevisionChangedEvent(), and MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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\PageRecordChangedEvent.
Definition at line 188 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\Search\SearchEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::getPatrolStatus | ( | ) |
Returns the page update's initial patrol status.
Definition at line 347 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::getSlotsUpdate | ( | ) |
Returns which slots were changed, added, or removed by the update.
Definition at line 290 of file PageLatestRevisionChangedEvent.php.
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::isBotUpdate | ( | ) |
Whether the update was performed by a bot.
Definition at line 382 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 208 of file PageLatestRevisionChangedEvent.php.
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 272 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::isImplicit | ( | ) |
Whether the update was performed automatically without the user's initiative.
Definition at line 363 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 300 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\Language\LanguageEventIngress\handlePageLatestRevisionChangedEvent(), and MediaWiki\Search\SearchEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 254 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoaderEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::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 375 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent().
MediaWiki\Page\Event\PageLatestRevisionChangedEvent::isSilent | ( | ) |
Whether the update should be omitted from update feeds presented to the user.
Definition at line 355 of file PageLatestRevisionChangedEvent.php.
Referenced by MediaWiki\RecentChanges\ChangeTrackingEventIngress\handlePageLatestRevisionChangedEvent().
const MediaWiki\Page\Event\PageLatestRevisionChangedEvent::DEFAULT_FLAGS |
All available flags and their default values.
Definition at line 99 of file PageLatestRevisionChangedEvent.php.
const MediaWiki\Page\Event\PageLatestRevisionChangedEvent::TYPE = 'PageLatestRevisionChanged' |
Definition at line 74 of file PageLatestRevisionChangedEvent.php.