Adding Namespaces

From Wikitech

Like other configuration changes, adding namespaces is a two-step process: prepare a config change, and deploy it. The first step can be done by anyone, the second one requires deployment access. Both can be done by the same person (a deployer), but it’s also common for a volunteer to prepare a change that is then deployed during Backport windows.

Config change

  • Go into your clone of the operations/mediawiki-config.git repository:
 cd .../mediawiki-config
  • Edit core-Namespaces.php:
 vim wmf-config/core-Namespaces.php
  • Inside the file, find the section variable called wgExtraNamespaces.
  • Scroll down in the file and find the existing section for the project you are adding namespaces to.
  • If it doesn't list in that section, create a new entry for it.
  • NOTE: You have to replace spaces with underscores in the new namespace name and add a corresponding talk namespace, or things will break.
  • Update the file to list off the namespaces you are adding & save your changes.
  • Try to keep the namespace numbers in some sort of order (For example, Portal is often 100.)
  • Commit your changes:
 git commit wmf-config/core-Namespaces.php
  • Don’t forget to mention the associated Phabricator task in the commit message.
  • Upload your change:
 git review
  • If you’re not going to deploy the change yourself, find someone else to do it, e. g. by adding the change to an upcoming Backport slot in the deployments calendar.

Deployment

  • Follow the usual process (+2 on Gerrit, git fetch+log+rebase on deployment, scap pull on debug, verify, scap sync-file on deployment).
  • Now you MUST run the following script to clean up any pages that are using the new namespace in the title before it existed:
mwscript maintenance/namespaceDupes.php --wiki=<wikidbname> --fix
  • This will fix all the broken names due to the new namespace.
  • If the script lists any unresolved names, run it again with --suffix=/BROKEN or something similar, and report the output on the Phabricator task.