MediaWiki
REL1_24
|
The "CategoryFinder" class takes a list of articles, creates an internal representation of all their parent categories (as well as parents of parents etc.). More...
Public Member Functions | |
getParents () | |
Get the parents. | |
run () | |
Iterates through the parent tree starting with the seed values, then checks the articles if they match the conditions. | |
seed ($articleIds, $categories, $mode= 'AND') | |
Initializes the instance. | |
Protected Attributes | |
int[] | $articles = array() |
The original article IDs passed to the seed function *. | |
DatabaseBase | $dbr |
Read-DB slave *. | |
array | $deadend = array() |
Array of DBKEY category names for categories that don't have a page *. | |
string | $mode |
"AND" or "OR" * | |
array | $name2id = array() |
* | |
$next = array() | |
array | $parents = array() |
Array of [ID => array()] *. | |
array | $targets = array() |
Array of DBKEY category names *. | |
Private Member Functions | |
check ($id, &$conds, $path=array()) | |
This functions recurses through the parent representation, trying to match the conditions. | |
scanNextLayer () | |
Scans a "parent layer" of the articles/categories in $this->next. |
The "CategoryFinder" class takes a list of articles, creates an internal representation of all their parent categories (as well as parents of parents etc.).
From this representation, it determines which of these articles are in one or all of a given subset of categories.
Example use : # Determines whether the article with the page_id 12345 is in both # "Category 1" and "Category 2" or their subcategories, respectively
$cf = new CategoryFinder; $cf->seed( array( 12345 ), array( 'Category 1', 'Category 2' ), 'AND' ); $a = $cf->run(); print implode( ',' , $a );
Definition at line 45 of file CategoryFinder.php.
CategoryFinder::check | ( | $ | id, |
&$ | conds, | ||
$ | path = array() |
||
) | [private] |
This functions recurses through the parent representation, trying to match the conditions.
int | $id | The article/category to check |
array | $conds | The array of categories to match |
array | $path | Used to check for recursion loops |
Definition at line 125 of file CategoryFinder.php.
Get the parents.
Only really useful if run() has been called already
Definition at line 114 of file CategoryFinder.php.
Iterates through the parent tree starting with the seed values, then checks the articles if they match the conditions.
Definition at line 91 of file CategoryFinder.php.
CategoryFinder::scanNextLayer | ( | ) | [private] |
Scans a "parent layer" of the articles/categories in $this->next.
Definition at line 180 of file CategoryFinder.php.
CategoryFinder::seed | ( | $ | articleIds, |
$ | categories, | ||
$ | mode = 'AND' |
||
) |
Initializes the instance.
Do this prior to calling run().
array | $articleIds | Array of article IDs |
array | $categories | FIXME |
string | $mode | FIXME, default 'AND'. |
Definition at line 70 of file CategoryFinder.php.
Referenced by SpecialRecentChanges\filterByCategories().
int [] CategoryFinder::$articles = array() [protected] |
The original article IDs passed to the seed function *.
Definition at line 46 of file CategoryFinder.php.
DatabaseBase CategoryFinder::$dbr [protected] |
Read-DB slave *.
Definition at line 61 of file CategoryFinder.php.
Array of DBKEY category names for categories that don't have a page *.
Definition at line 48 of file CategoryFinder.php.
string CategoryFinder::$mode [protected] |
"AND" or "OR" *
Definition at line 59 of file CategoryFinder.php.
*
Definition at line 57 of file CategoryFinder.php.
CategoryFinder::$next = array() [protected] |
Definition at line 53 of file CategoryFinder.php.
Array of [ID => array()] *.
Definition at line 50 of file CategoryFinder.php.
Array of DBKEY category names *.
Definition at line 55 of file CategoryFinder.php.