Add convenience links for bug 18068
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 22 Mar 2009 13:26:27 +0000 (13:26 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 22 Mar 2009 13:26:27 +0000 (13:26 +0000)
includes/Article.php
includes/diff/DifferenceEngine.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 817c346..ef219ea 100644 (file)
@@ -792,10 +792,10 @@ class Article {
 
                # Allow admins to see deleted content if explicitly requested
                $delId = $diff ? $diff : $oldid;
-               $unhide = $wgRequest->getInt('unhide') == 1 && $wgUser->matchEditToken( $wgRequest->getVal('token'), $delId );
+               $unhide = $wgRequest->getInt('unhide') == 1
+                       && $wgUser->matchEditToken( $wgRequest->getVal('token'), $delId );
                # If we got diff and oldid in the query, we want to see a
                # diff page instead of the article.
-
                if( !is_null( $diff ) ) {
                        $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
 
index 1d7defc..aa48f9f 100644 (file)
@@ -283,15 +283,27 @@ CONTROL;
                        '<div id="mw-diff-ntitle3">' . $newminor . $sk->revComment( $this->mNewRev, !$diffOnly, !$this->unhide ).$rdel."</div>" .
                        '<div id="mw-diff-ntitle4">' . $nextlink . $patrol . '</div>';
 
-               # Output the diff if allowed
-               $allowed = $this->mOldRev->userCan(Revision::DELETED_TEXT) && $this->mNewRev->userCan(Revision::DELETED_TEXT);
-               $deleted = $this->mOldRev->isDeleted(Revision::DELETED_TEXT) || $this->mNewRev->isDeleted(Revision::DELETED_TEXT);
+               # Check if this user can see the revisions
+               $allowed = $this->mOldRev->userCan(Revision::DELETED_TEXT)
+                       && $this->mNewRev->userCan(Revision::DELETED_TEXT);
+               $deleted = $this->mOldRev->isDeleted(Revision::DELETED_TEXT)
+                       || $this->mNewRev->isDeleted(Revision::DELETED_TEXT);
+               # Output the diff if allowed...
                if( $deleted && (!$this->unhide || !$allowed) ) {
                        $this->showDiffStyle();
                        $multi = $this->getMultiNotice();
                        $wgOut->addHTML( $this->addHeader( '', $oldHeader, $newHeader, $multi ) );
-                       $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n",
-                               array( 'rev-deleted-no-diff' ) );
+                       if( !$allowed ) {
+                               # Give explanation for why revision is not visible
+                               $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n",
+                                       array( 'rev-deleted-no-diff' ) );
+                       } else {
+                               # Give explanation and add a link to view the diff...
+                               $link = $this->mTitle->getFullUrl( "diff={$this->mNewid}&oldid={$this->mOldid}".
+                                       '&unhide=1&token='.urlencode( $wgUser->editToken($this->mNewid) ) );
+                               $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n",
+                                       array( 'rev-deleted-unhide-diff', $link ) );
+                       }
                } else if( $wgEnableHtmlDiff && $this->htmldiff ) {
                        $multi = $this->getMultiNotice();
                        $wgOut->addHTML('<div class="diff-switchtype">'.$sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'wikicodecomparison' ),
index 43b1af2..6623cc0 100644 (file)
@@ -1293,13 +1293,15 @@ Try [[Special:Search|searching on the wiki]] for relevant new pages.',
 'rev-deleted-comment'            => '(comment removed)',
 'rev-deleted-user'               => '(username removed)',
 'rev-deleted-event'              => '(log action removed)',
-'rev-deleted-text-permission'    => 'This page revision has been removed from the public archives.
+'rev-deleted-text-permission'    => 'This page revision has been \'\'\'removed from the public archives\'\'\'.
 There may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].',
-'rev-deleted-text-view'          => 'This page revision has been removed from the public archives.
-As an administrator on {{SITENAME}} you can view it;
-there may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].',
-'rev-deleted-no-diff'            => 'You cannot view this diff because one of the revisions has been removed from the public archives.
+'rev-deleted-text-view'          => 'This page revision has been \'\'\'removed from the public archives\'\'\'.
+As an administrator on {{SITENAME}} you can view it; there may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].',
+'rev-deleted-no-diff'            => 'You cannot view this diff because one of the revisions has been \'\'\'removed from the public archives\'\'\'.
 There may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].',
+'rev-deleted-unhide-diff'        => 'One of the revisions of this diff has been \'\'\'removed from the public archives\'\'\'.
+There may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].
+As an administrator on {{SITENAME}} you can still [$1 view this diff] if you wish to proceed.',
 'rev-delundel'                   => 'show/hide',
 'revisiondelete'                 => 'Delete/undelete revisions',
 'revdelete-nooldid-title'        => 'Invalid target revision',
index fe07ca0..f11afbd 100644 (file)
@@ -643,6 +643,7 @@ $wgMessageStructure = array(
                'rev-deleted-text-permission',
                'rev-deleted-text-view',
                'rev-deleted-no-diff',
+               'rev-deleted-unhide-diff',
                'rev-delundel',
                'revisiondelete',
                'revdelete-nooldid-title',