MediaWiki master
|
Immutable value object representing a page identity. More...
Inherits MediaWiki\Page\PageReferenceValue, and MediaWiki\Page\ProperPageIdentity.
Inherited by MediaWiki\Page\PageStoreRecord.
Public Member Functions | ||||
__construct (int $pageId, int $namespace, string $dbKey, $wikiId) | ||||
canExist () | ||||
exists () | ||||
Returns whether the page currently exists. | ||||
getId ( $wikiId=self::LOCAL) | ||||
The numerical page ID provided to the constructor. | ||||
Public Member Functions inherited from MediaWiki\Page\PageReferenceValue | ||||
__construct (int $namespace, string $dbKey, $wikiId) | ||||
__toString () | ||||
Returns a string representation of the title, for logging. | ||||
getDBkey () | ||||
Get the page title in DB key form.
| ||||
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.
| ||||
getWikiId () | ||||
Get the ID of the wiki provided to the constructor. | ||||
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.
| ||||
Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity | ||||
assertWiki ( $wikiId) | ||||
Throws if $wikiId is different from the return value of getWikiId(). | ||||
Public Member Functions inherited from MediaWiki\Page\ProperPageIdentity | ||||
getDBkey () | ||||
Get the page title in DB key form. | ||||
getWikiId () | ||||
Get the ID of the wiki this page belongs to. | ||||
Static Public Member Functions | |
static | localIdentity (int $pageId, int $namespace, string $dbKey) |
Create PageIdentity for a local page. | |
static | tryNew (int $pageId, int $namespace, string $dbKey, $wikiId) |
Constructs a PageIdentityValue, or returns null if the parameters are not valid. | |
Static Public Member Functions inherited from MediaWiki\Page\PageReferenceValue | |
static | localReference (int $namespace, string $dbKey) |
Create PageReference for a local page. | |
Immutable value object representing a page identity.
Instances of this class are expected to always represent proper pages, that is, pages that can at least potentially exist as editable pages on the wiki. This class cannot represent Special pages, interwiki links, section links, etc.
Code that deserializes instances of PageIdentityValue must ensure that the original meaning of the "local" Wiki ID is preserved: When an instance of PageIdentityValue is created with self::LOCAL as the Wiki ID on one wiki, gets serialized, stored, and later read and unserialized on another wiki, the value of the Wiki ID must be adjusted to refer to the original wiki.
Definition at line 43 of file PageIdentityValue.php.
MediaWiki\Page\PageIdentityValue::__construct | ( | int | $pageId, |
int | $namespace, | ||
string | $dbKey, | ||
$wikiId ) |
int | $pageId | The ID of this page, or 0 if the page does not exist. |
int | $namespace | A valid namespace ID. Validation is the caller's responsibility! |
string | $dbKey | A valid DB key. Validation is the caller's responsibility! |
string | false | $wikiId | The Id of the wiki this page belongs to, or self::LOCAL for the local wiki. |
Definition at line 78 of file PageIdentityValue.php.
MediaWiki\Page\PageIdentityValue::canExist | ( | ) |
Implements MediaWiki\Page\ProperPageIdentity.
Definition at line 131 of file PageIdentityValue.php.
MediaWiki\Page\PageIdentityValue::exists | ( | ) |
Returns whether the page currently exists.
Returns true if getId() returns a value greater than zero.
Implements MediaWiki\Page\PageIdentity.
Definition at line 124 of file PageIdentityValue.php.
MediaWiki\Page\PageIdentityValue::getId | ( | $wikiId = self::LOCAL | ) |
The numerical page ID provided to the constructor.
string | false | $wikiId | The wiki ID expected by the caller. Omit if expecting the local wiki. |
Implements MediaWiki\Page\ProperPageIdentity.
Definition at line 114 of file PageIdentityValue.php.
|
static |
Create PageIdentity for a local page.
int | $pageId | |
int | $namespace | |
string | $dbKey |
Definition at line 102 of file PageIdentityValue.php.
|
static |
Constructs a PageIdentityValue, or returns null if the parameters are not valid.
int | $pageId | The ID of this page, or 0 if the page does not exist. |
int | $namespace | A valid namespace ID. Validation is the caller's responsibility! |
string | $dbKey | A valid DB key. Validation is the caller's responsibility! |
string | false | $wikiId | The Id of the wiki this page belongs to, or self::LOCAL for the local wiki. |
Definition at line 63 of file PageIdentityValue.php.