From 480ce1e7329a4a67b3ff9570a22ac977b499e7b3 Mon Sep 17 00:00:00 2001 From: Federico Leva Date: Tue, 3 Jun 2014 13:43:08 +0200 Subject: [PATCH] Remove redundant filter for negative namespace ids in search preferences Follows-up 5dc4dc099. MWNamespace::getValidNamespaces() filters these out already. Change-Id: Icad951fb9a4c4cb368cd994d1861dc2eff1f4ae0 --- includes/Preferences.php | 8 +++----- includes/specials/SpecialSearch.php | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/includes/Preferences.php b/includes/Preferences.php index 62aac3b177..081315e2a2 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1011,11 +1011,9 @@ class Preferences { */ static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) { foreach ( MWNamespace::getValidNamespaces() as $n ) { - if ( $n >= 0 ) { - $defaultPreferences[ 'searchNs' . $n ] = array( - 'type' => 'api', - ); - } + $defaultPreferences[ 'searchNs' . $n ] = array( + 'type' => 'api', + ); } } diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index ee7ddfdab8..ea0a29ac7b 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -539,9 +539,7 @@ class SpecialSearch extends SpecialPage { // Reset namespace preferences: namespaces are not searched // when they're not mentioned in the URL parameters. foreach ( MWNamespace::getValidNamespaces() as $n ) { - if ( $n >= 0 ) { - $user->setOption( 'searchNs' . $n, false ); - } + $user->setOption( 'searchNs' . $n, false ); } // The request parameters include all the namespaces we just searched. // Even if they're the same as an existing profile, they're not eaten. -- 2.20.1