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 Extension:SpecialInterwiki code, originally 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 using a handy 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. While some of the code was used in OmegaWiki, the main MediaWiki package still (as of MediaWiki version 1.16, fall 2009) lacks a built-in namespace editor.

As some wikis (including a few in the Uncyclopedia Babel series) were actively using Special:Namespaces (MW1.6-wikidata) in 2006, a need arose to preserve at least minimal namespaces functionality despite site upgrades to newer MediaWiki versions. As the original Special:Interwiki is GPL'ed, a modified version was hastily contrived to provide Special:Namespaces functions. This 'temporary solution' unfortunately still exists.

While the extension has been updated once (to incorporate changes made to the original Special:Interwiki), it is unsupported code and is neither created nor maintained by any of the authors of the original Special:Interwiki extension.

MediaWiki 1.18-1.19
The code provided for MediaWiki 1.16 (below) can be made to work with MW 1.19 by making one pair of changes to SpecialNamespaces_body.php line 149 and 151:

must become:

The same change (replace Xml::Hidden with Html::Hidden) is needed in line 112 of this file.

Note: The restrictions on use of $wgExtraNamespaces are more rigid in the current MediaWiki and extension set. An attempt to rename any of the pre-defined namespaces may cause the wiki not to function correctly; a long list of extension default namespaces has also been created for various existing extensions. Users of DPLforum, for instance, now encounter a coded default namespace of 110: for that extension - if your wiki uses another namespace for Forum: as 110 is being used for something else, this will not function correctly after an upgrade to the current versions of all code.

Installation is otherwise identical to that for MW 1.16 and 1.17 sites.

MediaWiki 1.16-1.17
1. Copy the code from Extension:SpecialNamespaces/sourcecode (five source files) to individual files under extensions/Namespaces/

2. Create database table namespace_names with the following SQL query: (Make sure to add your wiki's table prefix if there is one, e.g. mw_)

3. Add  to LocalSettings.php

4. Assign the necessary permissions in LocalSettings.php to allow specific user groups to edit namespaces:

5. Installation can be verified through the Special:Version page of your wiki

6. ??? - Profit!

Older MediaWiki versions (1.07 - 1.15)
1. Copy the code from Extension:SpecialNamespaces/sourcecode (ver 0.1) to extensions/SpecialNamespaces.php

2. Create database table namespace_names with the following SQL query (if it doesn't exist already):

3. Add one line to languages/Language.php, insert it immediately before the call to fixUpSettings:

4. Add  to LocalSettings.php

5. Assign 'namespaces' permission to groups authorised to edit namespaces:

6. Installation can be verified through the Special:Version page of your wiki.


 * (If 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.)

Known bugs (version 1.0)

 * Because the extension now sets $wgExtraNamespaces and $wgNamespaceAliases by standard means (instead of relying on a patch to add a hook in core MediaWiki code), the 'canonical' bit is in most instances now ignored. The only case where the extension currently uses the 'canonical' flag is for namespaces 4/5 (project:, project_talk:) where setting the bit will cause $wgSitename, $wgMetaNamespace and/or $wgMetaNamespaceTalk to be modified.


 * Localisation into other languages is currently incomplete. While some of the common text ('add', 'edit', 'delete', 'yes', 'no') may be obtained from existing localisations of other code, table column names and descriptions are often not translated.


 * Validity checks on input data are presently weak; they should be tightened to require ns_id be numeric and ns_name to be free of ' ', ':' or other non-alphanumeric characters (the space ' ' must be replaced with an underscore '_' in namespace names).


 * Deleting a namespace through the web interfaces also deletes any identically-numbered aliases to the (same number) namespace.


 * Support for the $wgContentNamespaces, $wgNamespaceProtection, $wgNamespacesWithSubpages and $wgNamespacesToBeSearchedDefault options is not included; these options (if used) will still need to be set from LocalSettings.php


 * The 'namespace_names' table must already exist or be created manually; this could be improved (for recent MW versions, 1.17+) by adding update.php support which is currently lacking.


 * There is no means provided from the web interface to mass-move pages to a new namespace from mainspace, or to move remaining pages out of a namespace before deleting/renumbering a namespace prefix. While a command-line utility maintenance/namespaceDupes.php included with MediaWiki is a useful tool for moving pages rendered inaccessible by names conflicting with namespace prefixes, there is no web interface included with that script.

Known bugs (version 0.1)
The original (version 0.1) code is not recommended for new installations, but appears here as a historical record and for use in installations operating under previous MediaWiki versions.


 * This version of the extension is based on an outdated version of the Special:Interwiki code base. It also uses a patch to core MediaWiki code, which will create problems when upgrading MediaWiki. Localization strings (such as the individual table column names) will need to be set manually (as [[MediaWiki: namespace messages) after upgrade to MediaWiki 1.16; users of this MediaWiki version are therefore advised to use the new version of the namespaces extension.


 * The project: namespace (namespace #4) is a special case in that Languages.php:fixUpSettings will automatically insert the name of your project (as listed in LocalSettings). If you wish to be able to use the Special:Namespaces page to rename the project namespace, fixUpSettings will need to be updated to check for this.


 * To verify that Project: namespace hasn't already been renamed in Special:Namespaces, change fixUpSettings to replace:
 * $this->namespaceNames[NS_PROJECT] = $wgMetaNamespace;
 * with:
 * if (!$this->namespaceNames[NS_PROJECT])
 * $this->namespaceNames[NS_PROJECT] = $wgMetaNamespace;


 * If using this code to create aliases to MediaWiki's built-in namespaces under MediaWiki 1.14, it appears that getCanonicalIndex is not returning the proper namespace name -> namespace number conversion for these aliases. This routine is called from Languages.php and is needed to cause tags such as [[category: to be flagged for special handling.