Deprecate Parser implementation methods (will be private in next release)
[lhc/web/wiklou.git] / includes / exception / PermissionsError.php
index cc69a76..9fa1c7c 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.
@@ -46,7 +48,9 @@ class PermissionsError extends ErrorPageError {
 
                if ( !count( $errors ) ) {
                        $groups = [];
-                       foreach ( User::getGroupsWithPermission( $this->permission ) as $group ) {
+                       foreach ( MediaWikiServices::getInstance()
+                                                 ->getPermissionManager()
+                                                 ->getGroupsWithPermission( $this->permission ) as $group ) {
                                $groups[] = UserGroupMembership::getLink( $group, RequestContext::getMain(), 'wiki' );
                        }
 
@@ -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();
+               }
        }
 }