MediaWiki
REL1_19
|
Category objects are immutable, strictly speaking. More...
Public Member Functions | |
getFileCount () | |
getID () | |
getMembers ($limit=false, $offset= '') | |
Fetch a TitleArray of up to $limit category members, beginning after the category sort key $offset. | |
getName () | |
getPageCount () | |
getSubcatCount () | |
getTitle () | |
refreshCounts () | |
Refresh the counts for this category. | |
Static Public Member Functions | |
static | newFromID ($id) |
Factory function. | |
static | newFromName ($name) |
Factory function. | |
static | newFromRow ($row, $title=null) |
Factory function, for constructing a Category object from a result set. | |
static | newFromTitle ($title) |
Factory function. | |
Public Attributes | |
$mFiles = null | |
$mSubcats = null | |
Protected Member Functions | |
initialize () | |
Set up all member variables using a database query. | |
Private Member Functions | |
__construct () | |
getX ($key) | |
Generic accessor. | |
Private Attributes | |
$mID = null | |
$mName = null | |
Name of the category, normalized to DB-key form. | |
$mPages = null | |
Counts of membership (cat_pages, cat_subcats, cat_files) | |
$mTitle = null |
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.
TODO: Move some stuff from CategoryPage.php to here, and use that.
Definition at line 12 of file Category.php.
Category::__construct | ( | ) | [private] |
Definition at line 24 of file Category.php.
Definition at line 185 of file Category.php.
References getX().
Category::getID | ( | ) |
Definition at line 176 of file Category.php.
References getX().
Category::getMembers | ( | $ | limit = false , |
$ | offset = '' |
||
) |
Fetch a TitleArray of up to $limit category members, beginning after the category sort key $offset.
$limit | integer |
$offset | string |
Definition at line 208 of file Category.php.
References $dbr, $limit, $options, getName(), TitleArray\newFromResult(), and wfGetDB().
Definition at line 173 of file Category.php.
References getX().
Referenced by getMembers().
Definition at line 179 of file Category.php.
References getX().
Definition at line 182 of file Category.php.
References getX().
Definition at line 190 of file Category.php.
References initialize(), and Title\makeTitleSafe().
Referenced by CategoryViewer\addSubcategoryObject().
Category::getX | ( | $ | key | ) | [private] |
Generic accessor.
Definition at line 235 of file Category.php.
References initialize().
Referenced by getFileCount(), getID(), getName(), getPageCount(), and getSubcatCount().
Category::initialize | ( | ) | [protected] |
Set up all member variables using a database query.
Definition at line 30 of file Category.php.
References $dbr, refreshCounts(), and wfGetDB().
Referenced by getTitle(), getX(), and refreshCounts().
static Category::newFromID | ( | $ | id | ) | [static] |
Factory function.
$id | Integer: a category id |
Definition at line 123 of file Category.php.
static Category::newFromName | ( | $ | name | ) | [static] |
Factory function.
$name | Array: A category name (no "Category:" prefix). It need not be normalized, with spaces replaced by underscores. |
Definition at line 88 of file Category.php.
References $title, and Title\makeTitleSafe().
Referenced by PopulateCategory\doPopulateCategory(), and CoreParserFunctions\pagesincategory().
static Category::newFromRow | ( | $ | row, |
$ | title = null |
||
) | [static] |
Factory function, for constructing a Category object from a result set.
$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 title object was given. If the fields are null and no title was given, this method fails and returns false. | |
Title | $title | optional title object for the category represented by the given row. May be provided if it is already known, to avoid having to re-create a title object later. |
Definition at line 139 of file Category.php.
References $title.
Referenced by CategoryViewer\doCategoryQuery().
static Category::newFromTitle | ( | $ | title | ) | [static] |
Factory function.
$title | Title for the category page |
Definition at line 108 of file Category.php.
References $title.
Referenced by CategoryViewer\__construct(), CategoryViewer\addSubcategory(), WikiCategoryPage\hasViewableContent(), and SpecialSearch\showHit().
Refresh the counts for this category.
Definition at line 247 of file Category.php.
References $result, initialize(), wfGetDB(), and wfReadOnly().
Referenced by initialize().
Category::$mFiles = null |
Definition at line 22 of file Category.php.
Category::$mID = null [private] |
Definition at line 15 of file Category.php.
Category::$mName = null [private] |
Name of the category, normalized to DB-key form.
Definition at line 14 of file Category.php.
Category::$mPages = null [private] |
Counts of membership (cat_pages, cat_subcats, cat_files)
Definition at line 22 of file Category.php.
Category::$mSubcats = null |
Definition at line 22 of file Category.php.
Category::$mTitle = null [private] |
Definition at line 20 of file Category.php.