https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/heads/master/maintenance/tables.sql ipblocks_restrictions Table: CREATE TABLE /*_*/ipblocks_restrictions ( -- The ipb_id from ipblocks ir_ipb_id int NOT NULL, -- The restriction type id. ir_type tinyint(1) NOT NULL, -- The restriction id that corrposponds to the type. Typically a Page ID or a -- Namespace ID. ir_value int NOT NULL, PRIMARY KEY (ir_ipb_id, ir_type, ir_value) ) /*$wgDBTableOptions*/; Example query MariaDB [enwiki_p]> SELECT ir_ipb_id, CASE WHEN ( ir_type = 1 ) THEN 'page' ELSE 'namespace' END AS 'type', ir_value FROM ipblocks_restrictions LIMIT 25; +-----------+-----------+----------+ | ir_ipb_id | type | ir_value | +-----------+-----------+----------+ | 9435157 | namespace | 4 | | 9495590 | page | 57861199 | | 9497043 | page | 30859855 | | 9498101 | page | 2333491 | | 9498101 | page | 42165878 | | 9517403 | page | 28280067 | | 9517475 | page | 50803 | | 9517475 | page | 87276 | | 9517475 | page | 19629641 | | 9517475 | page | 21347867 | | 9517475 | page | 23871476 | | 9517475 | page | 25169060 | | 9517475 | page | 61818020 | | 9531962 | page | 24758230 | | 9533323 | page | 497526 | | 9536130 | page | 2015570 | | 9540101 | namespace | 0 | | 9542727 | page | 165094 | | 9559276 | namespace | 0 | | 9559540 | page | 654157 | | 9561071 | page | 59625567 | | 9561107 | page | 62990726 | | 9562223 | page | 585629 | | 9562223 | page | 21486360 | | 9563237 | page | 34355486 | +-----------+-----------+----------+ Note that: `type` is either 1 or 2, shown as `page` or `namespace` to ease understanding ir_value can only be an int, meaning that it cannot hold the action as a string Multiple rows for a single block with multiple restrictions Proposed implementation: ActionRestriction, like for namespace / page type: 3 ir_value - constant mapping with string to int, more added by hook (for thanks) ActionRestriction::ACTION_CREATE_VALUE => 1 ActionRestriction::ACTION_UPLOAD_VALUE => 2 run hook ACTION_THANK_VALUE = 101 Hook requires that no values override existing mapping Values 1-100 are reserved for core +-----------+-----------+----------+ | ir_ipb_id | type | ir_value | +-----------+-----------+----------+ | 9562223 | action | 1 | | 9562223 | action | 2 | | 9563237 | action | 101 | +-----------+-----------+----------+ ^ 1 block from creating and uploading, and another block from thanks