Permanently remove a MediaWiki revision using SQL

From WickyWiki
Revision as of 17:14, 12 April 2021 by Wilbert (talk | contribs) (→‎Instructions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Instructions

You saved sensitive information for example like a password in your MediaWiki? 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:


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

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

MySQL Workbench show BINARY as character string

Datatypes in the MediaWiki database are all binary, in order to view the contents do the following:

  1. Go to Edit > Preferences
  2. Choose SQL Queries
  3. Under Query Results, check Treat BINARY/VARBINARY as nonbinary character string