[Mediawiki-l] Mass deletion of articles

Reynolds, Matt mreynolds at europe.ea.com
Thu Nov 2 14:12:37 UTC 2006


> Any ideas or hints how mass deletion of articles can be accomplished
by 
> date, by author and by namespace?
> THX, HeinzJ

You can use maintenance\deleteBatch.php which accepts a file where each
line is a page title, including the namespace prefix, to delete. To
create the list you will need write the required SQL; do you need some
hints on this? You can use MySQL Query Browser tool to export the
results to a text file, though you will need to format the file to be
suitable for deleteBatch.php. For example MySQL Query Browser 1.1.20
will output the following:

"page_title","page_id"
"Announcements",28650
"Contribute",28649
"Features",28740
"Highest_rated_pages",28700
"Main_Page",1

from the query: select page_title from pages where page_namespace=0
you will want to format it to:

Announcements
Contribute
Features
Highest_rated_pages
Main_Page

You can use: sed -e "1,1d" -e "/^$/d" -e "s/\"//g" -e "s/,[0-9]*//"
to achieve this. I have not investigated if you can export the results
from the mysql cmd prompt and avoid having the extra step with sed.

Matt




More information about the MediaWiki-l mailing list