Merge "ProxyLookup: Optimise in_array in isConfiguredProxy()"
[lhc/web/wiklou.git] / includes / exception / PermissionsError.php
index 5ecd237..87a3dc2 100644 (file)
@@ -18,6 +18,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Show an error when a user tries to do something they do not have the necessary
  * permissions for.
@@ -45,10 +47,12 @@ class PermissionsError extends ErrorPageError {
                $this->permission = $permission;
 
                if ( !count( $errors ) ) {
-                       $groups = array_map(
-                               [ 'User', 'makeGroupLinkWiki' ],
-                               User::getGroupsWithPermission( $this->permission )
-                       );
+                       $groups = [];
+                       foreach ( MediaWikiServices::getInstance()
+                                                 ->getPermissionManager()
+                                                 ->getGroupsWithPermission( $this->permission ) as $group ) {
+                               $groups[] = UserGroupMembership::getLink( $group, RequestContext::getMain(), 'wiki' );
+                       }
 
                        if ( $groups ) {
                                $errors[] = [ 'badaccess-groups', $wgLang->commaList( $groups ), count( $groups ) ];