MediaWiki master
MediaWiki\Page\PageReference Interface Reference

Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki. More...

Inherits Stringable, and MediaWiki\DAO\WikiAwareEntity.

Inherited by MediaWiki\Page\PageIdentity, and MediaWiki\Page\PageReferenceValue.

Collaboration diagram for MediaWiki\Page\PageReference:

Public Member Functions

 __toString ()
 Returns an informative human readable unique representation of the page identity, for use as a cache key and for logging and debugging.
 
 getDBkey ()
 Get the page title in DB key form.
 
 getNamespace ()
 Returns the page's namespace number.
 
 getWikiId ()
 Get the ID of the wiki this page belongs to.
 
 isSamePageAs (PageReference $other)
 Checks whether the given PageReference refers to the same page as this PageReference.
 
- Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity
 assertWiki ( $wikiId)
 Throws if $wikiId is different from the return value of getWikiId().
 

Detailed Description

Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.

This includes special pages.

The identity of any PageReference object is defined by the namespace, the dbkey, and the wiki ID. If the wiki ID is self::LOCAL, the identity is relative to the local wiki.

Note
For compatibility with the Title class, PageReference instances may for represent things that are not viewable pages, such as interwiki links and section links. This is intended to change in the future.
Instances of Title shall be the only instances of PageReference that are not viewable pages. Other classes implementing PageReference must not permit an empty DB key. The idea is that once Title has been removed, all PageReference are then viewable pages.
Code that deserializes instances of PageReference must ensure that the original meaning of the "local" Wiki ID is preserved if the PageReference originated on another wiki.
See also
https://www.mediawiki.org/wiki/Manual:Modeling_pages
Stability: stable
to type
Since
1.37

Definition at line 52 of file PageReference.php.

Member Function Documentation

◆ __toString()

MediaWiki\Page\PageReference::__toString ( )

Returns an informative human readable unique representation of the page identity, for use as a cache key and for logging and debugging.

Returns
string

Implemented in MediaWiki\Page\PageReferenceValue, WikiPage, and MediaWiki\Title\Title.

Referenced by MediaWiki\Revision\RevisionStore\getKnownCurrentRevision().

◆ getDBkey()

MediaWiki\Page\PageReference::getDBkey ( )

Get the page title in DB key form.

Note
This may return a string starting with a hash, if the PageReference represents the target of a block or unblock operation. This is due to the way the block target is represented in the logging table. This is intended to change in the future.
This may return an empty string, if this PageReference is a Title that represents a relative section link. This is intended to change in the future.
Returns
string

Implemented in MediaWiki\Page\PageReferenceValue, MediaWiki\Page\ProperPageIdentity, WikiPage, and MediaWiki\Title\Title.

Referenced by JobSpecification\__construct(), MediaWiki\Deferred\LinksUpdate\LinksDeletionUpdate\__construct(), MediaWiki\Output\OutputPage\getJSVars(), MediaWiki\Revision\ArchivedRevisionLookup\getLastRevisionId(), MediaWiki\Specials\SpecialExport\getPagesFromCategory(), MediaWiki\Category\CategoryViewer\getSubcategorySortChar(), MediaWiki\Revision\ArchivedRevisionLookup\listRevisions(), RecentChange\newForCategorization(), MediaWiki\Category\Category\newFromRow(), MediaWiki\Revision\RevisionStore\newRevisionsFromBatch(), and WikiExporter\pageByTitle().

◆ getNamespace()

◆ getWikiId()

MediaWiki\Page\PageReference::getWikiId ( )

Get the ID of the wiki this page belongs to.

Returns
string|false The wiki's logical name, or self::LOCAL to indicate the local wiki.

Implements MediaWiki\DAO\WikiAwareEntity.

Implemented in MediaWiki\Page\PageReferenceValue, MediaWiki\Page\ProperPageIdentity, WikiPage, and MediaWiki\Title\Title.

Referenced by MediaWiki\Deferred\LinksUpdate\LinksDeletionUpdate\__construct().

◆ isSamePageAs()

MediaWiki\Page\PageReference::isSamePageAs ( PageReference $other)

Checks whether the given PageReference refers to the same page as this PageReference.

Two PageReference instances are considered to refer to the same page if they belong to the same wiki, and have the same namespace and DB key.

Parameters
PageReference$other
Returns
bool

Implemented in MediaWiki\Page\PageReferenceValue, WikiPage, and MediaWiki\Title\Title.


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