MediaWiki master
MediaWiki\Page\PageLookup Interface Reference

Service for looking up information about wiki pages. More...

Inherited by MediaWiki\Page\PageStore.

Public Member Functions

 getExistingPageByText (string $text, int $defaultNamespace=NS_MAIN, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Returns an ExistingPageRecord for a given user provided page name text.
 
 getPageById (int $pageId, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Returns the PageRecord of the given page.
 
 getPageByName (int $namespace, string $dbKey, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Returns the PageRecord for the given name and namespace.
 
 getPageByReference (PageReference $page, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Returns the PageRecord of the given page.
 
 getPageByText (string $text, int $defaultNamespace=NS_MAIN, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Returns a PageIdentity for a given user provided page name text.
 
 getPageForLink (LinkTarget $link, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Returns the PageIdentity for the given LinkTarget.
 

Detailed Description

Service for looking up information about wiki pages.

Default implementation is PageStore.

Since
1.36

Definition at line 17 of file PageLookup.php.

Member Function Documentation

◆ getExistingPageByText()

MediaWiki\Page\PageLookup::getExistingPageByText ( string  $text,
int  $defaultNamespace = NS_MAIN,
int  $queryFlags = IDBAccessObject::READ_NORMAL 
)

Returns an ExistingPageRecord for a given user provided page name text.

Returns null if the page does not exist or if title is not a valid name of a proper page, e.g if it is a special page, an interwiki link, a relative section line, or simply invalid.

Since
1.37
Parameters
string$text
int$defaultNamespaceNamespace to assume per default (usually NS_MAIN)
int$queryFlags
Returns
ExistingPageRecord|null

Implemented in MediaWiki\Page\PageStore.

◆ getPageById()

MediaWiki\Page\PageLookup::getPageById ( int  $pageId,
int  $queryFlags = IDBAccessObject::READ_NORMAL 
)

Returns the PageRecord of the given page.

Parameters
int$pageId
int$queryFlags
Exceptions
InvalidArgumentExceptionif $pageId is 0 or negative.
Returns
ExistingPageRecord|null The page's PageRecord, or null if the page was not found.

Implemented in MediaWiki\Page\PageStore.

◆ getPageByName()

MediaWiki\Page\PageLookup::getPageByName ( int  $namespace,
string  $dbKey,
int  $queryFlags = IDBAccessObject::READ_NORMAL 
)

Returns the PageRecord for the given name and namespace.

Parameters
int$namespace
string$dbKey
int$queryFlags
Returns
ExistingPageRecord|null The page's PageRecord, or null if the page was not found.
Exceptions
InvalidArgumentExceptionif $namespace is negative or $dbKey is empty.

Implemented in MediaWiki\Page\PageStore.

◆ getPageByReference()

MediaWiki\Page\PageLookup::getPageByReference ( PageReference  $page,
int  $queryFlags = IDBAccessObject::READ_NORMAL 
)

Returns the PageRecord of the given page.

May return $page if that already is a PageRecord. If $page is a PageIdentity, implementations may call methods like exists() and getId() on it.

The PageReference must refer to a proper page - that is, it must not refer to a special page.

Parameters
PageReference$page
int$queryFlags
Returns
ExistingPageRecord|null The page's PageRecord, or null if the page was not found.
Exceptions
InvalidArgumentExceptionif $page does not refer to a proper page.

Implemented in MediaWiki\Page\PageStore.

◆ getPageByText()

MediaWiki\Page\PageLookup::getPageByText ( string  $text,
int  $defaultNamespace = NS_MAIN,
int  $queryFlags = IDBAccessObject::READ_NORMAL 
)

Returns a PageIdentity for a given user provided page name text.

Returns null if the title is not a valid name of a proper page, e.g if it is a special page, an interwiki link, a relative section line, or simply invalid.

Since
1.37
Parameters
string$text
int$defaultNamespaceNamespace to assume per default (usually NS_MAIN)
int$queryFlags
Returns
ProperPageIdentity|null

Implemented in MediaWiki\Page\PageStore.

◆ getPageForLink()

MediaWiki\Page\PageLookup::getPageForLink ( LinkTarget  $link,
int  $queryFlags = IDBAccessObject::READ_NORMAL 
)

Returns the PageIdentity for the given LinkTarget.

The page does not have to exist. Fragments are ignored.

The LinkTarget must refer to a proper page - that is, it must not be a relative section link, an interwiki link, or refer to a special page.

Parameters
LinkTarget$link
int$queryFlags
Exceptions
InvalidArgumentExceptionif $link does not refer to a proper page.
Returns
ProperPageIdentity

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