What is the problem?
Attempting to use Special:MassGlobalBlock on a target which already has more than one block shows the exception:
[d109d5c52ae6f83a03737b03] /wiki/Special:MassGlobalBlock RuntimeException: Can\'t reblock a user with multiple blocks already present. Update calling code for multiblocks, providing a specific block to update.
Backtrace:
from /var/www/html/w/includes/block/BlockUser.php(628)
#0 /var/www/html/w/includes/block/BlockUser.php(566): MediaWiki\Block\BlockUser->placeBlockInternal()
#1 /var/www/html/w/includes/block/BlockUser.php(491): MediaWiki\Block\BlockUser->placeBlockUnsafe()
#2 /var/www/html/w/extensions/GlobalBlocking/includes/Special/SpecialMassGlobalBlock.php(553): MediaWiki\Block\BlockUser->placeBlock()
#3 /var/www/html/w/extensions/GlobalBlocking/includes/Special/SpecialMassGlobalBlock.php(117): MediaWiki\Extension\GlobalBlocking\Special\SpecialMassGlobalBlock->performGlobalBlockChanges()
#4 /var/www/html/w/includes/specialpage/SpecialPage.php(729): MediaWiki\Extension\GlobalBlocking\Special\SpecialMassGlobalBlock->execute()
#5 /var/www/html/w/includes/specialpage/SpecialPageFactory.php(1737): MediaWiki\SpecialPage\SpecialPage->run()
#6 /var/www/html/w/includes/actions/ActionEntryPoint.php(503): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#7 /var/www/html/w/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#8 /var/www/html/w/includes/MediaWikiEntryPoint.php(202): MediaWiki\Actions\ActionEntryPoint->execute()
#9 /var/www/html/w/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#10 {main}Special:GlobalBlock does not exhibit the same behaviour. After submit it just states Blocking the user locally failed as the given user already is blocked on this wiki. I guess MassGlobalBlock should do the same for each already blocked user.
Steps to reproduce problem
- On a wiki with GlobalBlocking, Codex Special:Block and Multiblocks enabled ($wgUseCodexSpecialBlock = true; $wgEnableMultiBlocks = true;)
- Use Special:Block to create two blocks against the same user or IP
- Go to Special:MassGlobalBlock
- Enter the name of the user/IP from step 2 and press Search
- Choose an expiry time
- Select "Also block the given user locally on this wiki"
- Submit
Expected behaviour: User/IP is blocked globally. There is a message saying that the local block failed to be created.
Observed behaviour: Above exception.
Environment
Wiki(s): local docker MediaWiki 1.44.0-alpha (9669d77) 08:30, 3 March 2025. GlobalBlocking – (ac947c7) 07:27, 3 March 2025.
Derived Requirement
Ensure that Special:MassGlobalBlock properly handles users/IPs with multiple existing local blocks by:
- Preventing the RuntimeException: Can't reblock a user with multiple blocks already present.
- Displaying a message stating that the local block could not be created when the user/IP is already blocked.
- Successfully applying the global block while handling local block failures gracefully.
Test Steps
Test Case 1: Verify that Special:MassGlobalBlock does not throw a RuntimeException when blocking a user with multiple existing local blocks
- On a wiki with GlobalBlocking, Codex Special:Block, and Multiblocks enabled, navigate to Special:Block.
- Enter a target user/IP and apply a first block.
- Apply a second block on the same user/IP.
- Navigate to Special:MassGlobalBlock.
- Enter the same user/IP in the search field and press Search.
- Choose an expiry time and select "Also block the given user locally on this wiki."
- Click Submit.
- ✅❓❌⬜ AC1: Confirm that global block is successfully applied without issues and RuntimeException is not thrown**.
- ✅❓❌⬜ AC2: Confirm that a message states that the local block could not be created because the user/IP is already blocked.
QA Results - Test Wiki
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T387730#10654041 |
| 2 | ❓ | T387730#10654041 |
