Rename a wiki

This is mostly a draft. It also only covers domain renames, DBA made clear that db renames won't happen.
TODO: Refactor this page to three parts - what to do to prepare; what to do at the execution (deployment); what to do after deployment (including testing.)
This page deals with moving a wiki from one domain to another.
#Deal with site language rename if relevant (i.e. probably not for a special wiki)
#*Make sure that Names.php, Messages*.php and */i18n/*.json in core have the new names and codes.
#*Make sure that langdb.yaml in UniversalLanguageSelector has new names and codes and redirects from the old names. (For als -> gsw there's also an extra redirection in UniversalLanguageSelector, so remove it when needed.)
#Add new wiki domain to DNS zone (operations/dns.git)
#Update operations/puppet.git
#*Update/add apache config (operations/puppet.git modules/mediawiki/files/apache/sites) to send new domain to MediaWiki (wikimedia.org subdomains etc. Normal project domains should already be covered by a wildcard)
#*Add new domain to RESTbase config (operations/puppet.git modules/restbase/templates/config.yaml.erb)
#MediaWiki config (operations/mediawiki-config.git) to make new domain work as an alias:
#*Map new wiki domain to database name (multiversion/MWMultiVersion.php, setSiteInfoForWiki function)
#**If the database suffix was not 'wiki', the site code will not be 'wikipedia' so make sure that gets changed too (see ee.wikimedia.org as an example)
#*If moving a wiki from the wrong ISO code, also move the wgLanguageCode entry in wmf-config/InitialiseSettings.php up
#You may have to purge some pages from Varnish (action=purge or SquidUpdate::purge) if they were used for testing the domain name before the mediawiki-config change went through, before you start seeing sane redirect behaviour for the new domain.
#If WikimediaMaintenance's dumpInterwiki script had an alias in reverse of the rename, remove it like , deploy commit and run updateinterwikicache on the deployment master host
#TODO: Populate sites table (cache?) from wikidata (see )
#Change MediaWiki config again to set wgServer/wgCanonicalServer to new domain
#*If renaming a special site you may wish to deal with wgSiteName, wgMetaNamespace, etc. at this point
#**Changing namespace names requires an alias for the old name.
#Update copy of the site matrix at mediawiki/services/parsoid.git lib/sitematrix.json so that v2+ APIs works on the new domain (v1 used database names) like 
#Update MassMessage delivery lists on meta to use the new domain (see )
#Another operations/puppet.git update
#*Add entry redirecting from old domain to new domain to operations/puppet.git modules/mediawiki/files/apache/sites/redirects/redirects.dat, run refreshDomainRedirects and submit result to gerrit
#*Remove old domain from RESTBase config
#**TODO: Work out with RESTBase devs what should actually happen. Note that currently /api/rest_v1/ on our domains does not follow Apache redirects.
#ContentTranslation:
#*Remove the unnecessary redirection from SiteMapper - the ContentTranslationDomainCodeMapping global variable in extension.json. (like )
#*After the migration, test that publishing to the new domain language works. (e.g. )
#*After the migration, test that loading a source article from the new domain works. (e.g. )
#*After the migration, test that link and category adaptation work (e.g. )
#Eliminate existing interwiki links that point to the old domain, and make sure that href points to the new domain
#*For language-projects this is likely to be via dumpInterwiki.php in WikimediaMaintenance (like )
#*For special wikis it's likely to be at Interwiki map
#Test that the langlinks API query works. (like )
#If needed, rename the relevant messages and message keys in the following message files:
#*WikimediaMessages/i18n/wikimediaprojectnames
#*WikimediaMessages/i18n/interwikisearchresults
#If needed, update $MassMessageWikiAliases with a map from the old to the new domain so that delivery lists keep working.
Category:How-To
Category:MediaWiki production