MediaWiki
1.30.0
|
Gives access to properties of a page. More...
Public Member Functions | |
ensureCacheSize ( $size) | |
Ensure that cache has at least this size. More... | |
getAllProperties ( $titles) | |
Get all page property values. More... | |
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. More... | |
Static Public Member Functions | |
static | getInstance () |
static | overrideInstance (PageProps $store=null) |
Overrides the default instance of this class This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined. More... | |
Public Attributes | |
const | CACHE_SIZE = 100 |
const | CACHE_TTL = 10 |
Cache parameters. More... | |
Private Member Functions | |
__construct () | |
Create a PageProps object. More... | |
cacheProperties ( $pageID, $pageProperties) | |
Save properties to the cache. More... | |
cacheProperty ( $pageID, $propertyName, $propertyValue) | |
Save a property to the cache. More... | |
getCachedProperties ( $pageID) | |
Get properties from the cache. More... | |
getCachedProperty ( $pageID, $propertyName) | |
Get a property from the cache. More... | |
getGoodIDs ( $titles) | |
Private Attributes | |
$cache = null | |
Property cache. More... | |
Static Private Attributes | |
static PageProps | $instance |
|
private |
|
private |
Save properties to the cache.
int | $pageID | page ID of page being cached |
string[] | $pageProperties | associative array of page properties to be cached |
Definition at line 312 of file PageProps.php.
References cache.
Referenced by getAllProperties().
|
private |
Save a property to the cache.
int | $pageID | page ID of page being cached |
string | $propertyName | name of property being cached |
mixed | $propertyValue | value of property |
Definition at line 302 of file PageProps.php.
References cache.
Referenced by getProperties().
PageProps::ensureCacheSize | ( | $size | ) |
Ensure that cache has at least this size.
int | $size |
Definition at line 91 of file PageProps.php.
References cache.
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.
Definition at line 187 of file PageProps.php.
References $dbr, $titles, as, cacheProperties(), DB_REPLICA, getCachedProperties(), getGoodIDs(), and wfGetDB().
|
private |
Get properties from the cache.
int | $pageID | page ID of page being queried |
Definition at line 288 of file PageProps.php.
References cache.
Referenced by getAllProperties().
|
private |
Get a property from the cache.
int | $pageID | page ID of page being queried |
string | $propertyName | name of property being queried |
Definition at line 269 of file PageProps.php.
References cache.
Referenced by getProperties().
|
private |
Definition at line 242 of file PageProps.php.
References $title, $titles, as, and execute().
Referenced by getAllProperties(), and getProperties().
|
static |
Definition at line 66 of file PageProps.php.
References $instance.
Referenced by AugmentPageProps\augmentAll(), ApiQueryPageProps\execute(), WikiCategoryPage\isHidden(), InfoAction\pageInfo(), TestPageProps\testClearCache(), TestPageProps\testGetAllProperties(), TestPageProps\testGetAllPropertiesMultiplePages(), TestPageProps\testGetMultiplePropertiesMultiplePages(), TestPageProps\testGetSingleProperty(), TestPageProps\testGetSinglePropertyMultiplePages(), TestPageProps\testMultiCache(), and TestPageProps\testSingleCache().
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.
Definition at line 115 of file PageProps.php.
References $dbr, $titles, as, cacheProperty(), DB_REPLICA, getCachedProperty(), getGoodIDs(), and wfGetDB().
|
static |
Overrides the default instance of this class This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
If this method is used it MUST also be called with null after a test to ensure a new default instance is created next time getInstance is called.
PageProps | null | $store |
MWException |
Definition at line 50 of file PageProps.php.
References $instance, and use.
Referenced by WikiCategoryPageTest\testHiddenCategory_PropertyIsSet(), WikiCategoryPageTest\testHiddenCategory_PropertyNotSet(), and RecentChangeTest\testHiddenCategoryChange().
|
private |
Property cache.
Definition at line 78 of file PageProps.php.
|
staticprivate |
Definition at line 34 of file PageProps.php.
Referenced by getInstance(), and overrideInstance().
const PageProps::CACHE_SIZE = 100 |
Definition at line 75 of file PageProps.php.
const PageProps::CACHE_TTL = 10 |
Cache parameters.
Definition at line 74 of file PageProps.php.