Page MenuHomePhabricator

Create the GlobalBlockManager service
Closed, ResolvedPublic2 Estimated Story Points

Description

A service is needed to allow callers to modify, delete and insert global blocks stored in the globalblocks table. This service will move methods from the GlobalBlocking static utility class that are related to managing global blocks, and will also modify the methods to use dependency injection and other necessary fixes that perform no change to the functionality of the methods.

The methods being in a service also allows easier testing, as the existing methods are only partly tested and will allow mocking these methods for future tests of code that uses this service

Acceptance criteria
  • Create the GlobalBlockManager service by using copies of the relevant methods from the GlobalBlocking static utility class
  • Update the methods to use DI and SQL query builders
  • Ensure good test coverage over the new service

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

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

[mediawiki/extensions/GlobalBlocking@master] [WIP] Create GlobalBlockManager service

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

Dreamy_Jazz set the point value for this task to 2.Feb 19 2024, 5:54 PM

Change 1004750 merged by jenkins-bot:

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

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

Suggested QA steps:

  1. Install GlobalBlocking, if not already installed
  2. Log into an account with the steward group
  3. Do the following steps with an IP address and then IP address range. You may also want to test different options for the block:
    1. Go to Special:GlobalBlock and perform a block
    2. Go to Special:GlobalBlockList and verify that the block performed in step 3A appears in the list with the settings you specified
  4. Click modify on one of the blocks you performed in step 3 and modify the settings for the block
  5. Go back to Special:GlobalBlockList and verify that the block has been updated
  6. Click remove for one of the blocks you performed in step 3 and do the form that appears to remove the block
  7. Go back to Special:GlobalBlockList and verify that the block that you removed no longer appears in the list
  8. Load Special:Log and verify that log events appear for each block you performed, modified and removed.

As with T357506: Create GlobalBlockLocalStatusLookup service, these changes should produce no functionality change. As such you may want to test using these steps on a older version of the code and verify no changes are seen.

dom_walden subscribed.

I tested creating and modifying blocks and checking the data is correct in the database.

I tested unblocking and expiring old blocks.

I briefly tested validation when creating blocks.

Test environments: