Page MenuHomePhabricator

Consider removing page_restrictions.pr_user field from schema
Open, Needs TriagePublic

Description

The page_restrictions table contains a pr_user field:

-- Field for future support of per-user restriction.
pr_user int unsigned NULL,

This field was introduced in 2007 by changeset https://phabricator.wikimedia.org/rSVN19047 . I found no relevant tracking ticket to actually implement this per-user restrictions feature. As such, probably the field should be removed from schema as it was never used and probably will not be.

Alternatively, if the field is still in use somehow (does not seem so), such usage should be documented in the description.

Event Timeline

Change 445595 had a related patch set uploaded (by Ladsgroup; owner: Amir Sarabadani):
[mediawiki/core@master] Drop pr_user from page_restrictions

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

Targets
    Occurrences of 'pr_user' in Directory /Users/reedy/PhpstormProjects/mediawiki/extensions
Found Occurrences  (9 usages found)
    Unclassified occurrence  (2 usages found)
        mediawiki  (2 usages found)
            extensions/PageBlock  (2 usages found)
                PageBlock.body.php  (1 usage found)
                    64 $restrictions[$row->pr_user][$row->pr_type] = $expiry;
                SpecialListRestrictions.php  (1 usage found)
                    79 $user = User::newFromId( $row->pr_user );
    Usage in string constants  (7 usages found)
        mediawiki  (7 usages found)
            extensions/PageBlock  (7 usages found)
                PageBlock.body.php  (5 usages found)
                    45 $conds['pr_user'] = $user->getId();
                    47 $conds[] = 'pr_user IS NOT NULl';
                    53 array( 'pr_user', 'pr_expiry', 'pr_type' ),
                    145 'pr_user' => $user->getId()
                    155 'pr_user' => $user->getId(),
                SpecialListRestrictions.php  (2 usages found)
                    142 $conds[] = 'pr_user=' . $this->mDb->addQuotes( $this->user->getId() );
                    153 'pr_type', 'pr_user', 'pr_expiry' ),

Change 487621 had a related patch set uploaded (by Zoranzoki21; owner: Zoranzoki21):
[mediawiki/extensions/PageBlock@master] Removal of using pr_user field from schema

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

Given that the PageBlock extension is written by @Legoktm. Let's ping him to see what is the best course of action here.

Change 487621 abandoned by Zoranzoki21:
Removal of using pr_user field from schema

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

Given that the PageBlock extension is written by @Legoktm. Let's ping him to see what is the best course of action here.

The issue with the PageBlock extension is now moot, since the extension was archived
The initial reason to have the field ("future support of per-user restriction") no longer applies, since we have partial blocks
@Ladsgroup if you can rebase and update your patch, I'd be happy to review it