Extension:SpecialNamespaces

Special:Namespaces is a MediaWiki extension that allows administrators to create and modify custom namespaces without directly editing the configuration files. It is based on the Special:Interwiki special page to work with the interwiki table, which was released under GPL by Stephanie Amanda Stevens.

History
This code was intended to be a short-lived 'kludge', adapting or twisting an existing extension to fill a new task.

There was one branch ("wikidata") of MediaWiki 1.6 which included a partially-complete Special:Namespaces editor. Namespaces could simply be created, renamed or removed right from the web interface. While some of the proposed capabilities (such as automatic moves of existing pages into the new namespaces) hadn't been implemented, Special:Namespaces did appear to have the makings of a useful tool.

Special:Namespaces was to exist in some form in the core MediaWiki code from version 1.7 onward. This didn't happen.

Some wikis (including a few in the Uncyclopedia Babel series) were actively using Special:Namespaces (MW1.6-wikidata), creating a need to preserve at least minimal namespaces functionality despite site upgrades to MW1.7, 1.8, 1.9.

As the original Special:Interwiki is GPL'ed, a modified version to provide Special:Namespaces functions can be created subject to the same GPL. This code is provided as-is, do feel free to blame User:Carlb (Carl Austin Bennett) on Uncyclopædia if it horribly breaks but do keep in mind that this is unsupported code, patched together merely to avoid losing Special:Namespaces entirely.

This extension is therefore not guaranteed to exhibit the level of rigorous scientific validation which normally goes into Uncyclopædia content.

Installation
The script itself must be installed in the extensions directory, typically as extensions/SpecialNamespaces.php

The database table namespace_names must also already exist. Its format (as based on the MW1.6-wikidata structure) is:

CREATE TABLE `namespace_names` ( `ns_id` int(8) NOT NULL default '0',  `ns_name` varchar(200) NOT NULL default '',  `ns_default` tinyint(1) NOT NULL default '0',  `ns_canonical` tinyint(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

One line must also be added to languages/Language.php, where it is inserted immediately before the call to fixUpSettings: function load { if ( !$this->mLoaded ) { self::loadLocalisation( $this->getCode ); $cache =& self::$mLocalisationCache[$this->getCode]; foreach ( self::$mLocalisationKeys as $key ) { $this->$key = $cache[$key]; }                       $this->mLoaded = true;

/*** inserted code for Special:Namespaces extension ***/ wfRunHooks( 'LanguageNamespaces', array( &$this->namespaceNames, &$this->namespaceAliases, $this->getCode ) ); /*** end of inserted code ***/

$this->fixUpSettings; }       }

The extension can then be invoked from LocalSettings.php by using require_once

If you're replacing MW1.6-wikidata with some subsequent MediaWiki version, the `namespace` and `namespace_names` tables will already exist. This extension ignores the `namespace` portion and uses `namespace_names` in a compatible manner so that any existing MW1.6-wikidata custom namespaces will continue to operate normally.