From: Umherirrender Date: Sun, 17 Sep 2017 09:09:53 +0000 (+0200) Subject: Update signature of UserGroupsChanged to match documentation X-Git-Tag: 1.31.0-rc.0~2040^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=c1281350fc54b4c353d4d033c09ffe8e1890ecad;p=lhc%2Fweb%2Fwiklou.git Update signature of UserGroupsChanged to match documentation UserGroupsChanged is called in Special:UserRights with seven args The caller in User.php only has five Change-Id: I221da323c79bb8da0113533d01b429249d15e7de --- diff --git a/includes/auth/AuthManagerAuthPlugin.php b/includes/auth/AuthManagerAuthPlugin.php index 884585829d..9a1e44547c 100644 --- a/includes/auth/AuthManagerAuthPlugin.php +++ b/includes/auth/AuthManagerAuthPlugin.php @@ -152,8 +152,9 @@ class AuthManagerAuthPlugin extends \AuthPlugin { } public function updateExternalDBGroups( $user, $addgroups, $delgroups = [] ) { - \Hooks::run( 'UserGroupsChanged', [ $user, $addgroups, $delgroups ] ); - return true; + throw new \BadMethodCallException( + 'Update of user groups via AuthPlugin is not supported with AuthManager.' + ); } public function canCreateAccounts() { diff --git a/includes/user/User.php b/includes/user/User.php index 6115144d1b..1c894a0f34 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1462,15 +1462,17 @@ class User implements IDBAccessObject { } $oldGroups = $this->getGroups(); // previous groups + $oldUGMs = $this->getGroupMemberships(); foreach ( $toPromote as $group ) { $this->addGroup( $group ); } + $newGroups = array_merge( $oldGroups, $toPromote ); // all groups + $newUGMs = $this->getGroupMemberships(); + // update groups in external authentication database - Hooks::run( 'UserGroupsChanged', [ $this, $toPromote, [], false, false ] ); + Hooks::run( 'UserGroupsChanged', [ $this, $toPromote, [], false, false, $oldUGMs, $newUGMs ] ); AuthManager::callLegacyAuthPlugin( 'updateExternalDBGroups', [ $this, $toPromote ] ); - $newGroups = array_merge( $oldGroups, $toPromote ); // all groups - $logEntry = new ManualLogEntry( 'rights', 'autopromote' ); $logEntry->setPerformer( $this ); $logEntry->setTarget( $this->getUserPage() );