$wgUseOldSearchUI = true; // temp testing variable
+/**
+ * If set to true the 'searcheverything' preference will be effective only for logged-in users.
+ * Useful for big wikis to maintain different search profiles for anonymous and logged-in users.
+ *
+ */
+$wgSearchEverythingOnlyLoggedIn = false;
+
/**
* Site notice shown at the top of each page
*
'label-message' => 'mwsuggest-disable',
'section' => 'searchoptions/display',
);
- }
+ }
+
+ $defaultPreferences['searcheverything'] =
+ array(
+ 'type' => 'toggle',
+ 'label-message' => 'searcheverything-enable',
+ 'section' => 'searchoptions/advancedsearchoptions',
+ );
// Searchable namespaces back-compat with old format
$searchableNamespaces = SearchEngine::searchableNamespaces();
'section' => 'searchoptions/advancedsearchoptions',
'prefix' => 'searchNs',
);
+
+
+
}
static function miscPreferences( $user, &$defaultPreferences ) {
* @return Array
*/
public static function userNamespaces( $user ) {
+ global $wgSearchEverythingOnlyLoggedIn;
+
+ // get search everything preference, that can be set to be read for logged-in users
+ $searcheverything = false;
+ if( ( $wgSearchEverythingOnlyLoggedIn && $user->isLoggedIn() )
+ || !$wgSearchEverythingOnlyLoggedIn )
+ $searcheverything = $user->getOption('searcheverything');
+
+ // searcheverything overrides other options
+ if( $searcheverything )
+ return array_keys(SearchEngine::searchableNamespaces());
+
$arr = Preferences::loadOldSearchNs( $user );
$searchableNamespaces = SearchEngine::searchableNamespaces();
'search-mwsuggest-disabled' => 'no suggestions',
'search-relatedarticle' => 'Related',
'mwsuggest-disable' => 'Disable AJAX suggestions',
+'searcheverything-enable' => 'Search in all namespaces',
'searchrelated' => 'related',
'searchall' => 'all',
'showingresults' => "Showing below up to {{PLURAL:$1|'''1''' result|'''$1''' results}} starting with #'''$2'''.",
'allowemail' => 'Enable e-mail from other users',
'prefs-searchoptions' => 'Search options',
'prefs-namespaces' => 'Namespaces',
-'defaultns' => 'Search in these namespaces by default:',
+'defaultns' => 'Otherwise search in these namespaces:',
'default' => 'default',
'prefs-files' => 'Files',
'prefs-custom-css' => 'Custom CSS',
'search-external',
'searchdisabled',
'googlesearch',
+ 'searcheverything-enable',
),
'opensearch' => array(
'opensearch-desc',