mediawiki/namespace-manager

A namespace manager for MediaWiki

Installs: 139

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 0

Open Issues: 0

Type:mediawiki-extension

2.2.0 2022-03-17 18:41 UTC

This package is auto-updated.

Last update: 2024-10-18 00:43:28 UTC


README

NamespaceManager

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.