summaryrefslogtreecommitdiff
path: root/includes/Categoryfinder.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Categoryfinder.php')
-rw-r--r--includes/Categoryfinder.php39
1 files changed, 21 insertions, 18 deletions
diff --git a/includes/Categoryfinder.php b/includes/Categoryfinder.php
index e2b6a0ca..6ef224b6 100644
--- a/includes/Categoryfinder.php
+++ b/includes/Categoryfinder.php
@@ -28,17 +28,17 @@
*
* Example use :
* <code>
- * # Determines whether the article with the page_id 12345 is in both
- * # "Category 1" and "Category 2" or their subcategories, respectively
+ * # 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 );
+ * $cf = new Categoryfinder;
+ * $cf->seed(
+ * array( 12345 ),
+ * array( 'Category 1', 'Category 2' ),
+ * 'AND'
+ * );
+ * $a = $cf->run();
+ * print implode( ',' , $a );
* </code>
*
*/
@@ -66,7 +66,7 @@ class Categoryfinder {
* Initializes the instance. Do this prior to calling run().
* @param $article_ids Array of article IDs
* @param $categories FIXME
- * @param $mode String: FIXME, default 'AND'.
+ * @param string $mode FIXME, default 'AND'.
* @todo FIXME: $categories/$mode
*/
function seed( $article_ids, $categories, $mode = 'AND' ) {
@@ -111,9 +111,9 @@ class Categoryfinder {
/**
* This functions recurses through the parent representation, trying to match the conditions
- * @param $id int The article/category to check
- * @param $conds array The array of categories to match
- * @param $path array used to check for recursion loops
+ * @param int $id The article/category to check
+ * @param array $conds The array of categories to match
+ * @param array $path used to check for recursion loops
* @return bool Does this match the conditions?
*/
function check( $id, &$conds, $path = array() ) {
@@ -124,7 +124,7 @@ class Categoryfinder {
$path[] = $id;
- # Shortcut (runtime paranoia): No contitions=all matched
+ # Shortcut (runtime paranoia): No conditions=all matched
if ( count( $conds ) == 0 ) {
return true;
}
@@ -135,7 +135,7 @@ class Categoryfinder {
# iterate through the parents
foreach ( $this->parents[$id] as $p ) {
- $pname = $p->cl_to ;
+ $pname = $p->cl_to;
# Is this a condition?
if ( isset( $conds[$pname] ) ) {
@@ -172,6 +172,8 @@ class Categoryfinder {
* Scans a "parent layer" of the articles/categories in $this->next
*/
function scan_next_layer() {
+ wfProfileIn( __METHOD__ );
+
# Find all parents of the article currently in $this->next
$layer = array();
$res = $this->dbr->select(
@@ -209,7 +211,7 @@ class Categoryfinder {
$res = $this->dbr->select(
/* FROM */ 'page',
/* SELECT */ array( 'page_id', 'page_title' ),
- /* WHERE */ array( 'page_namespace' => NS_CATEGORY , 'page_title' => $layer ),
+ /* WHERE */ array( 'page_namespace' => NS_CATEGORY, 'page_title' => $layer ),
__METHOD__ . '-2'
);
foreach ( $res as $o ) {
@@ -225,6 +227,7 @@ class Categoryfinder {
foreach ( $layer as $v ) {
$this->deadend[$v] = $v;
}
- }
+ wfProfileOut( __METHOD__ );
+ }
}