mediawiki/namespace-manager

A namespace manager for MediaWiki

dev-master 2018-02-05 04:59 UTC

README

This module provides a single place to manage the configuration for all namespace related variables.

Adding a setting

I recommend you add a setting by using the maintenance script dumpNSInfo.php to find the current settings that you want to have managed. This will help you determine how to set up their use in the extension.

For example, I want to put $wgCirrusSearchNamespaceWeights under management via the searchWeight key. First, I write ths bit of code inside the end of the loop in dumpNSInfo.php: <syntaxhightlight lang="php"> if ( isset( $wgCirrusSearchNamespaceWeights ) ) { $nsConf->$name->searchWeight = null; if ( isset( $wgCirrusSearchNamespaceWeights[$const] ) ) { $nsConf->$name->searchWeight = $wgCirrusSearchNamespaceWeights[$const]; } } &lt;/syntaxhighlight&gt;</syntaxhightlight>

The initial if( isset(… check verifies that there is actually a variable we can adjust. This is needed because other people using the extension may not have CirrusSearch installed.

The next line sets the value for the ns to null as default. In the coorespodning load code, we will just skip the setting if the configuration for this variable is null.

The second if( isset(… checks to see if anything is set for this namespace. If there is, then the value is given to the searchWeight key.