Merge "Use config instead of globals for OutputPage"
[lhc/web/wiklou.git] / includes / specials / SpecialRevisiondelete.php
index b90026a..7eea71d 100644 (file)
@@ -160,8 +160,6 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                if ( !$this->typeName || count( $this->ids ) == 0 ) {
                        throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
                }
-               $this->typeLabels = self::$UILabels[$this->typeName];
-               $this->mIsAllowed = $user->isAllowed( RevisionDeleter::getRestriction( $this->typeName ) );
 
                # Allow the list type to adjust the passed target
                $this->targetObj = RevisionDeleter::suggestTarget(
@@ -170,6 +168,16 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        $this->ids
                );
 
+               $this->typeLabels = self::$UILabels[$this->typeName];
+               $list = $this->getList();
+               $list->reset();
+               $bitfield = $list->current()->getBits();
+               $this->mIsAllowed = $user->isAllowed( RevisionDeleter::getRestriction( $this->typeName ) );
+               $canViewSuppressedOnly = $this->getUser()->isAllowed( 'viewsuppressed' ) &&
+                       !$this->getUser()->isAllowed( 'suppressrevision' );
+               $pageIsSuppressed = $bitfield & Revision::DELETED_RESTRICTED;
+               $this->mIsAllowed = $this->mIsAllowed && !( $canViewSuppressedOnly && $pageIsSuppressed );
+
                $this->otherReason = $request->getVal( 'wpReason' );
                # We need a target page!
                if ( is_null( $this->targetObj ) ) {
@@ -444,12 +452,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
                                Html::hidden( 'type', $this->typeName ) .
                                Html::hidden( 'ids', implode( ',', $this->ids ) ) .
-                               Xml::closeElement( 'fieldset' ) . "\n";
-               } else {
-                       $out = '';
-               }
-               if ( $this->mIsAllowed ) {
-                       $out .= Xml::closeElement( 'form' ) . "\n";
+                               Xml::closeElement( 'fieldset' ) . "\n" .
+                               Xml::closeElement( 'form' ) . "\n";
                        // Show link to edit the dropdown reasons
                        if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
                                $title = Title::makeTitle( NS_MEDIAWIKI, 'Revdelete-reason-dropdown' );
@@ -461,6 +465,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                );
                                $out .= Xml::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n";
                        }
+               } else {
+                       $out = '';
                }
                $this->getOutput()->addHTML( $out );
        }
@@ -616,6 +622,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
 
        /**
         * Report that the submit operation failed
+        * @param Status $status
         */
        protected function failure( $status ) {
                // Messages: revdelete-failure, logdelete-failure