I Implemented a MediaWiki site but unfortunately somebody created thousands of pages through thousand of users.

Which query could I run for deleting all pages created by these users except mine?

MediaWiki pages are in wiki_page and wiki_text inside MediaWiki database but there is no field about who created those pages.

Largest table:

  • wiki_text: 682MB
  • wiki_externallinks: 162.5 MB
  • wiki_recentchange: 95 MB
  • wiki_page: 43 MB

    Here, I find a possible answer to my problem but I'm blocked at the first step:

"Export articles created by you (presumably logged in as the WikiSysop user or similar)"

How can I export article made by me if in the table there is no field about user who created pages?

  • In the link you posted there is a description on how to manually delete all pages not created by you. (webmasters.stackexchange.com/a/45486/27664)
    – user555
    May 5, 2013 at 22:53
  • ok, so i have to run: "DELETE FROM revision WHERE rev_user != YOUR_USER_ID;" for revision page, then work on "page_latest" table and last use purgeOldText.php script for delete from wiki_text table.
    – Pitone
    May 7, 2013 at 17:42

1 Answer 1


If you know some Python (or are not afraid to learn) you should approach this with pywikibot.

You can loop through wiki.allpages() and you can add some logic to decide whether to delete a page or not. Good criteria:

  • Does the page contain specific words? E.g. related to drugs or porn.
  • Does the page have wikilinks to other pages?
  • Does the page have links from other pages?

(I can add a couple of Python lines here if there's any interest. Just let me know.)

  • 1
    Often, the sites created by spammers are *orphans: Sites that have no other wiki sites link to them. That could be one of the criteria for deletion. I did this by hand for my club's media wiki which fortunately didn't have too many of them.
    – Lagerbaer
    Sep 12, 2014 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.