Permanently remove a MediaWiki revision using SQL

From WickyWiki
Revision as of 07:26, 5 July 2013 by Admin (talk | contribs) (6 revisions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


You saved sensitive information for example like a password in your MediWiki? Now it is almost impossible to remove this permanently. Here you can read how to remove the text of a revision using two SQL statements.

With MediaWiki:

  1. First edit the page to make a new revision with the sensitive information removed.
  2. Go to page history and re-open the revision, the sensitive information will still be there
  3. Note the Permanent link, this URL points to this specific revision and looks like http://mediawiki/index.php?&oldid=1248 here the number 1248 points to the revision you want to remove.
  4. To be sure try the link in your browser

Backup your (MySQL) database before you continue!

In the following example 1248 denotes the revision we are removing:


-- mark the revision as deleted:
update revision set rev_deleted=1 
  WHERE rev_id = 1248
  ;

-- overwrite the old text:
update text set old_text = 'DELETED'
  where old_id in (SELECT rev_text_id FROM revision WHERE rev_id = 1248)
  ;