Custom namespaces:
authorErik Moeller <erik@users.mediawiki.org>
Tue, 31 Aug 2004 10:23:55 +0000 (10:23 +0000)
committerErik Moeller <erik@users.mediawiki.org>
Tue, 31 Aug 2004 10:23:55 +0000 (10:23 +0000)
To add a new namespace, just set $wgExtraNamespaces in LocalSettings.php.
Custom namespaces must begin at 100.
This is primarily intended to let us add a bunch of international versions
of the "Help:" namespace on Meta, so we can finally have a single place for
all documentation and easily dump/import it to other wikis.

includes/DefaultSettings.php
includes/Namespace.php
languages/Language.php

index 2865659..424d188 100644 (file)
@@ -549,6 +549,19 @@ $wgUseExternalDiffEngine = false;
 # Use RC Patrolling to check for vandalism
 $wgUseRCPatrol = true;
 
+# Additional namespaces. If the namespaces defined in Language.php and Namespace.php are insufficient,
+# you can create new ones here, for example, to import Help files in other languages.
+# PLEASE NOTE: Once you delete a namespace, the pages in that namespace will no longer be accessible.
+# If you rename it, then you can access them through the new namespace name.
+#
+# Custom namespaces should start at 100.
+#$wgExtraNamespaces= 
+#      array(100 => "Hilfe", 
+#            101 => "Hilfe_Diskussion",
+#            102 =>"Aide", 
+#            103 =>"Discussion_Aide"
+#            );
+
 } else {
        die();
 }
index 5ae927b..b02542d 100644 (file)
@@ -32,6 +32,10 @@ if( defined( 'MEDIAWIKI' ) ) {
        NS_CATEGORY_TALK    => 'Category_talk'
 );
 
+if(isset($wgExtraNamespaces)) {
+       $wgCanonicalNamespaceNames=$wgCanonicalNamespaceNames+$wgExtraNamespaces;
+}
+
 class Namespace {
 
        /* These functions are deprecated */
@@ -52,10 +56,14 @@ class Namespace {
 
        function isTalk( $index )
        {
+               global $wgExtraNamespaces;
                return ( $index == NS_TALK           || $index == NS_USER_TALK     ||
                                 $index == NS_PROJECT_TALK   || $index == NS_IMAGE_TALK    ||
                                 $index == NS_MEDIAWIKI_TALK || $index == NS_TEMPLATE_TALK ||
-                                $index == NS_HELP_TALK      || $index == NS_CATEGORY_TALK );
+                                $index == NS_HELP_TALK      || $index == NS_CATEGORY_TALK 
+                                ||  ( (isset($wgExtraNamespaces) && $index % 2) )
+                                );
+               
        }
 
        # Get the talk namespace corresponding to the given index
index 79eb150..299a017 100644 (file)
@@ -46,6 +46,10 @@ if($wgMetaNamespace === FALSE)
        NS_CATEGORY_TALK    => 'Category_talk'
 );
 
+if(isset($wgExtraNamespaces)) {
+       $wgNamespaceNamesEn=$wgNamespaceNamesEn+$wgExtraNamespaces;
+}
+
 /* private */ $wgDefaultUserOptionsEn = array(
        'quickbar' => 1, 'underline' => 1, 'hover' => 1,
        'cols' => 80, 'rows' => 25, 'searchlimit' => 20,