Page MenuHomePhabricator

Create GlobalBlockingBlockPurger service
Closed, ResolvedPublic2 Estimated Story Points

Description

The GlobalBlocking::purgeExpired method need to be moved to a separate service where the method is not static to allow easier testing and to be able to mock this method when testing the code that calls it.

This is because the purge method describes itself as expensive and as such could cause tests which do not verify the behaviour of the purge method to be unnecessarily slower.

Acceptance criteria
  • Move the GlobalBlocking::purgeExpired method to a new service
  • Update the method to use SQL query builders and make the method more like DatabaseBlockStore::purgeExpiredBlocks for consistency.
  • Fully test this new service.

QA Results - Local

Related Objects

StatusSubtypeAssignedTask
In ProgressNiharika
OpenNone
OpenNone
OpenNone
DuplicateNone
OpenSkizzerz
OpenDreamy_Jazz
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenDreamy_Jazz
ResolvedDreamy_Jazz
OpenDreamy_Jazz
OpenDreamy_Jazz
OpenNone
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedMarostegui
ResolvedMarostegui
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedTchanders
ResolvedDreamy_Jazz
OpenNone
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz

Event Timeline

Change 1003023 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] Create GlobalBlockingBlockPurger service

https://gerrit.wikimedia.org/r/1003023

Change 1003023 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Create GlobalBlockingBlockPurger service

https://gerrit.wikimedia.org/r/1003023

Suggested QA steps:

  1. Install GlobalBlocking, if required
  2. Log into an account with the steward group if you have MediaWiki-extensions-CentralAuth installed, or log into an account which has the globalblock right (you can give this right to admins using $wgGroupPermissions['sysop']['globalblock'] = true; in LocalSettings.php)
  3. Load Special:GlobalBlock and create a block with an expiry of X seconds where X is a small integer
  4. Wait at least X seconds before proceeding to the next step
  5. Load Special:GlobalBlockList and verify that the block applied in step 3 appears in the list of blocks
  6. Repeat step 3 using a different IP address
  7. Load Special:GlobalBlockList and verify that the block from step 3 is now gone and the block from 6 is still present
  8. Log into an account which has globalblock-whitelist (all sysop accounts have this right by default).
  9. Load Special:GlobalBlockList and click on the local status link for the block performed in step 6
  10. Submit the form after checking the checkbox that has a label starting with Disable this global block and providing a reason
  11. Load Special:GlobalBlockList and verify that the block from step 6 no longer appears.

Like T357399: Create GlobalBlockingConnectionProvider, these QA suggested steps are designed around the idea of verifying that no changes were made to the functionality of the relevant code. This is because no changes to the functionality of the relevant code were made, instead this patch refactored and moved the relevant code. As such, you may want to check that no difference is observed in the functionality before and then after this change.

@Dreamy_Jazz There was no difference observed in the functionality from a previous commit vs current as seen in the .webms. This will be moved to Done. Thanks for all your work and steps!

Status: ✅PASS
Environment: Beta: 1.42.0-alpha (ba6da7d)17:55, 20 February 2024
OS: macOS Sonoma 14.2.1
Browser: Chrome 121, Safari 14.3
Skins. Vector 2022
Device: MBA M2
Emulated Device:: n/a
Test Links:
Special:GlobalBlock
Special:GlobalBlockList

✅AC1: https://phabricator.wikimedia.org/T357443

GlobalBlocking Current- commit 3ff1f7221510d5824fe06a14e916aba0201b91fa: Tue Feb 20 08:38:29 2024

Steps 1-7Steps 8-11

GlobalBlocking Old- commit bffe54f3cbc809dd36389ea26e9ca05f631b3414: Fri Feb 9 15:16:07 2024

Steps 1-7Steps 8-11