MediaWiki REL1_37
|
Immutable value object representing a page identity. More...
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) | |
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. | |
Private Attributes | |
int | $pageId |
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 41 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 | bool | $wikiId | The Id of the wiki this page belongs to, or self::LOCAL for the local wiki. |
Definition at line 76 of file PageIdentityValue.php.
References MediaWiki\Page\PageReferenceValue\$dbKey, MediaWiki\Page\PageReferenceValue\$namespace, MediaWiki\Page\PageIdentityValue\$pageId, and MediaWiki\Page\PageReferenceValue\$wikiId.
MediaWiki\Page\PageIdentityValue::canExist | ( | ) |
Implements MediaWiki\Page\ProperPageIdentity.
Definition at line 129 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 122 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 112 of file PageIdentityValue.php.
|
static |
Create PageIdentity for a local page.
int | $pageId | |
int | $namespace | |
string | $dbKey |
Definition at line 100 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 | bool | $wikiId | The Id of the wiki this page belongs to, or self::LOCAL for the local wiki. |
Definition at line 61 of file PageIdentityValue.php.
References MediaWiki\Page\PageReferenceValue\$dbKey, MediaWiki\Page\PageReferenceValue\$namespace, MediaWiki\Page\PageIdentityValue\$pageId, and MediaWiki\Page\PageReferenceValue\$wikiId.
|
private |
Definition at line 44 of file PageIdentityValue.php.
Referenced by MediaWiki\Page\PageIdentityValue\__construct(), and MediaWiki\Page\PageIdentityValue\tryNew().