Add a 'revdelete-selected-file' message on Special:RevisionDelete
[lhc/web/wiklou.git] / includes / specials / SpecialRevisiondelete.php
index 804f7a9..7abc253 100644 (file)
@@ -55,34 +55,47 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        /** The RevDel_List object, storing the list of items to be deleted/undeleted */
        var $list;
 
+       /** Was the DB modified in this request */
+       protected $wasSaved = false;
+
        /**
         * UI labels for each type.
         */
        static $UILabels = array(
                'revision' => array(
-                       'check-label'   => 'revdelete-hide-text',
-                       'success'               => 'revdelete-success',
-                       'failure'               => 'revdelete-failure',
+                       'check-label' => 'revdelete-hide-text',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-text',
+                       'selected'=> 'revdelete-selected-text',
                ),
                'archive' => array(
-                       'check-label'   => 'revdelete-hide-text',
-                       'success'               => 'revdelete-success',
-                       'failure'               => 'revdelete-failure',
+                       'check-label' => 'revdelete-hide-text',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-text',
+                       'selected'=> 'revdelete-selected-text',
                ),
                'oldimage' => array(
-                       'check-label'   => 'revdelete-hide-image',
-                       'success'               => 'revdelete-success',
-                       'failure'               => 'revdelete-failure',
+                       'check-label' => 'revdelete-hide-image',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-file',
+                       'selected'=> 'revdelete-selected-file',
                ),
                'filearchive' => array(
-                       'check-label'   => 'revdelete-hide-image',
-                       'success'               => 'revdelete-success',
-                       'failure'               => 'revdelete-failure',
+                       'check-label' => 'revdelete-hide-image',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-file',
+                       'selected'=> 'revdelete-selected-file',
                ),
                'logging' => array(
-                       'check-label'   => 'revdelete-hide-name',
-                       'success'               => 'logdelete-success',
-                       'failure'               => 'logdelete-failure',
+                       'check-label' => 'revdelete-hide-name',
+                       'success' => 'logdelete-success',
+                       'failure' => 'logdelete-failure',
+                       'text' => 'logdelete-text',
+                       'selected' => 'logdelete-selected',
                ),
        );
 
@@ -177,14 +190,24 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                # Show relevant lines from the deletion log
                $deleteLogPage = new LogPage( 'delete' );
                $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
-               LogEventsList::showLogExtract( $output, 'delete',
-                       $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
+               LogEventsList::showLogExtract(
+                       $output,
+                       'delete',
+                       $this->targetObj,
+                       '', /* user */
+                       array( 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved )
+               );
                # Show relevant lines from the suppression log
                if ( $user->isAllowed( 'suppressionlog' ) ) {
                        $suppressLogPage = new LogPage( 'suppress' );
                        $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
-                       LogEventsList::showLogExtract( $output, 'suppress',
-                               $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
+                       LogEventsList::showLogExtract(
+                               $output,
+                               'suppress',
+                               $this->targetObj,
+                               '',
+                               array( 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved )
+                       );
                }
        }
 
@@ -315,14 +338,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         * which will allow the user to choose new visibility settings.
         */
        protected function showForm() {
-               $UserAllowed = true;
+               $userAllowed = true;
 
-               if ( $this->typeName == 'logging' ) {
-                       $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLanguage()->formatNum( count( $this->ids ) ) );
-               } else {
-                       $this->getOutput()->addWikiMsg( 'revdelete-selected',
-                               $this->targetObj->getPrefixedText(), count( $this->ids ) );
-               }
+               $this->getOutput()->wrapWikiMsg( "<strong>$1</strong>", array( $this->typeLabels['selected'],
+                       $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ) );
 
                $this->getOutput()->addHTML( "<ul>" );
 
@@ -335,7 +354,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                if ( !$this->submitClicked ) {
                                        throw new PermissionsError( 'suppressrevision' );
                                }
-                               $UserAllowed = false;
+                               $userAllowed = false;
                        }
                        $numRevisions++;
                        $this->getOutput()->addHTML( $item->getHTML() );
@@ -350,7 +369,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $this->addUsageText();
 
                // Normal sysops can always see what they did, but can't always change it
-               if ( !$UserAllowed ) {
+               if ( !$userAllowed ) {
                        return;
                }
 
@@ -418,7 +437,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         * @todo FIXME: Wikimedia-specific policy text
         */
        protected function addUsageText() {
-               $this->getOutput()->addWikiMsg( 'revdelete-text' );
+               $this->getOutput()->wrapWikiMsg( "<strong>$1</strong>\n$2", $this->typeLabels['text'], 'revdelete-text-others' );
                if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
                        $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
                }
@@ -523,6 +542,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        protected function success() {
                $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
                $this->getOutput()->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeLabels['success'] );
+               $this->wasSaved = true;
                $this->list->reloadFromMaster();
                $this->showForm();
        }