MediaWiki master
MediaWiki\Page\PageProps Class Reference

Gives access to properties of a page. More...

Public Member Functions

 __construct (LinkBatchFactory $linkBatchFactory, IConnectionProvider $dbProvider)
 
 ensureCacheSize ( $size)
 Ensure that cache has at least this size.
 
 getAllProperties ( $titles)
 Get all page properties of one or more page titles.
 
 getProperties ( $titles, $propertyNames)
 Fetch one or more properties for one or more Titles.
 

Detailed Description

Gives access to properties of a page.

Since
1.27

Definition at line 35 of file PageProps.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\PageProps::__construct ( LinkBatchFactory $linkBatchFactory,
IConnectionProvider $dbProvider )
Parameters
LinkBatchFactory$linkBatchFactory
IConnectionProvider$dbProvider

Definition at line 49 of file PageProps.php.

Member Function Documentation

◆ ensureCacheSize()

MediaWiki\Page\PageProps::ensureCacheSize ( $size)

Ensure that cache has at least this size.

Parameters
int$size

Definition at line 62 of file PageProps.php.

◆ getAllProperties()

MediaWiki\Page\PageProps::getAllProperties ( $titles)

Get all page properties of one or more page titles.

Given one or more Titles, returns an array keyed by page ID to another array from property names to property values.

If a single Title is provided without an array, the output will still be returned as an array by page ID.

Pages in the provided set of Titles that do have no page properties, will not get a page ID key in the returned array.

An empty array will be returned if none of the titles have any page properties.

Parameters
iterable<PageIdentity>|PageIdentity$titles
Returns
array<int,array<string,string>> Keyed by page ID and property name to property value

Definition at line 157 of file PageProps.php.

◆ getProperties()

MediaWiki\Page\PageProps::getProperties ( $titles,
$propertyNames )

Fetch one or more properties for one or more Titles.

Returns an associative array mapping page ID to property value.

If a single Title is provided without an array, the output will still be returned as an array by page ID.

Pages in the provided set of Titles that do not have a value for any of the properties will not appear in the returned array.

If a single property name is requested, it does not need to be passed in as an array. In that case, the return array will map directly from page ID to property value. Otherwise, a multi-dimensional array is returned keyed by page ID, then property name, to property value.

An empty array will be returned if no matching properties were found.

Parameters
iterable<PageIdentity>|PageIdentity$titles
string[] | string$propertyNames
Returns
array<int,string|array<string,string>> Keyed by page ID and property name to property value

Definition at line 91 of file PageProps.php.


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