Page MenuHomePhabricator

Initialization of GlobalConfiguration encounters error parsing InitialiseSettings.php
Closed, ResolvedPublic

Description

Author: ram

Description:
During initialization, GlobalConfiguration.initializeWmfSettings() encounters error parsing InitialiseSettings.php to extract the value of wgContentNamespaces.
The problem is that it expects namespace values to be numeric but we now have
symbolic values such as NS_MAIN. The exception also causes the parsing of
wgMetaNamespace and wgMetaNamespaceTalk to be bypassed.

A patch for this bug will be pushed shortly.


Version: unspecified
Severity: normal

Details

Reference
bz46295

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:27 AM
bzimport set Reference to bz46295.
bzimport added a subscriber: Unknown Object (MLST).

Those should be all in includes/Defines.php

Though, not sure if you want to parse that everytime, so maybe doing it manually (as it's added to infrequently) might be alright..

ram wrote:

Yes, I saw that but rather than parse yet another PHP file I decided to hardcode the core list of 16 values in the code, (especially since the comment in Defines.php strongly warns against changing those values) e.g.

static final private HashMap<String, Integer> nsmap = new HashMap<String, Integer>();

static {
        nsmap.put( "NS_MAIN",      0 );   nsmap.put( "NS_TALK",           1 );
        nsmap.put( "NS_USER",      2 );   nsmap.put( "NS_USER_TALK",      3 );
        nsmap.put( "NS_PROJECT",   4 );   nsmap.put( "NS_PROJECT_TALK",   5 );
        nsmap.put( "NS_FILE",      6 );   nsmap.put( "NS_FILE_TALK",      7 );
        nsmap.put( "NS_MEDIAWIKI", 8 );   nsmap.put( "NS_MEDIAWIKI_TALK", 9 );
        nsmap.put( "NS_TEMPLATE",  10 );  nsmap.put( "NS_TEMPLATE_TALK",  11 );
        nsmap.put( "NS_HELP",      12 );  nsmap.put( "NS_HELP_TALK",      13 );
        nsmap.put( "NS_CATEGORY",  14 );  nsmap.put( "NS_CATEGORY_TALK",  15 );
}

ram wrote:

The exception this bug causes can be found in log/log-all file on the search
indexer (probably on the searchers too) and looks like this:

Error reading InitialiseSettings.php from url file:///a/search/conf/InitialiseSettings.php : For input string: "NS_MAIN"

[Merging "MediaWiki extensions/Lucene Search" into "Wikimedia/lucene-search2", see bug 46542. You can filter bugmail for: search-component-merge-20130326 ]

ram wrote:

This bug can be closed since the change has been merged.

Yay, thanks!

Ram: For future reference, you can do this yourself by changing the "Status" dropdown at the bottom from "NEW" to "RESOLVED | FIXED".