Merge "Make a hidden form field to keep the language code"
[lhc/web/wiklou.git] / includes / Revision.php
index de69827..a6148c7 100644 (file)
@@ -952,7 +952,7 @@ class Revision implements IDBAccessObject {
        }
 
        /**
-        * @param int $field one of DELETED_* bitfield constants
+        * @param int $field One of DELETED_* bitfield constants
         *
         * @return bool
         */
@@ -1569,7 +1569,7 @@ class Revision implements IDBAccessObject {
         * operations and other such meta-modifications.
         *
         * @param DatabaseBase $dbw
-        * @param int $pageId: ID number of the page to read from
+        * @param int $pageId ID number of the page to read from
         * @param string $summary Revision's summary
         * @param bool $minor Whether the revision should be considered as minor
         * @param User|null $user User object to use or null for $wgUser
@@ -1658,19 +1658,20 @@ class Revision implements IDBAccessObject {
         */
        public static function userCanBitfield( $bitfield, $field, User $user = null ) {
                if ( $bitfield & $field ) { // aspect is deleted
-                       if ( $bitfield & self::DELETED_RESTRICTED ) {
-                               $permission = 'suppressrevision';
-                       } elseif ( $field & self::DELETED_TEXT ) {
-                               $permission = 'deletedtext';
-                       } else {
-                               $permission = 'deletedhistory';
-                       }
-                       wfDebug( "Checking for $permission due to $field match on $bitfield\n" );
                        if ( $user === null ) {
                                global $wgUser;
                                $user = $wgUser;
                        }
-                       return $user->isAllowed( $permission );
+                       if ( $bitfield & self::DELETED_RESTRICTED ) {
+                               $permissions = array( 'suppressrevision', 'viewsuppressed' );
+                       } elseif ( $field & self::DELETED_TEXT ) {
+                               $permissions = array( 'deletedtext' );
+                       } else {
+                               $permissions = array( 'deletedhistory' );
+                       }
+                       $permissionlist = implode( ', ', $permissions );
+                       wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" );
+                       return call_user_func_array( array( $user, 'isAllowedAny' ), $permissions );
                } else {
                        return true;
                }