This post originated from an RSS feed registered with Python Buzz
by Phillip Pearson.
Original Post: Deleting lots of pages in a UseMod wiki
Feed Title: Second p0st
Feed URL: http://www.myelin.co.nz/post/rss.xml
Feed Description: Tech notes and web hackery from the guy that brought you bzero, Python Community Server, the Blogging Ecosystem and the Internet Topic Exchange
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!