Jump to content

Delete a wiki

From Wikitech

Usually, wikis are closed, not deleted.[1] Closing a wiki means that it is not editable anymore, but the content is still available.

When we delete a wiki, the steps outlined below need to be performed, which makes MediaWiki claim that the wiki does not exist. Actually deleting the data from all of the database servers would be quite a bit more complicated, and is usually not worth doing.

Note: Some subset of these steps are done by the deleteWiki.php script in extensions/WikimediaMaintenance. The script may or may not be correct, up-to-date, or tested. Carefully review its code and git history to the edit history of this page before doing anything.

To delete a wiki

Note: This section outlines the steps that should be scheduled together during the initial deletion of a wiki as they prevent cascading errors within our systems, within gadgets, and in external tools due to broken references being served through APIs over which they would iterate.

  1. Remove the wiki from wikimedia's wiki configuration:
    • Remove the wiki from all.dblist and any other dblists it exists in
    • Add the wiki to deleted.dblist
    • Remove all other references from CommonSettings and InitialiseSettings etc.
    • Remove the logo file from w/static/images/project-logos.
    • Do not remove the wiki from wmf-config/interwiki.php (this will be done automatically, at a later time).
  2. Remove references from the meta-index in Wikimedia Cloud Services (or create a subtask to have WMCS do it for you).
    • Run maintain-meta_p --all-databases --purgeon all replica database servers. If you do this before the mediawiki/config patch mentioned above is applied, the result is T184433.
  3. Remove local references from the CentralAuth database. If you don't do this, the result is T30393.
    • For small wikis it should be safe to do this manually:
      • Run sql centralauth from an active mwmaint host.
      • SELECT COUNT(*) FROM localnames WHERE ln_wiki='wikidb';
      • If this is less than say 20,000:
        • DELETE FROM localuser WHERE lu_wiki='wikidb';
        • DELETE FROM localnames WHERE ln_wiki='wikidb';
    • For a big wiki: ??
  4. Remove global references from the CentralAuth database
    1. How: ??
    2. Ref https://phabricator.wikimedia.org/T268711
  5. Remove references from the GlobalUsage database. If you don't do this, JobQueue jobs for Commons will continue to try to interact with this wiki, which would produce errors:
    • Run sql commonswiki from an active mwmaint host.
    • DELETE FROM globalimagelinks WHERE gil_wiki='wikidb';
  6. Purge jobs for this wiki from the JobQueue. Without this, T171371 happens.
    • Use the wmfManageJobs.php maintenance script from the WikimediaMaintenance extension.
    • FIXME: This script no longer exists. Ask Platform Engineering for advice.
  7. Deal with Echo notifications somehow (echo_unread_wikis) as otherwise users will have a forever-stuck non-zero notifications badge that they can't open (because the API request will fail), and can't remove or mark as read (because it won't open).
    • The nuclear option, e.g. for Beta Cluster or test wiki deletions where you know we don't need to preserve these and the wiki is small enough, then you could:
      • SELECT COUNT(*) FROM echo_unread_wikis WHERE euq_wiki='wikidb'
      • DELETE FROM echo_unread_wikis WHERE euq_wiki='wikidb'
      • And then clear the badge count cache:
      • mwscript extensions/Echo/maintenance/recomputeNotifCounts.php --wiki enwiki (This can take a while)
  8. Remove the wiki from the wikimedia/portal repository.

Clean up after deletion

  1. Delete privacy sensitive data (cu_changes table, rc_ip field of recentchanges)
  2. Cleanup wiki replica data (or create a subtask to have WMCS do it for you):
    • Run sudo maintain-views --debug --drop --databases <database> on all replica servers to delete the _p view as well as all other views. The database itself is not dropped.
    • Cleanup dns entries in puppet for the replica at modules/profile/files/openstack/base/pdns/recursor/labsdb.zone. Run puppet on labservices1001|2 to apply the change.
  3. Update the interwiki cache
  4. Create a phabricator task in `discovery-search` project for the search team to delete related search indices.

See also

Notes

  1. <bawolff> Shirley: creating a wiki is like creating a baby, yes you should have a good reason to create one, but if you don't for whatever reason, you should have an _extra_ good reason for killing one