Remove redundant filter for negative namespace ids in search preferences
authorFederico Leva <federicoleva@tiscali.it>
Tue, 3 Jun 2014 11:43:08 +0000 (13:43 +0200)
committerKrinkle <krinklemail@gmail.com>
Tue, 3 Jun 2014 16:10:04 +0000 (16:10 +0000)
Follows-up 5dc4dc099. MWNamespace::getValidNamespaces() filters these
out already.

Change-Id: Icad951fb9a4c4cb368cd994d1861dc2eff1f4ae0

includes/Preferences.php
includes/specials/SpecialSearch.php

index 62aac3b..081315e 100644 (file)
@@ -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',
+                       );
                }
        }
 
index ee7ddfd..ea0a29a 100644 (file)
@@ -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.