Revert r46447 in Collection -- fixed bug in Categoryfinder class it was trying to...
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 29 Jan 2009 01:29:43 +0000 (01:29 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 29 Jan 2009 01:29:43 +0000 (01:29 +0000)
Categoryfinder::seed() was passing category names through Title::newFromText($ct,NS_CATEGORY), which meant that if the name started with what looks like a namespace, that would override the NS_CATEGORY default.
Thus you got 'Wikipedia:Books' -> text portion 'Books' when you wanted 'Category:Wikipedia:Books' -> text portion 'Wikipedia:Books'.
Using Title::makeTitleSafe(NS_CATEGORY,$ct) instead forces it to always use the category namespace.
Additionally, I've added a check for invalid input -- previously a bad input leading to an invalid title would just kill it dead with a fatal error. Invalid input in the category list is now skipped.

RELEASE-NOTES
includes/Categoryfinder.php

index 9d23008..e36f354 100644 (file)
@@ -113,6 +113,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   certain designations, which are displayed on various summaries of changes, and
   the entries can be styled with CSS.
 * (bug 17207) Fix regression breaking category page display on PHP 5.1
+* Categoryfinder utility class no longer fails on invalid input or gives wrong
+  results for category names that include pseudo-namespaces
 
 == API changes in 1.15 ==
 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
index 4413bd1..7c1c285 100644 (file)
@@ -53,9 +53,11 @@ class Categoryfinder {
                # Set the list of target categories; convert them to DBKEY form first
                $this->targets = array () ;
                foreach ( $categories AS $c ) {
-                       $ct = Title::newFromText ( $c , NS_CATEGORY ) ;
-                       $c = $ct->getDBkey () ;
-                       $this->targets[$c] = $c ;
+                       $ct = Title::makeTitleSafe( NS_CATEGORY, $c );
+                       if( $ct ) {
+                               $c = $ct->getDBkey();
+                               $this->targets[$c] = $c;
+                       }
                }
        }