Extension:SpecialNamespaces

From MediaWiki.org
(Redirected from Extension:Simple namespaces)
Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
Special:Namespaces

Release status: stable

MediaWiki extension Simple namespaces.png
Implementation Special page
Description Add new namespaces from Special:Namespaces page
Author(s) Unsupported derivative based on Special:Interwiki GPL by Stephanie Amanda Stevens
Last Version 1.0 (2009-9-06)
MediaWiki 1.16+
License No license specified
Download SpecialNamespaces/sourcecode

check usage (experimental)

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.

Contents

[edit] 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.

[edit] Installation

[edit] MediaWiki 1.16

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_)

CREATE TABLE `mw_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;

3. Add require_once('extensions/Namespaces/SpecialNamespaces.php'); to LocalSettings.php

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

$wgGroupPermissions['sysop']['namespaces'] = true;

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

6. ??? - Profit!

[edit] 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):

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;

3. Add one line to languages/Language.php, insert it 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();
                }
        }

4. Add require_once('extensions/SpecialNamespaces.php'); to LocalSettings.php

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

$wgGroupPermissions['sysop']['namespaces'] = true;

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.)

[edit] Notes

php maintenance/namespaceDupes.php --fix

See Manual:Namespace and Manual:Using custom namespaces for more information on using namespaces in MediaWiki installations.

[edit] Known bugs (version 1.0)

[edit] 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.

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;

[edit] See also

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Toolbox