MediaWiki  REL1_19
Category Class Reference

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

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)
 $mTitle = null

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.

Author:
Simetrical

Definition at line 12 of file Category.php.


Constructor & Destructor Documentation

Category::__construct ( ) [private]

Definition at line 24 of file Category.php.


Member Function Documentation

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

Definition at line 185 of file Category.php.

References getX().

Here is the call graph for this function:

Returns:
mixed Category ID, or false on failure

Definition at line 176 of file Category.php.

References getX().

Here is the call graph for this function:

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

References $dbr, $limit, $options, getName(), TitleArray\newFromResult(), and wfGetDB().

Here is the call graph for this function:

Returns:
mixed DB key name, or false on failure

Definition at line 173 of file Category.php.

References getX().

Referenced by getMembers().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 179 of file Category.php.

References getX().

Here is the call graph for this function:

Returns:
mixed Number of subcategories, or false on failure

Definition at line 182 of file Category.php.

References getX().

Here is the call graph for this function:

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

Definition at line 190 of file Category.php.

References initialize(), and Title\makeTitleSafe().

Referenced by CategoryViewer\addSubcategoryObject().

Here is the call graph for this function:

Here is the caller graph for this function:

Category::getX ( key) [private]

Generic accessor.

Definition at line 235 of file Category.php.

References initialize().

Referenced by getFileCount(), getID(), getName(), getPageCount(), and getSubcatCount().

Here is the call graph for this function:

Here is the caller graph for this function:

Category::initialize ( ) [protected]

Set up all member variables using a database query.

Returns:
bool True on success, false on failure.

Definition at line 30 of file Category.php.

References $dbr, refreshCounts(), and wfGetDB().

Referenced by getTitle(), getX(), and refreshCounts().

Here is the call graph for this function:

Here is the caller graph for this function:

static Category::newFromID ( id) [static]

Factory function.

Parameters:
$idInteger: a category id
Returns:
Category

Definition at line 123 of file Category.php.

static Category::newFromName ( name) [static]

Factory function.

Parameters:
$nameArray: A 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 88 of file Category.php.

References $title, and Title\makeTitleSafe().

Referenced by PopulateCategory\doPopulateCategory(), and CoreParserFunctions\pagesincategory().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References $title.

Referenced by CategoryViewer\doCategoryQuery().

Here is the caller graph for this function:

static Category::newFromTitle ( title) [static]

Factory function.

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

Definition at line 108 of file Category.php.

References $title.

Referenced by CategoryViewer\__construct(), CategoryViewer\addSubcategory(), WikiCategoryPage\hasViewableContent(), and SpecialSearch\showHit().

Here is the caller graph for this function:

Refresh the counts for this category.

Returns:
bool True on success, false on failure

Definition at line 247 of file Category.php.

References $result, initialize(), wfGetDB(), and wfReadOnly().

Referenced by initialize().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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.


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