MediaWiki REL1_30
|
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 = [] |
The original article IDs passed to the seed function. | |
IDatabase | $dbr |
Read-DB replica DB. | |
array | $deadend = [] |
Array of DBKEY category names for categories that don't have a page. | |
string | $mode |
"AND" or "OR" | |
array | $name2id = [] |
array | $next = [] |
Array of article/category IDs. | |
array | $parents = [] |
Array of [ ID => [] ]. | |
array | $targets = [] |
Array of DBKEY category names. | |
Private Member Functions | |
check ( $id, &$conds, $path=[]) | |
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 :
Definition at line 46 of file CategoryFinder.php.
|
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 133 of file CategoryFinder.php.
References check.
CategoryFinder::getParents | ( | ) |
Get the parents.
Only really useful if run() has been called already
Definition at line 122 of file CategoryFinder.php.
References $parents.
CategoryFinder::run | ( | ) |
Iterates through the parent tree starting with the seed values, then checks the articles if they match the conditions.
Definition at line 99 of file CategoryFinder.php.
References $article, $ret, $targets, check, DB_REPLICA, scanNextLayer(), and wfGetDB().
|
private |
Scans a "parent layer" of the articles/categories in $this->next.
Definition at line 188 of file CategoryFinder.php.
References $name, $res, and NS_CATEGORY.
Referenced by run().
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 78 of file CategoryFinder.php.
References $mode, and NS_CATEGORY.
Referenced by SpecialRecentChanges\filterByCategories().
|
protected |
The original article IDs passed to the seed function.
Definition at line 48 of file CategoryFinder.php.
|
protected |
Read-DB replica DB.
Definition at line 69 of file CategoryFinder.php.
|
protected |
Array of DBKEY category names for categories that don't have a page.
Definition at line 51 of file CategoryFinder.php.
|
protected |
|
protected |
Definition at line 63 of file CategoryFinder.php.
|
protected |
Array of article/category IDs.
Definition at line 57 of file CategoryFinder.php.
|
protected |
Array of [ ID => [] ].
Definition at line 54 of file CategoryFinder.php.
Referenced by getParents().
|
protected |
Array of DBKEY category names.
Definition at line 60 of file CategoryFinder.php.
Referenced by run().