Manual:CleanupBlocks.php
MediaWiki version: | ≥ 1.25 |
MediaWiki file: cleanupBlocks.php | |
---|---|
Location: | maintenance/ |
Source code: | master • 1.43.1 • 1.42.6 • 1.39.12 |
Classes: | CleanupBlocks |
Details
MediaWiki version: | ≥ 1.44 |
cleanupBlocks.php is a maintenance script that performs various tasks to fix data integrity with the block and block_target tables.
This script includes the following tasks:
- Delete any
block_target
rows that have no corresponding blocks - Delete blocks which have a
bl_target
pointing to a non-existentbt_id
- Fix IP address normalization issues
- Merge
block_target
rows referring to the same user, IP address or range - Find and fix incorrect
bt_count
values
MediaWiki version: | ≤ 1.43 |
The script cleans up user blocks with usernames that do not match the user table. This works in two steps:
- Clean up duplicate user blocks.
- Update mismatched usernames.
Options/Arguments
MediaWiki version: | ≥ 1.44 |
- --dry-run
- Perform a dry run
MediaWiki version: | ≤ 1.43 |
This script does not take any options or arguments.
Usage
php maintenance/run.php cleanupBlocks
Terminal
$ php maintenance/run.php cleanupBlocks Done!
In MediaWiki version 1.39.12 and earlier, you must invoke maintenance scripts using
php maintenance/scriptName.php
instead of php maintenance/run.php scriptName
.