Gives access to properties of a page.
More...
Gives access to properties of a page.
- Since
- 1.27
Definition at line 33 of file PageProps.php.
◆ __construct()
- Parameters
-
LinkBatchFactory | $linkBatchFactory | |
ILoadBalancer | $loadBalancer | |
Definition at line 59 of file PageProps.php.
◆ cacheProperties()
PageProps::cacheProperties |
( |
|
$pageID, |
|
|
|
$pageProperties |
|
) |
| |
|
private |
Save properties to the cache.
- Parameters
-
int | $pageID | page ID of page being cached |
string[] | $pageProperties | associative array of page properties to be cached |
Definition at line 297 of file PageProps.php.
Referenced by getAllProperties().
◆ ensureCacheSize()
PageProps::ensureCacheSize |
( |
|
$size | ) |
|
Ensure that cache has at least this size.
- Parameters
-
Definition at line 72 of file PageProps.php.
◆ getAllProperties()
PageProps::getAllProperties |
( |
|
$titles | ) |
|
Get all page property values.
Given one or more Titles, returns an associative array mapping page ID to an associative array mapping property names to property values. Pages in the provided set of Titles that do not have any properties will not appear in the returned array. If a single Title is provided, it does not need to be passed in an array, but an array will always be returned. An empty array will be returned if no matching properties were found.
- Parameters
-
iterable<PageIdentity>|PageIdentity | $titles |
- Returns
- array associative array mapping page ID to property value array
Definition at line 166 of file PageProps.php.
References $dbr, cacheProperties(), DB_REPLICA, getCachedProperties(), and getGoodIDs().
◆ getCachedProperties()
PageProps::getCachedProperties |
( |
|
$pageID | ) |
|
|
private |
Get properties from the cache.
- Parameters
-
int | $pageID | page ID of page being queried |
- Returns
- string|bool property value array or false if not found
Definition at line 284 of file PageProps.php.
Referenced by getAllProperties().
◆ getCachedProperty()
PageProps::getCachedProperty |
( |
|
$pageID, |
|
|
|
$propertyName |
|
) |
| |
|
private |
Get a property from the cache.
- Parameters
-
int | $pageID | page ID of page being queried |
string | $propertyName | name of property being queried |
- Returns
- string|bool property value array or false if not found
Definition at line 265 of file PageProps.php.
Referenced by getProperties().
◆ getGoodIDs()
PageProps::getGoodIDs |
( |
|
$titles | ) |
|
|
private |
◆ getInstance()
static PageProps::getInstance |
( |
| ) |
|
|
static |
◆ getProperties()
PageProps::getProperties |
( |
|
$titles, |
|
|
|
$propertyNames |
|
) |
| |
Given one or more Titles and one or more names of properties, returns an associative array mapping page ID to property value.
Pages in the provided set of Titles that do not have a value for the given properties will not appear in the returned array. If a single Title is provided, it does not need to be passed in an array, but an array will always be returned. If a single property name is provided, it does not need to be passed in an array. In that case, an associative array mapping page ID to property value will be returned; otherwise, an associative array mapping page ID to an associative array mapping property name to property value will be returned. An empty array will be returned if no matching properties were found.
- Parameters
-
| iterable<PageIdentity>|PageIdentity | $titles |
string[] | string | $propertyNames | |
- Returns
- array associative array mapping page ID to property value
Definition at line 96 of file PageProps.php.
References $dbr, DB_REPLICA, getCachedProperty(), and getGoodIDs().
◆ $cache
◆ $linkBatchFactory
◆ $loadBalancer
◆ CACHE_SIZE
const PageProps::CACHE_SIZE = 100 |
|
private |
◆ CACHE_TTL
const PageProps::CACHE_TTL = 10 |
|
private |
The documentation for this class was generated from the following file: