From f3edfbf352bc3c07d7e08a2ceac8b76aacaf7526 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Fri, 13 May 2011 15:56:12 +0000 Subject: [PATCH] bug 2429 fix up index by using IN / NOT IN instead of (!= and !=) Tested (EXPLAIN ) against the english wikipedia database. Follow up: - r83110 : original ns association implementation - r87992 : abstraction support for 'NOT IN' (note: breaks some existing PHPUnit tests) --- includes/specials/SpecialRecentchanges.php | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 09067154bf..5840917918 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -316,25 +316,24 @@ class SpecialRecentChanges extends IncludableSpecialPage { # Namespace filtering if( $opts['namespace'] !== '' ) { - $selectedNS = $dbr->addQuotes( $opts['namespace'] ); - $operator = $opts['invert'] ? '!=' : '='; - $boolean = $opts['invert'] ? 'AND' : 'OR'; + $namespaces[] = $opts['namespace']; - # namespace association (bug 2429) - if( !$opts['associated'] ) { - $condition = "rc_namespace $operator $selectedNS"; - } else { - # Also add the associated namespace - $associatedNS = $dbr->addQuotes( - MWNamespace::getAssociated( $opts['namespace'] ) - ); - $condition = "(rc_namespace $operator $selectedNS " - . $boolean - . " rc_namespace $operator $associatedNS)"; + $inversionSuffix = $opts['invert'] ? '!' : ''; + + if( $opts['associated'] ) { + # namespace association (bug 2429) + $namespaces[] = MWNamespace::getAssociated( $opts['namespace'] ); } + $condition = $dbr->makeList( + array( 'rc_namespace' . $inversionSuffix + => $namespaces ), + LIST_AND + ); + $conds[] = $condition; } + return $conds; } -- 2.20.1