Drop index oi_name_archive_name on table oldimage
[lhc/web/wiklou.git] / includes / exception / PermissionsError.php
index 6ad2e37..5ecd237 100644 (file)
 class PermissionsError extends ErrorPageError {
        public $permission, $errors;
 
+       /**
+        * @param string|null $permission A permission name or null if unknown
+        * @param array $errors Error message keys or [key, param...] arrays; must not be empty if
+        *   $permission is null
+        * @throws \InvalidArgumentException
+        */
        public function __construct( $permission, $errors = [] ) {
                global $wgLang;
 
+               if ( $permission === null && !$errors ) {
+                       throw new \InvalidArgumentException( __METHOD__ .
+                               ': $permission and $errors cannot both be empty' );
+               }
+
                $this->permission = $permission;
 
                if ( !count( $errors ) ) {
@@ -47,6 +58,9 @@ class PermissionsError extends ErrorPageError {
                }
 
                $this->errors = $errors;
+
+               // Give the parent class something to work with
+               parent::__construct( 'permissionserrors', Message::newFromSpecifier( $errors[0] ) );
        }
 
        public function report() {