Tech:Rename wiki

From Orain Meta
Jump to navigation Jump to search

The annoying but thankfully rare process of renaming a wiki. This is the process I (John) have followed for the last two wiki renames so improvements are appreciated.

Process

First, make sure you know what they want the wiki to be renamed to and/or the wiki to be renamed. It is really helpful to know this piece of information!

Dump the old database: mysqldump -p -u mediawiki currentwiki > currentwiki.sql

Create the new database: mysql -p -u mediawiki -e "CREATE database newwiki;"

Import the database: mysql -p -u mediawiki newwiki < currentwiki.sql

Change the centralauth tables: mysql -p -u mediawiki -e "UPDATE centralauth.localuser SET lu_wiki = 'newwiki' WHERE lu_wiki = 'currentwiki';" mysql -p -u mediawiki -e "UPDATE centralauth.localnames SET ln_wiki = 'newwiki' WHERE ln_wiki = 'currentwiki';"

Make sure all references to the wiki are gone in the Ansible playbook.

Pull the changes to production and change the line on Database list.

After, keep the .sql dump you did but drop the old database; mysql -p -u mediawiki -e "DROP database currentwiki;"

Note: This system is extremely annoying and should be avoided as much as possible. I am super serious.