MediaWiki  master
Page\PageStore Class Reference
Inheritance diagram for Page\PageStore:
Collaboration diagram for Page\PageStore:

Public Member Functions

 __construct (ServiceOptions $options, ILoadBalancer $dbLoadBalancer, NamespaceInfo $namespaceInfo, TitleParser $titleParser, $wikiId=WikiAwareEntity::LOCAL)
 
 getExistingPageByText (string $text, int $defaultNamespace=NS_MAIN, int $queryFlags=self::READ_NORMAL)
 
 getPageById (int $pageId, int $queryFlags=self::READ_NORMAL)
 
 getPageByName (int $namespace, string $dbKey, int $queryFlags=self::READ_NORMAL)
 
 getPageByReference (PageReference $page, int $queryFlags=self::READ_NORMAL)
 
 getPageByText (string $text, int $defaultNamespace=NS_MAIN, int $queryFlags=self::READ_NORMAL)
 
 getPageForLink (LinkTarget $link, int $queryFlags=self::READ_NORMAL)
 
 getSelectFields ()
 
 getSubpages (PageIdentity $page, int $limit)
 Get all subpages of this page. More...
 
 newPageRecordFromRow (stdClass $row)
 
 newSelectQueryBuilder ( $dbOrFlags=self::READ_NORMAL)
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 
- Public Attributes inherited from IDBAccessObject
const READ_NONE = -1
 Constants for object loading bitfield flags (higher => higher QoS) More...
 

Private Member Functions

 getDBConnectionRef (int $mode=DB_REPLICA)
 
 loadPageFromConditions (array $conds, int $queryFlags=self::READ_NORMAL)
 

Private Attributes

ILoadBalancer $dbLoadBalancer
 
NamespaceInfo $namespaceInfo
 
ServiceOptions $options
 
TitleParser $titleParser
 
string false $wikiId
 

Detailed Description

Since
1.36
Stability: unstable

Definition at line 26 of file PageStore.php.

Constructor & Destructor Documentation

◆ __construct()

Page\PageStore::__construct ( ServiceOptions  $options,
ILoadBalancer  $dbLoadBalancer,
NamespaceInfo  $namespaceInfo,
TitleParser  $titleParser,
  $wikiId = WikiAwareEntity::LOCAL 
)
Parameters
ServiceOptions$options
ILoadBalancer$dbLoadBalancer
NamespaceInfo$namespaceInfo
TitleParser$titleParser
false | string$wikiId

Definition at line 57 of file PageStore.php.

References Page\PageStore\$dbLoadBalancer, Page\PageStore\$namespaceInfo, Page\PageStore\$options, Page\PageStore\$titleParser, and Page\PageStore\$wikiId.

Member Function Documentation

◆ getDBConnectionRef()

Page\PageStore::getDBConnectionRef ( int  $mode = DB_REPLICA)
private
Parameters
int$modeDB_PRIMARY or DB_REPLICA
Returns
IDatabase

Definition at line 306 of file PageStore.php.

Referenced by Page\PageStore\newSelectQueryBuilder().

◆ getExistingPageByText()

Page\PageStore::getExistingPageByText ( string  $text,
int  $defaultNamespace = NS_MAIN,
int  $queryFlags = self::READ_NORMAL 
)
Since
1.37
Parameters
string$text
int$defaultNamespaceNamespace to assume per default (usually NS_MAIN)
int$queryFlags
Returns
ExistingPageRecord|null

Implements Page\PageLookup.

Definition at line 161 of file PageStore.php.

References Page\PageStore\getPageByReference(), and Page\PageStore\getPageByText().

◆ getPageById()

Page\PageStore::getPageById ( int  $pageId,
int  $queryFlags = self::READ_NORMAL 
)
Parameters
int$pageId
int$queryFlags
Returns
ExistingPageRecord|null

Implements Page\PageLookup.

Definition at line 179 of file PageStore.php.

References Page\PageStore\loadPageFromConditions().

Referenced by Page\PageStore\getPageByReference().

◆ getPageByName()

Page\PageStore::getPageByName ( int  $namespace,
string  $dbKey,
int  $queryFlags = self::READ_NORMAL 
)
Parameters
int$namespace
string$dbKey
int$queryFlags
Returns
ExistingPageRecord|null

Implements Page\PageLookup.

Definition at line 111 of file PageStore.php.

References Page\PageStore\loadPageFromConditions().

Referenced by Page\PageStore\getPageByReference(), and Page\PageStore\getPageForLink().

◆ getPageByReference()

Page\PageStore::getPageByReference ( PageReference  $page,
int  $queryFlags = self::READ_NORMAL 
)
Parameters
PageReference$page
int$queryFlags
Returns
ExistingPageRecord|null The page's PageRecord, or null if the page was not found.

Implements Page\PageLookup.

Definition at line 198 of file PageStore.php.

References MediaWiki\DAO\WikiAwareEntity\assertWiki(), Page\PageReference\getDBkey(), Page\PageReference\getNamespace(), Page\PageStore\getPageById(), and Page\PageStore\getPageByName().

Referenced by Page\PageStore\getExistingPageByText().

◆ getPageByText()

Page\PageStore::getPageByText ( string  $text,
int  $defaultNamespace = NS_MAIN,
int  $queryFlags = self::READ_NORMAL 
)
Since
1.37
Parameters
string$text
int$defaultNamespaceNamespace to assume per default (usually NS_MAIN)
int$queryFlags
Returns
ProperPageIdentity|null

Implements Page\PageLookup.

Definition at line 137 of file PageStore.php.

References $title, and Page\PageStore\getPageForLink().

Referenced by Page\PageStore\getExistingPageByText().

◆ getPageForLink()

Page\PageStore::getPageForLink ( LinkTarget  $link,
int  $queryFlags = self::READ_NORMAL 
)
Parameters
LinkTarget$link
int$queryFlags
Returns
ProperPageIdentity

Implements Page\PageLookup.

Definition at line 79 of file PageStore.php.

References Page\PageStore\getPageByName(), NS_FILE, and NS_MEDIA.

Referenced by Page\PageStore\getPageByText().

◆ getSelectFields()

Page\PageStore::getSelectFields ( )
Access: internal
Returns
string[]

Definition at line 258 of file PageStore.php.

◆ getSubpages()

Page\PageStore::getSubpages ( PageIdentity  $page,
int  $limit 
)

Get all subpages of this page.

Will return an empty list of the namespace doesn't support subpages.

Parameters
PageIdentity$page
int$limitMaximum number of subpages to fetch
Returns
Iterator<ExistingPageRecord>

Definition at line 319 of file PageStore.php.

References Page\PageReference\getDBkey(), Page\PageReference\getNamespace(), and Page\PageStore\newSelectQueryBuilder().

◆ loadPageFromConditions()

Page\PageStore::loadPageFromConditions ( array  $conds,
int  $queryFlags = self::READ_NORMAL 
)
private
Parameters
array$conds
int$queryFlags
Returns
ExistingPageRecord|null

Definition at line 228 of file PageStore.php.

References Page\PageStore\newSelectQueryBuilder().

Referenced by Page\PageStore\getPageById(), and Page\PageStore\getPageByName().

◆ newPageRecordFromRow()

Page\PageStore::newPageRecordFromRow ( stdClass  $row)
Access: internal
Parameters
stdClass$row
Returns
ExistingPageRecord

Definition at line 246 of file PageStore.php.

◆ newSelectQueryBuilder()

Page\PageStore::newSelectQueryBuilder (   $dbOrFlags = self::READ_NORMAL)
Stability: unstable
Parameters
IDatabase | int | null$dbOrFlagsThe database connection to use, or a READ_XXX constant indicating what kind of database connection to use.
Returns
PageSelectQueryBuilder

Definition at line 287 of file PageStore.php.

References Page\PageStore\$options, Page\PageStore\getDBConnectionRef(), and DBAccessObjectUtils\getDBOptions().

Referenced by Page\PageStore\getSubpages(), and Page\PageStore\loadPageFromConditions().

Member Data Documentation

◆ $dbLoadBalancer

ILoadBalancer Page\PageStore::$dbLoadBalancer
private

Definition at line 32 of file PageStore.php.

Referenced by Page\PageStore\__construct().

◆ $namespaceInfo

NamespaceInfo Page\PageStore::$namespaceInfo
private

Definition at line 35 of file PageStore.php.

Referenced by Page\PageStore\__construct().

◆ $options

ServiceOptions Page\PageStore::$options
private

◆ $titleParser

TitleParser Page\PageStore::$titleParser
private

Definition at line 38 of file PageStore.php.

Referenced by Page\PageStore\__construct().

◆ $wikiId

string false Page\PageStore::$wikiId
private

Definition at line 41 of file PageStore.php.

Referenced by Page\PageStore\__construct().

◆ CONSTRUCTOR_OPTIONS

const Page\PageStore::CONSTRUCTOR_OPTIONS
Initial value:
= [
'PageLanguageUseDB',
]
Access: internal
for use by service wiring

Definition at line 46 of file PageStore.php.


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