MediaWiki master
MediaWiki\Page\Event\PageMovedEvent Class Reference

Domain event representing page moves. More...

Inherits MediaWiki\Page\Event\PageRecordChangedEvent.

Collaboration diagram for MediaWiki\Page\Event\PageMovedEvent:

Public Member Functions

 __construct (ExistingPageRecord $pageRecordBefore, ExistingPageRecord $pageRecordAfter, UserIdentity $performer, string $reason, ?PageRecord $redirectPage=null)
 
 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.
 
 getPageRecordBefore ()
 Returns a PageRecord representing the state of the page before the change, or null if the page did not exist before.
 
 getReason ()
 Returns the reason for the move action.
 
 getRedirectPage ()
 Returns a PageRecord representing the page redirect at the old title, if one was created during the move.
 
 wasRedirectCreated ()
 Whether a redirect page at the old title was created during the move.
 
- Public Member Functions inherited from MediaWiki\Page\Event\PageRecordChangedEvent
 __construct (string $cause, ?ExistingPageRecord $pageRecordBefore, ?ExistingPageRecord $pageRecordAfter, UserIdentity $performer, array $tags=[], array $flags=[], $timestamp=false)
 
- 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 = 'PageMoved'
 
- Public Attributes inherited from MediaWiki\Page\Event\PageRecordChangedEvent
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

Domain event representing page moves.

A sequence of PageMoved events for the same page represents a continuous chain of changes to pages' title: for two consecutive PageMovedEvents for the same page ID, the title getPageIdentityAfter() on the first event will match the title from getPageIdentityBefore() on the second event. Other aspects of the PageIdentity returned by these methods, such as the page ID, may change independently

PageMoved events are emitted by the MovePage command class.

Note that page moves often emit additional events, such as PageLatestRevisionChanged (for the dummy revision), PageCreated (if a redirect is created), and PageDeleted (if a page is moved over an existing page). The PageMoved event itself will be emitted last, when all changes needed to complete the page move are done.

See also
PageLatestRevisionChangedEvent
Since
1.45

Definition at line 38 of file PageMovedEvent.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\Event\PageMovedEvent::__construct ( ExistingPageRecord $pageRecordBefore,
ExistingPageRecord $pageRecordAfter,
UserIdentity $performer,
string $reason,
?PageRecord $redirectPage = null )
Parameters
ExistingPageRecord$pageRecordBeforeThe page before the move.
ExistingPageRecord$pageRecordAfterThe page after the move.
UserIdentity$performerThe user performing the move.
string$reasonThe reason for the move.
?PageRecord$redirectPageThe page redirect, if one was created during the move.

Definition at line 50 of file PageMovedEvent.php.

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

Member Function Documentation

◆ getPageRecordAfter()

MediaWiki\Page\Event\PageMovedEvent::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 87 of file PageMovedEvent.php.

◆ getPageRecordBefore()

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

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

Reimplemented from MediaWiki\Page\Event\PageRecordChangedEvent.

Definition at line 78 of file PageMovedEvent.php.

◆ getReason()

MediaWiki\Page\Event\PageMovedEvent::getReason ( )

Returns the reason for the move action.

Returns
string

Definition at line 98 of file PageMovedEvent.php.

◆ getRedirectPage()

MediaWiki\Page\Event\PageMovedEvent::getRedirectPage ( )

Returns a PageRecord representing the page redirect at the old title, if one was created during the move.

Returns
PageRecord|null

Definition at line 108 of file PageMovedEvent.php.

◆ wasRedirectCreated()

MediaWiki\Page\Event\PageMovedEvent::wasRedirectCreated ( )

Whether a redirect page at the old title was created during the move.

Returns
bool

Definition at line 117 of file PageMovedEvent.php.

Member Data Documentation

◆ TYPE

const MediaWiki\Page\Event\PageMovedEvent::TYPE = 'PageMoved'

Definition at line 39 of file PageMovedEvent.php.


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