Manual:cleanupBlocks.php
Appearance
| MediaWiki version: | ≥ 1.25 |
| MediaWiki file: cleanupBlocks.php | |
|---|---|
| Location: | maintenance/ |
| Source code: | master • 1.45.3 • 1.44.5 • 1.43.8 |
| Classes: | CleanupBlocks |
Details
[edit]| 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_targetrows that have no corresponding blocks - Delete blocks which have a
bl_targetpointing to a non-existentbt_id - Fix IP address normalization issues
- Merge
block_targetrows referring to the same user, IP address or range - Find and fix incorrect
bt_countvalues
| MediaWiki version: | ≤ 1.42 |
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
[edit]| MediaWiki version: | ≥ 1.44 |
- --dry-run
- Perform a dry run
| MediaWiki version: | ≤ 1.42 |
This script does not take any options or arguments.
Usage
[edit]php maintenance/run.php cleanupBlocks
Terminal
$ php maintenance/run.php cleanupBlocks Done!
In MediaWiki version MediaWiki 1.39 and earlier, you must invoke maintenance scripts using
php maintenance/scriptName.php instead of php maintenance/run.php scriptName.Not included in 1.43.3 LTS! http://web.archive.org/web/20250719171503/https://phabricator.wikimedia.org/source/mediawiki/browse/REL1_43/maintenance/cleanupBlocks.php