MediaWiki  REL1_22
Category Class Reference

Category objects are immutable, strictly speaking. More...

Collaboration diagram for Category:

List of all members.

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)
Title $mTitle = null
 Category page title.

Detailed Description

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 31 of file Category.php.


Constructor & Destructor Documentation

Category::__construct ( ) [private]

Definition at line 42 of file Category.php.


Member Function Documentation

Returns:
mixed Number of member files, or false on failure

Definition at line 218 of file Category.php.

Returns:
mixed Category ID, or false on failure

Definition at line 203 of file Category.php.

Category::getMembers ( limit = false,
offset = '' 
)

Fetch a TitleArray of up to $limit category members, beginning after the category sort key $offset.

Parameters:
$limitinteger
$offsetstring
Returns:
TitleArray object for category members.

Definition at line 245 of file Category.php.

Returns:
mixed DB key name, or false on failure

Definition at line 198 of file Category.php.

Returns:
mixed Total number of member pages, or false on failure

Definition at line 208 of file Category.php.

Returns:
mixed Number of subcategories, or false on failure

Definition at line 213 of file Category.php.

Returns:
Title|bool Title for this category, or false on failure.

Definition at line 225 of file Category.php.

Referenced by CategoryViewer\addSubcategoryObject().

Category::getX ( key) [private]

Generic accessor.

Returns:
bool

Definition at line 281 of file Category.php.

Category::initialize ( ) [protected]

Set up all member variables using a database query.

Exceptions:
MWException
Returns:
bool True on success, false on failure.

Definition at line 50 of file Category.php.

static Category::newFromID ( id) [static]

Factory function.

Parameters:
$idInteger: a category id
Returns:
Category

Definition at line 148 of file Category.php.

static Category::newFromName ( name) [static]

Factory function.

Parameters:
array$nameA category name (no "Category:" prefix). It need not be normalized, with spaces replaced by underscores.
Returns:
mixed Category, or false on a totally invalid name

Definition at line 113 of file Category.php.

Referenced by PopulateCategory\doPopulateCategory(), and WikiPage\updateCategoryCounts().

static Category::newFromRow ( row,
title = null 
) [static]

Factory function, for constructing a Category object from a result set.

Parameters:
$rowresult 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$titleoptional 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.
Returns:
Category

Definition at line 164 of file Category.php.

static Category::newFromTitle ( title) [static]

Factory function.

Parameters:
$titleTitle for the category page
Returns:
Category|bool on a totally invalid name

Definition at line 133 of file Category.php.

Referenced by WikiCategoryPage\hasViewableContent(), InfoAction\pageInfo(), and CoreParserFunctions\pagesincategory().

Refresh the counts for this category.

Returns:
bool True on success, false on failure

Definition at line 293 of file Category.php.


Member Data Documentation

Category::$mFiles = null

Definition at line 40 of file Category.php.

Category::$mID = null [private]

Definition at line 34 of file Category.php.

Category::$mName = null [private]

Name of the category, normalized to DB-key form.

Definition at line 33 of file Category.php.

Category::$mPages = null [private]

Counts of membership (cat_pages, cat_subcats, cat_files)

Definition at line 40 of file Category.php.

Category::$mSubcats = null

Definition at line 40 of file Category.php.

Title Category::$mTitle = null [private]

Category page title.

Definition at line 38 of file Category.php.


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