MediaWiki
master
|
Interface for objects (potentially) representing an editable wiki page. More...
Public Member Functions | |
__toString () | |
Returns an informative human readable representation of the page identity, for use in logging and debugging. More... | |
canExist () | |
Checks whether this PageIdentity represents a "proper" page, meaning that it could exist as an editable page on the wiki. More... | |
exists () | |
Checks if the page currently exists. More... | |
getDBkey () | |
Get the page title in DB key form. More... | |
getId ( $wikiId=self::LOCAL) | |
Returns the page ID. More... | |
getNamespace () | |
Returns the page's namespace number. More... | |
getWikiId () | |
Get the ID of the wiki this page belongs to. More... | |
isSamePageAs (PageIdentity $other) | |
Checks whether the given PageIdentity refers to the same page as this PageIdentity. More... | |
![]() | |
assertWiki ( $wikiId) | |
Throws if $wikiId is different from the return value of getWikiId(). More... | |
Interface for objects (potentially) representing an editable wiki page.
The identity of any PageIdentity object is defined by the namespace, the dbkey, and the wiki ID. The page ID together with the wiki ID also identifies the page, unless the page ID is 0. If the wiki ID is self::LOCAL, the identity is relative to the local wiki.
Stable to type
Definition at line 65 of file PageIdentity.php.
Page\PageIdentity::__toString | ( | ) |
Returns an informative human readable representation of the page identity, for use in logging and debugging.
Implemented in Title, WikiPage, and Page\PageIdentityValue.
Page\PageIdentity::canExist | ( | ) |
Checks whether this PageIdentity represents a "proper" page, meaning that it could exist as an editable page on the wiki.
Implemented in Title, WikiPage, Page\ProperPageIdentity, and Page\PageIdentityValue.
Referenced by Page\WikiPageFactory\newFromTitle().
Page\PageIdentity::exists | ( | ) |
Checks if the page currently exists.
Implementations must ensure that this method returns false when getId() would throw or return 0. This also implies that this method must return false if canExist() would return false.
Implemented in WikiPage, and Page\PageIdentityValue.
Referenced by Title\estimateRevisionCount(), Title\getRestrictionTypes(), Title\getTitleProtectionInternal(), Title\hasSourceText(), Title\isKnown(), and Title\makeTitleSafe().
Page\PageIdentity::getDBkey | ( | ) |
Get the page title in DB key form.
Implemented in Title, WikiPage, and Page\PageIdentityValue.
Referenced by Title\castFromPageIdentity(), WikiPage\isSamePageAs(), Title\isSamePageAs(), and TitleValue\newFromPage().
Page\PageIdentity::getId | ( | $wikiId = self::LOCAL | ) |
Returns the page ID.
If this ID is 0, this means the page does not exist.
Implementations must call assertWiki().
string | false | $wikiId | Must be provided when accessing the ID of a non-local PageIdentity, to prevent data corruption when using a PageIdentity belonging to one wiki in the context of another. Should be omitted if expecting the local wiki. |
RuntimeException | if this PageIdentity is not a "proper" page identity, but e.g. a relative section link, an interwiki link, etc. |
PreconditionException | if this PageIdentity does not belong to the wiki identified by $wikiId. |
Implemented in Title, WikiPage, Page\ProperPageIdentity, and Page\PageIdentityValue.
Referenced by Title\castFromPageIdentity(), WikiPage\isSamePageAs(), and Title\isSamePageAs().
Page\PageIdentity::getNamespace | ( | ) |
Returns the page's namespace number.
The value returned by this method should represent a valid namespace, but this cannot be guaranteed in all cases.
Implemented in Title, WikiPage, and Page\PageIdentityValue.
Referenced by Title\castFromPageIdentity(), WikiPage\isSamePageAs(), Title\isSamePageAs(), TitleValue\newFromPage(), and Page\WikiPageFactory\newFromTitle().
Page\PageIdentity::getWikiId | ( | ) |
Get the ID of the wiki this page belongs to.
Implements MediaWiki\DAO\WikiAwareEntity.
Implemented in Title, WikiPage, Page\ProperPageIdentity, and Page\PageIdentityValue.
Referenced by WikiPage\isSamePageAs(), Title\isSamePageAs(), and TitleValue\newFromPage().
Page\PageIdentity::isSamePageAs | ( | PageIdentity | $other | ) |
Checks whether the given PageIdentity refers to the same page as this PageIdentity.
Two PageIdentity instances are considered to refer to the same page if the page exists, they belong to the same wiki, and have the same ID; or the page does not exist, they belong to the same wiki, and have the same namespace and DB key.
PageIdentity | $other |
Implemented in Title, WikiPage, and Page\PageIdentityValue.