Extension:NonincludableNamespaces

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
NonincludableNamespaces

Release status: stable

Description Emulates $wgNonincludableNamespaces for older versions of MediaWiki.
Author(s) Mark Clements (HappyDogtalk)
License cc-by-sa 2.5 or later
Download Source is available at my test wiki
Check usage and version matrix

This extension is designed to emulate and extend the function of the $wgNonincludableNamespaces configuration variable, which was introduced in MediaWiki v1.10.0.

  • In versions of MW < 1.10.0, it emulates the functionality of the config variable, along with the additional functionality detailed below.
  • In versions of MW >= 1.10.0, there is already code to handle this variable correctly, but the extension adds a couple of configuration short-cuts that make things a bit more flexible.

Contents

Usage [edit]

This extension adds the full functionality of $wgNonincludableNamespaces, plus the enhancements below, to versions of MediaWiki < 1.10.0. From 1.10.0 upwards, $wgNonincludableNamespaces exists natively in the software, in which case the extension simply implements the additional features.

Emulated features [edit]

  • If $wgNonincludableNamespaces is not set, then all transclusion is allowed.
  • If $wgNonincludableNamespaces is an array then transclusion is not allowed for any namespaces included in the array. Elements must be numeric namespace ids.

Additional features [edit]

  • If $wgNonincludableNamespaces is not an array then it is evaluated as a boolean with the following results:
    • If True then no transclusion is allowed, except from the template namespace.
    • If False then no transclusion is allowed at all.

Developers [edit]

The extension defines the constant NIN_Installed when it is loaded, so extension developers can check whether the $wgNonincludableNamespaces variable is supported, either via MW or this extension, by using the following code:

if ( version_compare($wgVersion, '1.10.0', '>=') || defined("NIN_Installed") ) {
        // Installed
}

Source [edit]

Available on my test wiki.