Index: trunk/phase3/includes/search/SearchEngine.php |
— | — | @@ -344,21 +344,23 @@ |
345 | 345 | public static function userNamespaces( $user ) { |
346 | 346 | global $wgSearchEverythingOnlyLoggedIn; |
347 | 347 | |
| 348 | + $searchableNamespaces = SearchEngine::searchableNamespaces(); |
| 349 | + |
348 | 350 | // get search everything preference, that can be set to be read for logged-in users |
349 | | - $searcheverything = false; |
350 | | - if ( ( $wgSearchEverythingOnlyLoggedIn && $user->isLoggedIn() ) |
351 | | - || !$wgSearchEverythingOnlyLoggedIn ) |
352 | | - $searcheverything = $user->getOption( 'searcheverything' ); |
| 351 | + // it overrides other options |
| 352 | + if ( !$wgSearchEverythingOnlyLoggedIn || $user->isLoggedIn() ) { |
| 353 | + if ( $user->getOption( 'searcheverything' ) ) { |
| 354 | + return array_keys( $searchableNamespaces ); |
| 355 | + } |
| 356 | + } |
353 | 357 | |
354 | | - // searcheverything overrides other options |
355 | | - if ( $searcheverything ) |
356 | | - return array_keys( SearchEngine::searchableNamespaces() ); |
| 358 | + $arr = array(); |
| 359 | + foreach ( $searchableNamespaces as $ns => $name ) { |
| 360 | + if ( $user->getOption( 'searchNs' . $ns ) ) { |
| 361 | + $arr[] = $ns; |
| 362 | + } |
| 363 | + } |
357 | 364 | |
358 | | - $arr = Preferences::loadOldSearchNs( $user ); |
359 | | - $searchableNamespaces = SearchEngine::searchableNamespaces(); |
360 | | - |
361 | | - $arr = array_intersect( $arr, array_keys( $searchableNamespaces ) ); // Filter |
362 | | - |
363 | 365 | return $arr; |
364 | 366 | } |
365 | 367 | |
Index: trunk/phase3/includes/Preferences.php |
— | — | @@ -1456,10 +1456,13 @@ |
1457 | 1457 | } |
1458 | 1458 | |
1459 | 1459 | /** |
| 1460 | + * @deprecated in 1.19; will be removed in 1.20. |
1460 | 1461 | * @param $user User |
1461 | 1462 | * @return array |
1462 | 1463 | */ |
1463 | 1464 | public static function loadOldSearchNs( $user ) { |
| 1465 | + wfDeprecated( __METHOD__, '1.19' ); |
| 1466 | + |
1464 | 1467 | $searchableNamespaces = SearchEngine::searchableNamespaces(); |
1465 | 1468 | // Back compat with old format |
1466 | 1469 | $arr = array(); |