|IMPORTANT: The content of this page is outdated. For more complete information on current code, please refer to corresponding class/file. If you have checked or updated this page and found the content to be suitable, please remove this notice.|
|MediaWiki file: deleteBatch.php|
|Source code:||master • 1.29.1 • 1.28.2|
|Warning:||When deleting pages with this script, users that are following pages being deleted will be notified by email about the deletion.|
deleteBatch.php is a maintenance script located in the maintenance directory that can be used to delete a batch of pages.
php deleteBatch.php somepages.txt
(This will delete the pages contained in the text file "somepages.txt")
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
|-u <user>||Username that will be shown in the log entries. If left empty, deletions will be attributed to the user called Delete page script.|
|-r <reason>||Reason for deletions. If empty, no reason will be shown in the logs.|
|-i <interval>||Number of seconds to sleep after each deletion.|
|<listfile>||A file (located in the maintenance directory) where each line contains the title of a page to be deleted.|
Tips and Tricks
In case the page titles contain special characters (like ä, ö, ü and so on), make sure to save the file in UTF-8 encoding. Otherwise the script may not be able to find the according page names inside the database!
You can create a pagelist with SQL as follows:
mysql -e "select page_title from page where page_touched between 20150431000000 and 20150519000000 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.
- Extension:DeleteBatch — special page extension of this maintenance script.