From 4b9187e598ace0f92d8059553892626f679ad893 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 22 Mar 2009 13:26:27 +0000 Subject: [PATCH] Add convenience links for bug 18068 --- includes/Article.php | 4 ++-- includes/diff/DifferenceEngine.php | 22 +++++++++++++++++----- languages/messages/MessagesEn.php | 12 +++++++----- maintenance/language/messages.inc | 1 + 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 817c346fe8..ef219ea361 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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() ); diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 1d7defc026..aa48f9f31c 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -283,15 +283,27 @@ CONTROL; '
' . $newminor . $sk->revComment( $this->mNewRev, !$diffOnly, !$this->unhide ).$rdel."
" . '
' . $nextlink . $patrol . '
'; - # 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( "\n", - array( 'rev-deleted-no-diff' ) ); + if( !$allowed ) { + # Give explanation for why revision is not visible + $wgOut->wrapWikiMsg( "\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( "\n", + array( 'rev-deleted-unhide-diff', $link ) ); + } } else if( $wgEnableHtmlDiff && $this->htmldiff ) { $multi = $this->getMultiNotice(); $wgOut->addHTML('
'.$sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'wikicodecomparison' ), diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 43b1af2f19..6623cc0170 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index fe07ca0df4..f11afbd978 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -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', -- 2.20.1