Phillip Pearson - web + electronics notes

tech notes and web hackery from a new zealander who was vaguely useful on the web back in 2002 (see: python community server, the blogging ecosystem, the new zealand coffee review, the internet topic exchange).

2004-12-26

Deleting lots of pages in a UseMod wiki

Someone just created a bunch of spam pages in the Topic Exchange's wiki, with names like these:

# (diff) Table Of Contents 1:40 am . . . . . 221.148.110.xxx
# (diff) Avoiding Memory Leaks 1:40 am . . . . . 221.148.110.xxx
# (diff) fuelhose 1:40 am . . . . . 221.148.110.xxx
# (diff) fbbja 1:40 am . . . . . 221.148.110.xxx
# (diff) www 1:40 am . . . . . 221.148.110.xxx
# (diff) WxWizard 1:40 am . . . . . 221.148.110.xxx
# (diff) Using XML With WxWidgets 1:40 am . . . . . 221.148.110.xxx
# (diff) WxWidgets Vacancies 1:40 am . . . . . 221.148.110.xxx

I started marking them all as DeletedPage, one by one, until I found out about the 'editlinks' command. If you are logged in as an administrator on your wiki, go to the 'Preferences' page, and replace 'editprefs' in the URL with 'editlinks'. You'll get a textarea that will accept various commands to delete and rename pages, in bulk. For example:

!Table Of Contents
!Avoiding Memory Leaks

will delete the first two spam pages in the list above.

So:

python
import re
x = '''# (diff) Table Of Contents 1:40 am . . . . . 221.148.110.xxx
# (diff) Avoiding Memory Leaks 1:40 am . . . . . 221.148.110.xxx
# (diff) fuelhose 1:40 am . . . . . 221.148.110.xxx
# (diff) fbbja 1:40 am . . . . . 221.148.110.xxx
# (diff) www 1:40 am . . . . . 221.148.110.xxx
# (diff) WxWizard 1:40 am . . . . . 221.148.110.xxx
# (diff) Using XML With WxWidgets 1:40 am . . . . . 221.148.110.xxx
# (diff) WxWidgets Vacancies 1:40 am . . . . . 221.148.110.xxx'''
for z in re.findall(r"diff. (.*?) \d\:\d\d .m", x): print "!%s" % z

will dump out a list of delete commands for editlinks. Very handy. Dangerous, though: if there were any non-spam edits in the RecentChanges list, the pages will be deleted (permanently) too, so take care!

... more like this: []