Merge "Make WikiMap fall back to sites if a site couldn't be found using $wgConf"
[lhc/web/wiklou.git] / includes / specials / SpecialRevisiondelete.php
index e0a964e..7c27ac4 100644 (file)
@@ -110,6 +110,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        }
 
        public function execute( $par ) {
+               $this->useTransactionalTimeLimit();
+
                $this->checkPermissions();
                $this->checkReadOnly();
 
@@ -132,18 +134,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                // $this->ids = array_map( 'intval', $this->ids );
                $this->ids = array_unique( array_filter( $this->ids ) );
 
-               if ( $request->getVal( 'action' ) == 'historysubmit'
-                       || $request->getVal( 'action' ) == 'revisiondelete'
-               ) {
-                       // For show/hide form submission from history page
-                       // Since we are access through index.php?title=XXX&action=historysubmit
-                       // getFullTitle() will contain the target title and not our title
-                       $this->targetObj = $this->getFullTitle();
-                       $this->typeName = 'revision';
-               } else {
-                       $this->typeName = $request->getVal( 'type' );
-                       $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
-               }
+               $this->typeName = $request->getVal( 'type' );
+               $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
 
                # For reviewing deleted files...
                $this->archiveName = $request->getVal( 'file' );
@@ -168,6 +160,13 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        $this->ids
                );
 
+               # We need a target page!
+               if ( $this->targetObj === null ) {
+                       $output->addWikiMsg( 'undelete-header' );
+
+                       return;
+               }
+
                $this->typeLabels = self::$UILabels[$this->typeName];
                $list = $this->getList();
                $list->reset();
@@ -179,12 +178,6 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $this->mIsAllowed = $this->mIsAllowed && !( $canViewSuppressedOnly && $pageIsSuppressed );
 
                $this->otherReason = $request->getVal( 'wpReason' );
-               # We need a target page!
-               if ( is_null( $this->targetObj ) ) {
-                       $output->addWikiMsg( 'undelete-header' );
-
-                       return;
-               }
                # Give a link to the logs/hist for this page
                $this->showConvenienceLinks();
 
@@ -378,7 +371,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $out->wrapWikiMsg( "<strong>$1</strong>", array( $this->typeLabels['selected'],
                        $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ) );
 
-               $out->addHelpLink( 'Help:RevisionDelete' );
+               $this->addHelpLink( 'Help:RevisionDelete' );
                $out->addHTML( "<ul>" );
 
                $numRevisions = 0;
@@ -460,9 +453,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                Xml::closeElement( 'form' ) . "\n";
                        // Show link to edit the dropdown reasons
                        if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
-                               $title = Title::makeTitle( NS_MEDIAWIKI, 'Revdelete-reason-dropdown' );
-                               $link = Linker::link(
-                                       $title,
+                               $link = Linker::linkKnown(
+                                       $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->getTitle(),
                                        $this->msg( 'revdelete-edit-reasonlist' )->escaped(),
                                        array(),
                                        array( 'action' => 'edit' )
@@ -596,7 +588,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        throw new PermissionsError( 'suppressrevision' );
                }
                # If the save went through, go to success message...
-               $status = $this->save( $bitParams, $comment, $this->targetObj );
+               $status = $this->save( $bitParams, $comment );
                if ( $status->isGood() ) {
                        $this->success();
 
@@ -616,7 +608,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                // Messages: revdelete-success, logdelete-success
                $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
                $this->getOutput()->wrapWikiMsg(
-                       "<span class=\"success\">\n$1\n</span>",
+                       "<div class=\"successbox\">\n$1\n</div>",
                        $this->typeLabels['success']
                );
                $this->wasSaved = true;
@@ -631,7 +623,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        protected function failure( $status ) {
                // Messages: revdelete-failure, logdelete-failure
                $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
-               $this->getOutput()->addWikiText( $status->getWikiText( $this->typeLabels['failure'] ) );
+               $this->getOutput()->addWikiText( '<div class="errorbox">' .
+                       $status->getWikiText( $this->typeLabels['failure'] ) .
+                       '</div>'
+               );
                $this->showForm();
        }
 
@@ -659,14 +654,13 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
 
        /**
         * Do the write operations. Simple wrapper for RevDel*List::setVisibility().
-        * @param int $bitfield
+        * @param array $bitPars ExtractBitParams() bitfield array
         * @param string $reason
-        * @param Title $title
         * @return Status
         */
-       protected function save( $bitfield, $reason, $title ) {
+       protected function save( array $bitPars, $reason ) {
                return $this->getList()->setVisibility(
-                       array( 'value' => $bitfield, 'comment' => $reason )
+                       array( 'value' => $bitPars, 'comment' => $reason )
                );
        }