diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2009-02-22 13:37:51 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2009-02-22 13:37:51 +0100 |
commit | b9b85843572bf283f48285001e276ba7e61b63f6 (patch) | |
tree | 4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/Categoryfinder.php | |
parent | d9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff) |
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/Categoryfinder.php')
-rw-r--r-- | includes/Categoryfinder.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/includes/Categoryfinder.php b/includes/Categoryfinder.php index d28f2eeb..4413bd1a 100644 --- a/includes/Categoryfinder.php +++ b/includes/Categoryfinder.php @@ -86,9 +86,15 @@ class Categoryfinder { * This functions recurses through the parent representation, trying to match the conditions * @param $id The article/category to check * @param $conds The array of categories to match + * @param $path used to check for recursion loops * @return bool Does this match the conditions? */ - function check ( $id , &$conds ) { + function check ( $id , &$conds, $path=array() ) { + // Check for loops and stop! + if( in_array( $id, $path ) ) + return false; + $path[] = $id; + # Shortcut (runtime paranoia): No contitions=all matched if ( count ( $conds ) == 0 ) return true ; @@ -120,7 +126,7 @@ class Categoryfinder { # No sub-parent continue ; } - $done = $this->check ( $this->name2id[$pname] , $conds ) ; + $done = $this->check ( $this->name2id[$pname] , $conds, $path ); if ( $done OR count ( $conds ) == 0 ) { # Subparents have done it! return true ; |