From e136d9c6a70e424d8b22949887a6826f8ebab69e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 29 Jan 2009 01:29:43 +0000 Subject: [PATCH] Revert r46447 in Collection -- fixed bug in Categoryfinder class it was trying to work around. 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 | 2 ++ includes/Categoryfinder.php | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9d2300883c..e36f354637 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/includes/Categoryfinder.php b/includes/Categoryfinder.php index 4413bd1acf..7c1c285670 100644 --- a/includes/Categoryfinder.php +++ b/includes/Categoryfinder.php @@ -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; + } } } -- 2.20.1