Page MenuHomePhabricator

User::$mCoreRights made protected in 1.24, breaking stuff
Closed, ResolvedPublic

Description

In 1.24 User::$mCoreRights was made protected, and User::getAllRights() is not usable from LocalSettings.php since it calls a hook.

For a similar case about styles, see T76461.
For a similar case about mCoreRights, see T76264.
For a similar case about mLinktags, see T76168.

Event Timeline

alex-mashin raised the priority of this task from to Unbreak Now!.
alex-mashin updated the task description. (Show Details)
alex-mashin added a project: Labs-Vagrant.
alex-mashin changed Security from none to None.
alex-mashin added a subscriber: alex-mashin.

In addition, having logged in here with some difficulty, I was unable to set any meaningful "Projects" field.

This is likely due to an extension calling something too early during the setup process. Can you provide a full backtrace? See https://www.mediawiki.org/wiki/Manual:How_to_debug#PHP_errors for instructions on how to turn that on.

This is likely due to an extension calling something too early during the setup process. Can you provide a full backtrace? See https://www.mediawiki.org/wiki/Manual:How_to_debug#PHP_errors for instructions on how to turn that on.

There used to be a reference to User::$mCoreRights in my LocalSettings.php, which was copied into privileged user group's permissions, so that they could do everything. In 1.24 this property was made protected so I replaced it with User::getAllRights (). Evidently, this method calls wfRunHooks () but GlobalFunctions.php is not yet required when LocalSettings.php is processed. I am not sure that this is right.

I gor around this problem by wrapping this code in LocalSettings.php in a hooked function - I chose MediaWikiPerformAction for the time being.

Aklapper lowered the priority of this task from Unbreak Now! to Normal.Dec 3 2014, 4:36 PM
Aklapper updated the task description. (Show Details)
Aklapper added a subscriber: Aklapper.

I've added references to other tickets in the task description. This is due to https://github.com/wikimedia/mediawiki/commit/df49428b90ecfee7e9e7e9ffdcaca440a4375b50 and there is a simple workaround for the time being plus an intentional change, hence I'm lowering the priority.

Legoktm renamed this task from MediaWiki 1.24 at gerrit broken to User::$mCoreRights made protected in 1.24, breaking stuff.Dec 3 2014, 5:53 PM
Legoktm updated the task description. (Show Details)

User::getAllRights() isn't a good idea aside from the wfRunHooks issue, since it instance caches the result so any extension that tries to add rights after that wouln't work.

Adding a User::getAllCoreRights() accessor seems weird because there really should be no distinction on where a right comes from.

Aklapper lowered the priority of this task from Normal to Low.Feb 5 2015, 10:04 PM

User::getAllRights() isn't a good idea aside from the wfRunHooks issue, since it instance caches the result so any extension that tries to add rights after that wouln't work.
Adding a User::getAllCoreRights() accessor seems weird because there really should be no distinction on where a right comes from.

@alex-mashin: Any comments?

@alex-mashin: Any comments?

Now I moved the code that grants to privileged users all possible rights not already taken from $wgGroupPermissions to userCan hook. So far, that has been enough.

I'm removing MW-1.24-release here as I have not seen any other reports about this. If someone ever comes up with a patch merged into git master, feel free to request a backport of course, but this task obviously does not block 1.24 releases.

Legoktm closed this task as Resolved.Jun 22 2015, 9:52 PM
Legoktm claimed this task.

As of 1.25, User::getAllRights() should now be usable from LocalSettings.php, though inadvisable.

Legoktm removed Legoktm as the assignee of this task.Jun 22 2015, 9:52 PM

As of 1.25, User::getAllRights() should now be usable from LocalSettings.php, though inadvisable.

Thanks! https://www.mediawiki.org/w/index.php?title=Manual:User_rights&diff=1879459&oldid=1875085