This page is a translated version of the page Manual:DeleteBatch.php and the translation is 32% complete.
Outdated translations are marked like this.
Version de MediaWiki :


deleteBatch.php is a maintenance script located in the maintenance directory that can be used to delete a batch of pages.

Avertissement Avertissement : When deleting pages with this script, users that are following pages being deleted will be notified by email about the deletion.

Options et arguments

Option/paramètre Description Required? Default
listfile A file where each line contains the title of a page to be deleted. obligatoire
--u Username that will be shown in the log entries. If left empty, deletions will be attributed to the user called Delete page script. optionnel Delete page script
--r Reason for deletions. If empty, no reason will be shown in the logs. optionnel
--i Number of seconds to sleep after each deletion. optionnel 0


php maintenance/deleteBatch.php somepages.txt [ --u| --r| --i ]

(This will delete the pages contained in the text file "somepages.txt")

$ php maintenance/deleteBatch.php deleteBatch.txt

Page1 Deleted!
Page2 Deleted!
Page3 Deleted!

On a wiki farm with linked folders, change to folder containing LocalSettings.php and use:

php ./maintenance/deleteBatch.php  --conf ./LocalSettings.php --r "reason for deletion" ./deleteBatch.txt

Trucs et astuces

Si les titres des pages contiennent des caractères spéciaux (comme ä, ö, ü, etc.), veillez à enregistrer le fichier en encodage UTF-8. Sinon, le script risque de ne pas pouvoir trouver les noms de page correspondants dans la base de données !

You can create a pagelist with SQL as follows:

mysql -e "select page_title from page where page_touched between 20150431000000 and  20150519000000 and page_namespace = 0 into outfile '/tmp/pagelist.csv'"

This would create a list with all page titles touched between 2015-04-31 and 2015-05-19. This might be helpful if your wiki got attacked by spambots, and other edits happened during that time.

Autres espaces de noms

The above command only covers the Main namespace. The mysql database may not know the prefix name of other namespaces, so we have to do them one by one. For example, to delete all pages in the User namespace, with the deleteme category and no other text:

mysql -e "select concat('User:',p.page_title) from page p INNER JOIN revision r ON p.page_latest = r.rev_id INNER JOIN text t ON r.rev_text_id = t.old_id where t.old_text = '{{deleteme}}' and p.page_namespace = 2 into outfile '/tmp/deleteme-user.csv'"

Voir aussi