Write a MediaWiki maintenance script to delete change tags with more than 5000 uses
Currently, it is not possible to delete change tags from the database if they are used on more than 5000 pages. This is basically to avoid overloading the database with an onslaught of write queries.
Your task is to write a maintenance script that will delete change tags with more than 5000 uses. To do this, you will add an extra parameter to ChangeTags::deleteTagEverywhere
called $limit
, which defaults to 0
. If $limit
is nonzero, you will add a LIMIT
option to the database select
and delete
queries inside deleteTagEverywhere
. You will call this function repeatedly from your maintenance script, making sure to sleep for the given interval and run wfWaitForSlaves()
between each call, until all uses of the change tag have been removed.
You can use maintenance/deleteBatch.php
as a model for your new maintenance script. You should keep the i
and filelist
parameters from deleteBatch.php
, but the other parameters (user
, etc) can be removed.