X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fexception%2FPermissionsError.php;h=9fa1c7ce2905bd0454d7908e63f5d2e16eabc319;hb=825d66bfa44c5dae2b78e2fe4f3b16f16aff4a12;hp=5ecd23764049503f0e9a299f5cb3af39ce78a462;hpb=b8da5c83743ea31c6f73c063508384f114748537;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/exception/PermissionsError.php b/includes/exception/PermissionsError.php index 5ecd237640..9fa1c7ce29 100644 --- a/includes/exception/PermissionsError.php +++ b/includes/exception/PermissionsError.php @@ -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 ) ]; @@ -63,10 +67,12 @@ class PermissionsError extends ErrorPageError { parent::__construct( 'permissionserrors', Message::newFromSpecifier( $errors[0] ) ); } - public function report() { + public function report( $action = self::SEND_OUTPUT ) { global $wgOut; $wgOut->showPermissionsErrorPage( $this->errors, $this->permission ); - $wgOut->output(); + if ( $action === self::SEND_OUTPUT ) { + $wgOut->output(); + } } }