MediaWiki master
|
Category objects are immutable, strictly speaking. More...
Public Member Functions | |
getFileCount () | |
getID () | |
getMemberCount () | |
getMembers ( $limit=false, $offset='') | |
Fetch a TitleArray of up to $limit category members, beginning after the category sort key $offset. | |
getName () | |
getPage () | |
getPageCount ( $type=self::COUNT_ALL_MEMBERS) | |
getSubcatCount () | |
getTitle () | |
refreshCounts () | |
Refresh the counts for this category. | |
refreshCountsIfEmpty () | |
Call refreshCounts() if there are no entries in the categorylinks table or if the category table has a row that states that there are no entries. | |
refreshCountsIfSmall ( $maxSize=self::ROW_COUNT_SMALL) | |
Call refreshCounts() if there are few entries in the categorylinks table. | |
Static Public Member Functions | |
static | newFromID ( $id) |
Factory function. | |
static | newFromName ( $name) |
Factory function. | |
static | newFromRow (stdClass $row, ?PageIdentity $page=null) |
Factory function, for constructing a Category object from a result set. | |
static | newFromTitle (PageIdentity $page) |
Factory function. | |
Public Attributes | |
const | COUNT_ALL_MEMBERS = 0 |
const | COUNT_CONTENT_PAGES = 1 |
const | ROW_COUNT_SMALL = 100 |
Protected Member Functions | |
initialize ( $mode=self::LOAD_ONLY) | |
Set up all member variables using a database query. | |
Protected Attributes | |
const | LAZY_INIT_ROW = 1 |
const | LOAD_ONLY = 0 |
Category objects are immutable, strictly speaking.
If you call methods that change the database, like to refresh link counts, the objects will be appropriately reinitialized. Member variables are lazy-initialized.
Definition at line 42 of file Category.php.
MediaWiki\Category\Category::getFileCount | ( | ) |
Definition at line 303 of file Category.php.
MediaWiki\Category\Category::getID | ( | ) |
Definition at line 266 of file Category.php.
MediaWiki\Category\Category::getMemberCount | ( | ) |
Definition at line 273 of file Category.php.
MediaWiki\Category\Category::getMembers | ( | $limit = false, | |
$offset = '' ) |
Fetch a TitleArray of up to $limit category members, beginning after the category sort key $offset.
int | false | $limit | |
string | $offset |
Definition at line 340 of file Category.php.
MediaWiki\Category\Category::getName | ( | ) |
Definition at line 259 of file Category.php.
MediaWiki\Category\Category::getPage | ( | ) |
Definition at line 312 of file Category.php.
Referenced by MediaWiki\Category\CategoryViewer\addSubcategoryObject().
MediaWiki\Category\Category::getPageCount | ( | $type = self::COUNT_ALL_MEMBERS | ) |
int | $type | One of self::COUNT_ALL_MEMBERS and self::COUNT_CONTENT_PAGES |
Definition at line 283 of file Category.php.
MediaWiki\Category\Category::getSubcatCount | ( | ) |
Definition at line 296 of file Category.php.
MediaWiki\Category\Category::getTitle | ( | ) |
Definition at line 329 of file Category.php.
|
protected |
Set up all member variables using a database query.
int | $mode | One of (Category::LOAD_ONLY, Category::LAZY_INIT_ROW) |
Definition at line 92 of file Category.php.
|
static |
Factory function.
int | $id | A category id. Warning, no validation is performed! |
Definition at line 206 of file Category.php.
|
static |
Factory function.
string | $name | A category name (no "Category:" prefix). It need not be normalized, with spaces replaced by underscores. |
Definition at line 171 of file Category.php.
References NS_CATEGORY.
|
static |
Factory function, for constructing a Category object from a result set.
stdClass | $row | Result set row, must contain the cat_xxx fields. If the fields are null, the resulting Category object will represent an empty category if a page object was given. If the fields are null and no PageIdentity was given, this method fails and returns false. |
PageIdentity | null | $page | This must be provided if there is no cat_title field in $row. |
Definition at line 222 of file Category.php.
References MediaWiki\Page\PageReference\getDBkey().
|
static |
Factory function.
PageIdentity | $page | Category page. Warning, no validation is performed! |
Definition at line 191 of file Category.php.
Referenced by MediaWiki\Category\CategoryViewer\__construct().
MediaWiki\Category\Category::refreshCounts | ( | ) |
Refresh the counts for this category.
Definition at line 379 of file Category.php.
References NS_CATEGORY, and NS_FILE.
MediaWiki\Category\Category::refreshCountsIfEmpty | ( | ) |
Call refreshCounts() if there are no entries in the categorylinks table or if the category table has a row that states that there are no entries.
Due to lock errors or other failures, the precomputed counts can get out of sync, making it hard to know when to delete the category row without checking the categorylinks table.
Definition at line 513 of file Category.php.
MediaWiki\Category\Category::refreshCountsIfSmall | ( | $maxSize = self::ROW_COUNT_SMALL | ) |
Call refreshCounts() if there are few entries in the categorylinks table.
Due to lock errors or other failures, the precomputed counts can get out of sync, making it hard to know when to delete the category row without checking the categorylinks table.
This method will do a non-locking select first to reduce contention.
int | $maxSize | Only refresh if there are this or less many backlinks |
Definition at line 530 of file Category.php.
const MediaWiki\Category\Category::COUNT_ALL_MEMBERS = 0 |
Definition at line 68 of file Category.php.
const MediaWiki\Category\Category::COUNT_CONTENT_PAGES = 1 |
Definition at line 69 of file Category.php.
|
protected |
Definition at line 64 of file Category.php.
|
protected |
Definition at line 63 of file Category.php.
const MediaWiki\Category\Category::ROW_COUNT_SMALL = 100 |
Definition at line 66 of file Category.php.