MediaWiki master
MediaWiki\Page\Event\PageCreatedEvent Class Reference

Domain event representing page creation. More...

Inherits MediaWiki\Page\Event\PageRecordChangedEvent.

Collaboration diagram for MediaWiki\Page\Event\PageCreatedEvent:

Public Member Functions

 __construct (string $cause, ExistingPageRecord $pageRecordAfter, RevisionRecord $latestRevisionAfter, UserIdentity $performer, string $reason)
 
 getLatestRevisionAfter ()
 Returns the revision that became the page's latest revision when the page was created.
 
 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 supplied by the user.
 
- 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 = 'PageCreated'
 
- 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 creation.

Listeners registered for the "PageCreated" event type will receive a partial history of changes to pages' PageIdentity, namely changes where the page's ID used to be 0 before the change (that is, the page didn't previously exist).

PageCreatedEvents are emitted by DerivedPageDataUpdater, typically triggered by PageUpdater.

User activities that trigger PageCreatedEvents event include:

  • editing a non-existing page
  • undeleting pages
  • importing pages
  • moving pages, when a redirect is created under the old title
  • uploading media files
See also
PageUpdatedEvent
PageDeletedEvent
Since
1.45

Definition at line 37 of file PageCreatedEvent.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\Event\PageCreatedEvent::__construct ( string $cause,
ExistingPageRecord $pageRecordAfter,
RevisionRecord $latestRevisionAfter,
UserIdentity $performer,
string $reason )
Parameters
string$causeSee the self::CAUSE_XXX constants.
ExistingPageRecord$pageRecordAfter
RevisionRecord$latestRevisionAfter
UserIdentity$performerThe user performing the update.

Definition at line 49 of file PageCreatedEvent.php.

References MediaWiki\DomainEvent\DomainEvent\declareEventType(), and MediaWiki\Page\ExistingPageRecord\exists().

Member Function Documentation

◆ getLatestRevisionAfter()

MediaWiki\Page\Event\PageCreatedEvent::getLatestRevisionAfter ( )

Returns the revision that became the page's latest revision when the page was created.

Definition at line 89 of file PageCreatedEvent.php.

◆ getPageRecordAfter()

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

◆ getPageRecordBefore()

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

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

Returns
null

Reimplemented from MediaWiki\Page\Event\PageRecordChangedEvent.

Definition at line 107 of file PageCreatedEvent.php.

◆ getReason()

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

Returns the reason supplied by the user.

If the page was created by a regular edit, this is the same as the edit summary.

Returns
string

Definition at line 81 of file PageCreatedEvent.php.

Member Data Documentation

◆ TYPE

const MediaWiki\Page\Event\PageCreatedEvent::TYPE = 'PageCreated'

Definition at line 38 of file PageCreatedEvent.php.


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