r48902 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48901‎ | r48902 | r48903 >
Date:22:24, 26 March 2009
Author:aaron
Status:ok
Tags:
Comment:
Tweaks for bug 18068:
*Added unhide link for viewing of old deleted versions too
*Enabled diff buttons for privileged users
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -640,6 +640,7 @@
641641 'rev-deleted-user',
642642 'rev-deleted-event',
643643 'rev-deleted-text-permission',
 644+ 'rev-deleted-text-unhide',
644645 'rev-deleted-text-view',
645646 'rev-deleted-no-diff',
646647 'rev-deleted-unhide-diff',
Index: trunk/phase3/includes/Article.php
@@ -929,17 +929,30 @@
930930 if( is_null( $this->mRevision ) ) {
931931 // FIXME: This would be a nice place to load the 'no such page' text.
932932 } else {
933 - $this->setOldSubtitle( isset($this->mOldId) ? $this->mOldId : $oldid );
 933+ $this->setOldSubtitle( $oldid );
934934 # Allow admins to see deleted content if explicitly requested
935935 if( $this->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
936 - if( !$unhide || !$this->mRevision->userCan(Revision::DELETED_TEXT) ) {
937 - $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n", 'rev-deleted-text-permission' );
 936+ // If the user is not allowed to see it...
 937+ if( !$this->mRevision->userCan(Revision::DELETED_TEXT) ) {
 938+ $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n",
 939+ 'rev-deleted-text-permission' );
938940 $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
939941 wfProfileOut( __METHOD__ );
940942 return;
 943+ // If the user needs to confirm that they want to see it...
 944+ } else if( !$unhide ) {
 945+ # Give explanation and add a link to view the revision...
 946+ $link = $this->mTitle->getFullUrl( "oldid={$oldid}".
 947+ '&unhide=1&token='.urlencode( $wgUser->editToken($oldid) ) );
 948+ $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n",
 949+ array('rev-deleted-text-unhide',$link) );
 950+ $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
 951+ wfProfileOut( __METHOD__ );
 952+ return;
 953+ // We are allowed to see...
941954 } else {
942 - $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n", 'rev-deleted-text-view' );
943 - // and we are allowed to see...
 955+ $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n",
 956+ 'rev-deleted-text-view' );
944957 }
945958 }
946959 // Is this the current revision and otherwise cacheable? Try the parser cache...
Index: trunk/phase3/includes/PageHistory.php
@@ -252,7 +252,9 @@
253253 * @param bool $firstInList Whether this row corresponds to the first displayed on this history page.
254254 * @return string HTML output for the row
255255 */
256 - function historyLine( $row, $next, $counter = '', $notificationtimestamp = false, $latest = false, $firstInList = false ) {
 256+ function historyLine( $row, $next, $counter = '', $notificationtimestamp = false,
 257+ $latest = false, $firstInList = false )
 258+ {
257259 global $wgUser, $wgLang;
258260 $rev = new Revision( $row );
259261 $rev->setTitle( $this->mTitle );
@@ -268,10 +270,12 @@
269271 if( $wgUser->isAllowed( 'deleterevision' ) ) {
270272 if( $latest ) {
271273 // We don't currently handle well changing the top revision's settings
272 - $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.$this->message['rev-delundel'].')' );
 274+ $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.
 275+ $this->message['rev-delundel'].')' );
273276 } else if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
274277 // If revision was hidden from sysops
275 - $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.$this->message['rev-delundel'].')' );
 278+ $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.
 279+ $this->message['rev-delundel'].')' );
276280 } else {
277281 $query = array( 'target' => $this->mTitle->getPrefixedDbkey(),
278282 'oldid' => $rev->getId()
@@ -350,11 +354,14 @@
351355 function revLink( $rev ) {
352356 global $wgLang;
353357 $date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
354 - if( !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
 358+ if( $rev->userCan( Revision::DELETED_TEXT ) ) {
355359 $link = $this->mSkin->makeKnownLinkObj( $this->mTitle, $date, "oldid=" . $rev->getId() );
356360 } else {
357 - $link = '<span class="history-deleted">' . $date . '</span>';
 361+ $link = $date;
358362 }
 363+ if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
 364+ $link = "<span class=\"history-deleted\">$link</span>";
 365+ }
359366 return $link;
360367 }
361368
@@ -366,7 +373,7 @@
367374 */
368375 function curLink( $rev, $latest ) {
369376 $cur = $this->message['cur'];
370 - if( $latest || $rev->isDeleted( Revision::DELETED_TEXT ) ) {
 377+ if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
371378 return $cur;
372379 } else {
373380 return $this->mSkin->makeKnownLinkObj( $this->mTitle, $cur,
@@ -392,7 +399,7 @@
393400 # Next row probably exists but is unknown, use an oldid=prev link
394401 return $this->mSkin->makeKnownLinkObj( $this->mTitle, $last,
395402 "diff=" . $prevRev->getId() . "&oldid=prev" );
396 - } elseif( $prevRev->isDeleted(Revision::DELETED_TEXT) || $nextRev->isDeleted(Revision::DELETED_TEXT) ) {
 403+ } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
397404 return $last;
398405 } else {
399406 return $this->mSkin->makeKnownLinkObj( $this->mTitle, $last,
@@ -419,7 +426,7 @@
420427 $checkmark = array( 'checked' => 'checked' );
421428 } else {
422429 # Check visibility of old revisions
423 - if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
 430+ if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
424431 $radio['disabled'] = 'disabled';
425432 $checkmark = array(); // We will check the next possible one
426433 } else if( $counter == 2 || !$this->mOldIdChecked ) {
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1294,6 +1294,9 @@
12951295 'rev-deleted-event' => '(log action removed)',
12961296 'rev-deleted-text-permission' => "This page revision has been '''removed from the public archives'''.
12971297 There may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].",
 1298+'rev-deleted-text-unhide' => "This page revision has been '''removed from the public archives'''.
 1299+There may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].
 1300+As an administrator you can still [$1 view this revision] if you wish to proceed.",
12981301 'rev-deleted-text-view' => "This page revision has been '''removed from the public archives'''.
12991302 As an administrator you can view it; there may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].",
13001303 'rev-deleted-no-diff' => "You cannot view this diff because one of the revisions has been '''removed from the public archives'''.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r48682Add convenience links for bug 18068aaron13:26, 22 March 2009

Status & tagging log