Editing Restrictions 101 (Part II)

    Previous: Editing Restrictions 101 (Part I)

    This section of EditingRestrictions 101 covers Namespace Permissions.

    Namespace Permissions (Namespace Protection)

    Namespace permissions are settings that set theminimum permissions required to edit pages for each namespace. By default, the only namespace that has any restrictions applied to it is the MediaWiki namespace, which is edit-restricted to sysops only.

    Namespace permissions are also called namespace protections, and are defined in the configuration variable $wgNamespaceProtection. Namespace protections were introduced in MediaWiki version 1.10; however with version 1.14 the namespace protection for the MediaWiki namespace was moved from an explicit protection declared in this setting to an implicit one (meaning you don't have to set anything to establish this protection -- it is implicitely set in the MediaWiki code).

    Namespace protections have the following format:

    Code:
    $wgNamespaceProtection[namespace index number] = array( 'namespace-protection');
    where the "namespace index number' is the index constant assigned to a default namespace (see below) or the index number or constant assigned to a custom namespace (see $wgExtraNamespaces).

    The index constants are php constants assigned to the index numbers for the default namespaces. Constants are used to make it easier to associate a namespace index with the namespace name. The constants and their associated values are as follows:

    Namespace Name
    Namespace Constant
    Index #
    (Main) NS_MAIN 0
    Talk NS_TALK 1
    User NS_USER 2
    User Talk NS_USER_TALK 3
    Project * NS_PROJECT 4
    Project Talk * NS_PROJECT_TALK 5
    File NS_FILE 6
    File Talk NS_FILE_TALK 7
    MediaWiki NS_MEDIAWIKI 8
    MediaWiki Talk NS_MEDIAWIKI_TALK 9
    Template NS_TEMPLATE 10
    Template Talk NS_TEMPLATE_TALK 11
    Help NS_HELP 12
    Help Talk NS_HELP_TALK 13
    Category NS_CATEGORY 14
    Category Talk NS_CATEGORY_TALK 15
    Image** NS_IMAGE 6
    Image Talk** NS_IMAGE_TALK 7

    There are also two special index numbers assigned to two virtual namespaces:
    • Media: NS_MEDIA ( -2)
    • Special: NS_SPECIAL (-1)
    * The Project namespace name is set based on the name you assign to your wiki. This can be overridden with the configuration setting $wgMetaNamespace.

    ** The Image namespace is an older designation for the File namespace, which was changed from "Image" to "File" to clear up any ambiguities about the purpose of this namespace, which is to house uploaded files and images. The Image index constant has been kept for backward-compatibility purposes for extensions.

    Next: Editing Restrictions 101 (Part III)
    Comments 2 Comments
    1. thnidu's Avatar
      where the "namespace index number' is the index constant assigned to a default namespace (see below) or the index number or constant assigned to a custom namespace (see $wgExtraNamespace).
      Actually the variable is named $wgExtraNamespaces (plural). Your link is correct but its display text isn't.

      (This is a nitpick. I found this out in using the article! )
    1. hoggwild's Avatar
      Thank you! I will correct it!

    Categories Categories