r20525 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20524‎ | r20525 | r20526 >
Date:16:01, 16 March 2007
Author:brion
Status:old
Tags:
Comment:
For now revert the rev_deleted branch merge; don't want trunk to get too far gone before changes are reviewed!
Reverted: 20511, 20510, 20507, 20474, 20461, 20460, 20457, 20448, 20446
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/Export.php (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/includes/SpecialLog.php (modified) (history)
  • /trunk/phase3/includes/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/includes/SpecialRevisiondelete.php (modified) (history)
  • /trunk/phase3/includes/SpecialUndelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -1652,7 +1652,7 @@
16531653 * @return bool true on success
16541654 */
16551655 function updateRestrictions( $limit = array(), $reason = '', $cascade = 0, $expiry = null ) {
1656 - global $wgUser, $wgRestrictionTypes, $wgContLang, $wgGroupPermissions;
 1656+ global $wgUser, $wgRestrictionTypes, $wgContLang;
16571657
16581658 $id = $this->mTitle->getArticleID();
16591659 if( !$wgUser->isAllowed( 'protect' ) || wfReadOnly() || $id == 0 ) {
@@ -1707,11 +1707,6 @@
17081708 $nullRevision = Revision::newNullRevision( $dbw, $id, $comment, true );
17091709 $nullRevId = $nullRevision->insertOn( $dbw );
17101710
1711 - foreach( $limit as $action => $restrictions ) {
1712 - # Check if the group level required to edit also can protect pages
1713 - # Otherwise, people who cannot normally protect can "protect" pages via transclusion
1714 - $cascade = ( $cascade && isset($wgGroupPermissions[$restrictions]['protect']) && $wgGroupPermissions[$restrictions]['protect'] );
1715 - }
17161711 # Update restrictions table
17171712 foreach( $limit as $action => $restrictions ) {
17181713 if ($restrictions != '' ) {
@@ -1787,8 +1782,6 @@
17881783 $confirm = $wgRequest->wasPosted() &&
17891784 $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
17901785 $reason = $wgRequest->getText( 'wpReason' );
1791 - # Flag to hide all contents of the archived revisions
1792 - $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed('deleterevision');
17931786
17941787 # This code desperately needs to be totally rewritten
17951788
@@ -1820,7 +1813,7 @@
18211814 }
18221815
18231816 if( $confirm ) {
1824 - $this->doDelete( $reason, $suppress );
 1817+ $this->doDelete( $reason );
18251818 if( $wgRequest->getCheck( 'wpWatch' ) ) {
18261819 $this->doWatch();
18271820 } elseif( $this->mTitle->userIsWatching() ) {
@@ -1966,14 +1959,7 @@
19671960 $delcom = htmlspecialchars( wfMsg( 'deletecomment' ) );
19681961 $token = htmlspecialchars( $wgUser->editToken() );
19691962 $watch = Xml::checkLabel( wfMsg( 'watchthis' ), 'wpWatch', 'wpWatch', $wgUser->getBoolOption( 'watchdeletion' ) || $this->mTitle->userIsWatching(), array( 'tabindex' => '2' ) );
1970 - if ( $wgUser->isAllowed( 'deleterevision' ) ) {
1971 - $supress = "<tr><td>&nbsp;</td><td>";
1972 - $supress .= Xml::checkLabel( wfMsg( 'revdelete-suppress' ), 'wpSuppress', 'wpSuppress', false, array( 'tabindex' => '2' ) );
1973 - $supress .= "</td></tr>";
1974 - } else {
1975 - $supress = '';
1976 - }
1977 -
 1963+
19781964 $wgOut->addHTML( "
19791965 <form id='deleteconfirm' method='post' action=\"{$formaction}\">
19801966 <table border='0'>
@@ -1985,7 +1971,6 @@
19861972 <input type='text' size='60' name='wpReason' id='wpReason' value=\"" . htmlspecialchars( $reason ) . "\" tabindex=\"1\" />
19871973 </td>
19881974 </tr>
1989 - $supress
19901975 <tr>
19911976 <td>&nbsp;</td>
19921977 <td>$watch</td>
@@ -2024,12 +2009,12 @@
20252010 /**
20262011 * Perform a deletion and output success or failure messages
20272012 */
2028 - function doDelete( $reason, $suppress = false ) {
 2013+ function doDelete( $reason ) {
20292014 global $wgOut, $wgUser;
20302015 wfDebug( __METHOD__."\n" );
20312016
20322017 if (wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason))) {
2033 - if ( $this->doDeleteArticle( $reason, $suppress ) ) {
 2018+ if ( $this->doDeleteArticle( $reason ) ) {
20342019 $deleted = wfEscapeWikiText( $this->mTitle->getPrefixedText() );
20352020
20362021 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
@@ -2052,7 +2037,7 @@
20532038 * Deletes the article with database consistency, writes logs, purges caches
20542039 * Returns success
20552040 */
2056 - function doDeleteArticle( $reason, $suppress = false ) {
 2041+ function doDeleteArticle( $reason ) {
20572042 global $wgUseSquid, $wgDeferredUpdateList;
20582043 global $wgUseTrackbacks;
20592044
@@ -2070,17 +2055,6 @@
20712056 $u = new SiteStatsUpdate( 0, 1, -(int)$this->isCountable( $this->getContent() ), -1 );
20722057 array_push( $wgDeferredUpdateList, $u );
20732058
2074 - // Bitfields to further supress the content
2075 - if ( $suppress ) {
2076 - $bitfield = 0;
2077 - $bitfield |= Revision::DELETED_TEXT;
2078 - $bitfield |= Revision::DELETED_COMMENT;
2079 - $bitfield |= Revision::DELETED_USER;
2080 - $bitfield |= Revision::DELETED_RESTRICTED;
2081 - } else {
2082 - $bitfield = 'rev_deleted';
2083 - }
2084 -
20852059 // For now, shunt the revision data into the archive table.
20862060 // Text is *not* removed from the text table; bulk storage
20872061 // is left intact to avoid breaking block-compression or
@@ -2104,7 +2078,7 @@
21052079 'ar_text_id' => 'rev_text_id',
21062080 'ar_text' => '\'\'', // Be explicit to appease
21072081 'ar_flags' => '\'\'', // MySQL's "strict mode"...
2108 - 'ar_deleted' => $bitfield
 2082+ 'ar_len' => 'rev_len'
21092083 ), array(
21102084 'page_id' => $id,
21112085 'page_id = rev_page'
@@ -2145,9 +2119,8 @@
21462120 # Clear caches
21472121 Article::onArticleDelete( $this->mTitle );
21482122
2149 - # Log the deletion, if the page was suppressed, log it at Oversight instead
2150 - $logtype = ($suppress) ? 'oversight' : 'delete';
2151 - $log = new LogPage( $logtype );
 2123+ # Log the deletion
 2124+ $log = new LogPage( 'delete' );
21522125 $log->addEntry( 'delete', $this->mTitle, $reason );
21532126
21542127 # Clear the cached article id so the interface doesn't act like we exist
@@ -2253,13 +2226,8 @@
22542227 );
22552228 }
22562229
2257 - $target = Revision::newFromId( $s->rev_id );
2258 - # Revision *must* be public and we don't well handle deleted edits on top
2259 - if ( $target->isDeleted(REVISION::DELETED_TEXT) ) {
2260 - $wgOut->setPageTitle( wfMsg('rollbackfailed') );
2261 - $wgOut->addHTML( wfMsg( 'missingarticle' ) );
2262 - }
22632230 # Get the edit summary
 2231+ $target = Revision::newFromId( $s->rev_id );
22642232 $newComment = wfMsgForContent( 'revertpage', $target->getUserText(), $from );
22652233 $newComment = $wgRequest->getText( 'summary', $newComment );
22662234
@@ -2437,30 +2405,10 @@
24382406 ? wfMsg( 'diff' )
24392407 : $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=next&oldid='.$oldid );
24402408
2441 - $cdel='';
2442 - if( $wgUser->isAllowed( 'deleterevision' ) ) {
2443 - $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
2444 - if( $revision->isCurrent() ) {
2445 - // We don't handle top deleted edits too well
2446 - $cdel = wfMsgHtml('rev-delundel');
2447 - } else if( !$revision->userCan( Revision::DELETED_RESTRICTED ) ) {
2448 - // If revision was hidden from sysops
2449 - $cdel = wfMsgHtml('rev-delundel');
2450 - } else {
2451 - $cdel = $sk->makeKnownLinkObj( $revdel,
2452 - wfMsgHtml('rev-delundel'),
2453 - 'target=' . urlencode( $this->mTitle->getPrefixedDbkey() ) .
2454 - '&oldid=' . urlencode( $oldid ) );
2455 - // Bolden oversighted content
2456 - if( $revision->isDeleted( Revision::DELETED_RESTRICTED ) )
2457 - $cdel = "<strong>$cdel</strong>";
2458 - }
2459 - $cdel = "(<small>$cdel</small>)";
2460 - }
 2409+ $userlinks = $sk->userLink( $revision->getUser(), $revision->getUserText() )
 2410+ . $sk->userToolLinks( $revision->getUser(), $revision->getUserText() );
24612411
2462 - $userlinks = $sk->revUserTools( $revision, true );
2463 -
2464 - $r = "\n\t\t\t\t<div id=\"mw-revision-info\">" . "<tt>$cdel</tt>" . wfMsg( 'revision-info', $td, $userlinks ) . "</div>\n" .
 2412+ $r = "\n\t\t\t\t<div id=\"mw-revision-info\">" . wfMsg( 'revision-info', $td, $userlinks ) . "</div>\n" .
24652413 "\n\t\t\t\t<div id=\"mw-revision-nav\">" . wfMsg( 'revision-nav', $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff ) . "</div>\n\t\t\t";
24662414 $wgOut->setSubtitle( $r );
24672415 }
Index: trunk/phase3/includes/RecentChange.php
@@ -25,11 +25,6 @@
2626 * rc_patrolled boolean whether or not someone has marked this edit as patrolled
2727 * rc_old_len integer byte length of the text before the edit
2828 * rc_new_len the same after the edit
29 - * rc_deleted partial deletion
30 - * rc_logid the log_id value for this log entry (or zero)
31 - * rc_log_type the log type (or null)
32 - * rc_log_action the log action (or null)
33 - * rc_params log params
3429 *
3530 * mExtra:
3631 * prefixedDBkey prefixed db key, used by external app via msg queue
@@ -232,7 +227,8 @@
233228
234229 # Makes an entry in the database corresponding to an edit
235230 /*static*/ function notifyEdit( $timestamp, &$title, $minor, &$user, $comment,
236 - $oldId, $lastTimestamp, $bot="default", $ip='', $oldSize=0, $newSize=0, $newId=0)
 231+ $oldId, $lastTimestamp, $bot = "default", $ip = '', $oldSize = 0, $newSize = 0,
 232+ $newId = 0)
237233 {
238234
239235 if ( $bot === 'default' ) {
@@ -267,12 +263,7 @@
268264 'rc_patrolled' => 0,
269265 'rc_new' => 0, # obsolete
270266 'rc_old_len' => $oldSize,
271 - 'rc_new_len' => $newSize,
272 - 'rc_deleted' => 0,
273 - 'rc_logid' => 0,
274 - 'rc_log_type' => null,
275 - 'rc_log_action' => '',
276 - 'rc_params' => ''
 267+ 'rc_new_len' => $newSize
277268 );
278269
279270 $rc->mExtra = array(
@@ -293,7 +284,7 @@
294285 * @static
295286 */
296287 public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default",
297 - $ip='', $size=0, $newId=0 )
 288+ $ip='', $size = 0, $newId = 0 )
298289 {
299290 if ( !$ip ) {
300291 $ip = wfGetIP();
@@ -301,7 +292,6 @@
302293 $ip = '';
303294 }
304295 }
305 -
306296 if ( $bot == 'default' ) {
307297 $bot = $user->isAllowed( 'bot' );
308298 }
@@ -325,14 +315,9 @@
326316 'rc_moved_to_title' => '',
327317 'rc_ip' => $ip,
328318 'rc_patrolled' => 0,
329 - 'rc_new' => 1, # obsolete
 319+ 'rc_new' => 1, # obsolete
330320 'rc_old_len' => 0,
331 - 'rc_new_len' => $size,
332 - 'rc_deleted' => 0,
333 - 'rc_logid' => 0,
334 - 'rc_log_type' => null,
335 - 'rc_log_action' => '',
336 - 'rc_params' => ''
 321+ 'rc_new_len' => $size
337322 );
338323
339324 $rc->mExtra = array(
@@ -354,7 +339,7 @@
355340 $ip = '';
356341 }
357342 }
358 -
 343+
359344 $rc = new RecentChange;
360345 $rc->mAttribs = array(
361346 'rc_timestamp' => $timestamp,
@@ -377,11 +362,6 @@
378363 'rc_patrolled' => 1,
379364 'rc_old_len' => NULL,
380365 'rc_new_len' => NULL,
381 - 'rc_deleted' => 0,
382 - 'rc_logid' => 0, # notifyMove not used anymore
383 - 'rc_log_type' => null,
384 - 'rc_log_action' => '',
385 - 'rc_params' => ''
386366 );
387367
388368 $rc->mExtra = array(
@@ -400,14 +380,18 @@
401381 RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, true );
402382 }
403383
404 - # A log entry is different to an edit in that previous revisions are not kept
405 - /*static*/ function notifyLog( $timestamp, &$title, &$user, $actionText = null, $ip='',
406 - $type, $action, $target, $logComment, $params, $newId=0 )
 384+ # A log entry is different to an edit in that previous revisions are
 385+ # not kept
 386+ /*static*/ function notifyLog( $timestamp, &$title, &$user, $comment, $ip='',
 387+ $type, $action, $target, $logComment, $params )
407388 {
408389 if ( !$ip ) {
409390 $ip = wfGetIP();
410 - if ( !$ip ) $ip = '';
 391+ if ( !$ip ) {
 392+ $ip = '';
 393+ }
411394 }
 395+
412396 $rc = new RecentChange;
413397 $rc->mAttribs = array(
414398 'rc_timestamp' => $timestamp,
@@ -419,7 +403,7 @@
420404 'rc_cur_id' => $title->getArticleID(),
421405 'rc_user' => $user->getID(),
422406 'rc_user_text' => $user->getName(),
423 - 'rc_comment' => $logComment,
 407+ 'rc_comment' => $comment,
424408 'rc_this_oldid' => 0,
425409 'rc_last_oldid' => 0,
426410 'rc_bot' => $user->isAllowed( 'bot' ) ? 1 : 0,
@@ -430,11 +414,6 @@
431415 'rc_new' => 0, # obsolete
432416 'rc_old_len' => NULL,
433417 'rc_new_len' => NULL,
434 - 'rc_deleted' => 0,
435 - 'rc_logid' => $newId,
436 - 'rc_log_type' => $type,
437 - 'rc_log_action' => $action,
438 - 'rc_params' => $params
439418 );
440419 $rc->mExtra = array(
441420 'prefixedDBkey' => $title->getPrefixedDBkey(),
@@ -481,11 +460,6 @@
482461 'rc_new' => $row->page_is_new, # obsolete
483462 'rc_old_len' => $row->rc_old_len,
484463 'rc_new_len' => $row->rc_new_len,
485 - 'rc_deleted' => $row->rc_deleted,
486 - 'rc_logid' => $row->rc_logid,
487 - 'rc_log_type' => $row->rc_log_type,
488 - 'rc_log_action' => $row->rc_log_action,
489 - 'rc_params' => $row->rc_params
490464 );
491465
492466 $this->mExtra = array();
Index: trunk/phase3/includes/SpecialRecentchanges.php
@@ -404,7 +404,7 @@
405405 rcFormatDiff( $obj ),
406406 $title->getFullURL(),
407407 $obj->rc_timestamp,
408 - ($obj->rc_deleted & Revision::DELETED_USER) ? wfMsgHtml('rev-deleted-user') : $obj->rc_user_text,
 408+ $obj->rc_user_text,
409409 $talkpage->getFullURL()
410410 );
411411 $feed->outItem( $item );
@@ -613,18 +613,15 @@
614614 return rcFormatDiffRow( $titleObj,
615615 $row->rc_last_oldid, $row->rc_this_oldid,
616616 $timestamp,
617 - ($row->rc_deleted & Revision::DELETED_COMMENT) ? wfMsgHtml('rev-deleted-comment') : $row->rc_comment,
618 - ($row->rc_deleted & Revision::DELETED_NAME) ? wfMsgHtml('rev-deleted-event') : $row->rc_actiontext );
 617+ $row->rc_comment );
619618 }
620619
621 -function rcFormatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext='' ) {
 620+function rcFormatDiffRow( $title, $oldid, $newid, $timestamp, $comment ) {
622621 global $wgFeedDiffCutoff, $wgContLang, $wgUser;
623622 $fname = 'rcFormatDiff';
624623 wfProfileIn( $fname );
625624
626625 $skin = $wgUser->getSkin();
627 - # log enties
628 - if( $actiontext ) $comment = "$actiontext $comment";
629626 $completeText = '<p>' . $skin->formatComment( $comment ) . "</p>\n";
630627
631628 if( $title->getNamespace() >= 0 && $title->userCan( 'read' ) ) {
Index: trunk/phase3/includes/ImagePage.php
@@ -508,9 +508,7 @@
509509 $reason = $wgRequest->getVal( 'wpReason' );
510510 $image = $wgRequest->getVal( 'image' );
511511 $oldimage = $wgRequest->getVal( 'oldimage' );
512 - # Flag to hide all contents of the archived revisions
513 - $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed('deleterevision');
514 -
 512+
515513 # Only sysops can delete images. Previously ordinary users could delete
516514 # old revisions, but this is no longer the case.
517515 if ( !$wgUser->isAllowed('delete') ) {
@@ -538,7 +536,7 @@
539537 # Deleting old images doesn't require confirmation
540538 if ( !is_null( $oldimage ) || $confirm ) {
541539 if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
542 - $this->doDelete( $reason, $suppress );
 540+ $this->doDelete( $reason );
543541 } else {
544542 $wgOut->showFatalError( wfMsg( 'sessionfailure' ) );
545543 }
@@ -559,7 +557,7 @@
560558 * Delete an image.
561559 * @param $reason User provided reason for deletion.
562560 */
563 - function doDelete( $reason, $suppress=false ) {
 561+ function doDelete( $reason ) {
564562 global $wgOut, $wgRequest;
565563
566564 $oldimage = $wgRequest->getVal( 'oldimage' );
@@ -573,12 +571,12 @@
574572 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
575573 return;
576574 }
577 - if ( !$this->doDeleteOldImage( $oldimage, $suppress ) ) {
 575+ if ( !$this->doDeleteOldImage( $oldimage ) ) {
578576 return;
579577 }
580578 $deleted = $oldimage;
581579 } else {
582 - $ok = $this->img->delete( $reason, $suppress );
 580+ $ok = $this->img->delete( $reason );
583581 if( !$ok ) {
584582 # If the deletion operation actually failed, bug out:
585583 $wgOut->showFileDeleteError( $this->img->getName() );
@@ -589,7 +587,7 @@
590588 # Now we remove the image description page.
591589
592590 $article = new Article( $this->mTitle );
593 - $article->doDeleteArticle( $reason, $suppress ); # ignore errors
 591+ $article->doDeleteArticle( $reason ); # ignore errors
594592
595593 $deleted = $this->img->getName();
596594 }
@@ -608,11 +606,11 @@
609607 /**
610608 * @return success
611609 */
612 - function doDeleteOldImage( $oldimage, $suppress=false )
 610+ function doDeleteOldImage( $oldimage )
613611 {
614612 global $wgOut;
615613
616 - $ok = $this->img->deleteOld( $oldimage, '', $suppress );
 614+ $ok = $this->img->deleteOld( $oldimage, '' );
617615 if( !$ok ) {
618616 # If we actually have a file and can't delete it, throw an error.
619617 # Something went awry...
Index: trunk/phase3/includes/SpecialRevisiondelete.php
@@ -2,41 +2,36 @@
33
44 /**
55 * Not quite ready for production use yet; need to fix up the restricted mode,
6 - * and provide for preservation across delete/undelete of images.
 6+ * and provide for preservation across delete/undelete of the page.
 7+ *
 8+ * To try this out, set up extra permissions something like:
 9+ * $wgGroupPermissions['sysop']['deleterevision'] = true;
 10+ * $wgGroupPermissions['bureaucrat']['hiderevision'] = true;
711 */
812
913 function wfSpecialRevisiondelete( $par = null ) {
1014 global $wgOut, $wgRequest;
1115
12 - $target = $wgRequest->getText( 'target' );
13 - // handle our many different possible input types
 16+ $target = $wgRequest->getVal( 'target' );
1417 $oldid = $wgRequest->getIntArray( 'oldid' );
15 - $logid = $wgRequest->getIntArray( 'logid' );
16 - $arid = $wgRequest->getIntArray( 'arid' );
17 - $fileid = $wgRequest->getIntArray( 'fileid' );
18 -
19 - $page = Title::newFromUrl( $target, false );
 18+
 19+ $page = Title::newFromUrl( $target );
 20+
2021 if( is_null( $page ) ) {
2122 $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
2223 return;
2324 }
24 -
25 - $input_types = !is_null( $oldid ) + !is_null( $logid ) + !is_null( $arid ) + !is_null( $fileid );
26 - if( $input_types > 1 || $input_types==0 ) {
27 - //one target set at a time please!
 25+
 26+ if( is_null( $oldid ) ) {
2827 $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
2928 return;
3029 }
3130
32 - $form = new RevisionDeleteForm( $wgRequest, $oldid, $logid, $arid, $fileid );
 31+ $form = new RevisionDeleteForm( $wgRequest );
3332 if( $wgRequest->wasPosted() ) {
3433 $form->submit( $wgRequest );
35 - } else if( $oldid || $arid ) {
36 - $form->showRevs( $wgRequest );
37 - } else if( $logid ) {
38 - $form->showEvents( $wgRequest );
39 - } else if( $fileid ) {
40 - $form->showImages( $wgRequest );
 34+ } else {
 35+ $form->show( $wgRequest );
4136 }
4237 }
4338
@@ -199,7 +194,7 @@
200195 $bitfields = 0;
201196 $wgOut->addHtml( "<ul>" );
202197 foreach( $this->files as $fileid ) {
203 - $file = new ArchivedFile( $this->page, $fileid );
 198+ $file = new FSarchivedFile( $this->page, $fileid );
204199 if( !isset( $file->mId ) ) {
205200 $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
206201 return;
@@ -307,11 +302,10 @@
308303 null ) );
309304
310305 $wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml( 'revdelete-legend' ) . '</legend>' );
311 - // FIXME: all items checked for just on event are checked, even if not set for the others
312306 foreach( $this->checks as $item ) {
313307 list( $message, $name, $field ) = $item;
314308 $wgOut->addHtml( '<div>' .
315 - wfCheckLabel( wfMsgHtml( $message), $name, $name, $bitfields & $field ) .
 309+ wfCheckLabel( wfMsg( $message), $name, $name, $rev->isDeleted( $field ) ) .
316310 '</div>' );
317311 }
318312 $wgOut->addHtml( '</fieldset>' );
@@ -332,136 +326,32 @@
333327 function historyLine( $rev ) {
334328 global $wgContLang;
335329 $date = $wgContLang->timeanddate( $rev->getTimestamp() );
336 -
337 - $difflink=''; $del = '';
338 - if( $this->deletetype=='old' ) {
339 - $difflink = '(' . $this->skin->makeKnownLinkObj( $this->page, wfMsgHtml('diff'),
340 - '&diff=' . $rev->getId() . '&oldid=prev' ) . ')';
341 - $revlink = $this->skin->makeLinkObj( $this->page, $date, 'oldid=' . $rev->getId() );
342 - } else if( $this->deletetype=='ar' ) {
343 - $undelete = SpecialPage::getTitleFor( 'Undelete' );
344 - $target = $this->page->getPrefixedText();
345 - $revlink = $this->skin->makeLinkObj( $undelete, $date, "target=$target&timestamp=" . $rev->getTimestamp() );
346 - }
347 -
348 - if ( $rev->isDeleted(Revision::DELETED_TEXT) ) {
349 - $revlink = '<span class="history-deleted">'.$revlink.'</span>';
350 - $del = ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
351 - if ( !$rev->userCan(Revision::DELETED_TEXT) ) {
352 - $revlink = '<span class="history-deleted">'.$date.'</span>';
353 - }
354 - }
355 -
356330 return
357 - "<li> $difflink $revlink " . $this->skin->revUserLink( $rev ) . " " . $this->skin->revComment( $rev ) . "$del</li>";
 331+ "<li>" .
 332+ $this->skin->makeLinkObj( $this->page, $date, 'oldid=' . $rev->getId() ) .
 333+ " " .
 334+ $this->skin->revUserLink( $rev ) .
 335+ " " .
 336+ $this->skin->revComment( $rev ) .
 337+ "</li>";
358338 }
359339
360340 /**
361 - * @param Image $file
362 - * @returns string
363 - */
364 - function uploadLine( $file ) {
365 - global $wgContLang;
366 -
367 - $target = $this->page->getPrefixedText();
368 - $date = $wgContLang->timeanddate( $file->mTimestamp, true );
369 -
370 - $del = '';
371 - if ( $file->mGroup == 'deleted' ) {
372 - $undelete = SpecialPage::getTitleFor( 'Undelete' );
373 - $pageLink = $this->skin->makeKnownLinkObj( $undelete, $date, "target=$target&file=$file->mKey" );
374 - } else {
375 - $pageLink = $this->skin->makeKnownLinkObj( $this->page, $date, "file=$file->mKey" );
376 - }
377 - if ( $file->isDeleted(Image::DELETED_FILE) ) {
378 - $pageLink = '<span class="history-deleted">' . $pageLink . '</span>';
379 - $del = ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
380 - if ( !$file->userCan(Image::DELETED_FILE) ) {
381 - $pageLink = '<span class="history-deleted">'.$date.'</span>';
382 - }
383 - }
384 -
385 - $data = wfMsgHtml( 'widthheight',
386 - $wgContLang->formatNum( $file->mWidth ),
387 - $wgContLang->formatNum( $file->mHeight ) ) .
388 - ' (' . wfMsgHtml( 'nbytes', $wgContLang->formatNum( $file->mSize ) ) . ')';
389 -
390 - return
391 - "<li> $pageLink " . $this->skin->fileUserLink( $file ) . " $data " . $this->skin->fileComment( $file ) . "$del</li>";
392 - }
393 -
394 - /**
395 - * @param Revision $rev
396 - * @returns string
397 - */
398 - function logLine( $log, $event ) {
399 - global $wgContLang;
400 -
401 - $date = $wgContLang->timeanddate( $event->log_timestamp );
402 - $paramArray = LogPage::extractParams( $event->log_params );
403 -
404 - if ( !LogViewer::userCan($event,LogViewer::DELETED_ACTION) ) {
405 - $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
406 - } else {
407 - $action = LogPage::actionText( $event->log_type, $event->log_action, $this->page, $this->skin, $paramArray, true, true );
408 - if( $event->log_deleted & LogViewer::DELETED_ACTION )
409 - $action = '<span class="history-deleted">' . $action . '</span>';
410 - }
411 - return
412 - "<li>$date" . " " . $this->skin->logUserLink( $event ) . " $action " . $this->skin->logComment( $event ) . "</li>";
413 - }
414 -
415 - /**
416341 * @param WebRequest $request
417342 */
418343 function submit( $request ) {
419344 $bitfield = $this->extractBitfield( $request );
420345 $comment = $request->getText( 'wpReason' );
421 -
422 - $target = $request->getText( 'target' );
423 - $title = Title::newFromURL( $target, false );
424 -
425 - if( $this->save( $bitfield, $comment, $title ) ) {
426 - $this->success( $request );
427 - } else if( $request->getCheck( 'oldid' ) || $request->getCheck( 'arid' ) ) {
428 - return $this->showRevs( $request );
429 - } else if( $request->getCheck( 'logid' ) ) {
430 - return $this->showLogs( $request );
431 - } else if( $request->getCheck( 'fileid' ) ) {
432 - return $this->showImages( $request );
433 - }
 346+ if( $this->save( $bitfield, $comment ) ) {
 347+ return $this->success( $request );
 348+ } else {
 349+ return $this->show( $request );
 350+ }
434351 }
435352
436353 function success( $request ) {
437354 global $wgOut;
438 -
439 - $wgOut->setPagetitle( wfMsgHtml( 'actioncomplete' ) );
440 -
441 - $target = $request->getText( 'target' );
442 - $type = $request->getText( 'type' );
443 -
444 - $title = Title::newFromURL( $target, false );
445 - $name = $title->makeName( $title->getNamespace(), $title->getText() );
446 -
447 - $logtitle = SpecialPage::getTitleFor( 'Log' );
448 - $loglink = $this->skin->makeKnownLinkObj( $logtitle, wfMsgHtml( 'viewpagelogs' ),
449 - wfArrayToCGI( array('page' => $name ) ) );
450 - $histlink = $this->skin->makeKnownLinkObj( $title, wfMsgHtml( 'revhistory' ),
451 - wfArrayToCGI( array('action' => 'history' ) ) );
452 -
453 - if ( $title->getNamespace() > -1)
454 - $wgOut->setSubtitle( '<p>'.$histlink.' / '.$loglink.'</p>' );
455 -
456 - if( $type=='log' ) {
457 - $wgOut->addWikiText( wfMsgHtml('logdelete-success', $target), false );
458 - $this->showEvents( $request );
459 - } else if( $type=='old' || $type=='ar' ) {
460 - $wgOut->addWikiText( wfMsgHtml('revdelete-success', $target), false );
461 - $this->showRevs( $request );
462 - } else if ( $type=='file' ) {
463 - $wgOut->addWikiText( wfMsgHtml('revdelete-success', $target), false );
464 - $this->showImages( $request );
465 - }
 355+ $wgOut->addWikiText( 'woo' );
466356 }
467357
468358 /**
@@ -480,19 +370,10 @@
481371 return $bitfield;
482372 }
483373
484 - function save( $bitfield, $reason, $title ) {
 374+ function save( $bitfield, $reason ) {
485375 $dbw = wfGetDB( DB_MASTER );
486376 $deleter = new RevisionDeleter( $dbw );
487 -
488 - if( $this->revisions ) {
489 - return $deleter->setRevVisibility( $title, $this->revisions, $bitfield, $reason );
490 - } else if( $this->events ) {
491 - return $deleter->setEventVisibility( $title, $this->events, $bitfield, $reason );
492 - } else if( $this->archrevs ) {
493 - return $deleter->setArchiveVisibility( $title, $this->archrevs, $bitfield, $reason );
494 - } else if( $this->files ) {
495 - return $deleter->setFileVisibility( $title, $this->files, $bitfield, $reason );
496 - }
 377+ $deleter->setVisibility( $this->revisions, $bitfield, $reason );
497378 }
498379 }
499380
@@ -503,192 +384,42 @@
504385 }
505386
506387 /**
507 - * @param $title, the page these events apply to
508388 * @param array $items list of revision ID numbers
509389 * @param int $bitfield new rev_deleted value
510390 * @param string $comment Comment for log records
511391 */
512 - function setRevVisibility( $title, $items, $bitfield, $comment ) {
513 - global $wgOut;
 392+ function setVisibility( $items, $bitfield, $comment ) {
 393+ $pages = array();
514394
515 - $UserAllowedAll = true;
516 - $pages_count = array(); $pages_revIds = array();
517395 // To work!
518396 foreach( $items as $revid ) {
519 - $rev = Revision::newFromTitle( $title, $revid );
520 - if( !isset( $rev ) || $rev->isCurrent() ) {
 397+ $rev = Revision::newFromId( $revid );
 398+ if( !isset( $rev ) ) {
521399 return false;
522 - } else if( !$rev->userCan(Revision::DELETED_RESTRICTED) ) {
523 - $UserAllowedAll=false;
524 - continue;
525400 }
526 - $pageid = $rev->getPage();
 401+ $this->updateRevision( $rev, $bitfield );
 402+ $this->updateRecentChanges( $rev, $bitfield );
 403+
527404 // For logging, maintain a count of revisions per page
528 - if ( !isset($pages_count[$pageid]) ) {
529 - $pages_count[$pageid]=0;
530 - $pages_revIds[$pageid]=array();
 405+ $pageid = $rev->getPage();
 406+ if( isset( $pages[$pageid] ) ) {
 407+ $pages[$pageid]++;
 408+ } else {
 409+ $pages[$pageid] = 1;
531410 }
532 - // Which pages did we change anything about?
533 - if ( $rev->mDeleted != $bitfield ) {
534 - $pages_count[$pageid]++;
535 - $pages_revIds[$pageid][]=$revid;
536 -
537 - $this->updateRevision( $rev, $bitfield );
538 - $this->updateRecentChangesEdits( $rev, $bitfield, false );
539 - }
540411 }
541412
542413 // Clear caches...
543 - foreach( $pages_count as $pageid => $count ) {
544 - //Don't log or touch if nothing changed
545 - if ( $count > 0 ) {
546 - $title = Title::newFromId( $pageid );
547 - $this->updatePage( $title );
548 - $this->updateLog( $title, $count, $bitfield, $comment, $title, 'old', $pages_revIds[$pageid] );
549 - }
 414+ foreach( $pages as $pageid => $count ) {
 415+ $title = Title::newFromId( $pageid );
 416+ $this->updatePage( $title );
 417+ $this->updateLog( $title, $count, $bitfield, $comment );
550418 }
551 - // Where all revs allowed to be set?
552 - if ( !$UserAllowedAll ) {
553 - //FIXME: still might be confusing???
554 - $wgOut->permissionRequired( 'hiderevision' ); return false;
555 - }
556419
557420 return true;
558421 }
559422
560 - /**
561 - * @param $title, the page these events apply to
562 - * @param array $items list of revision ID numbers
563 - * @param int $bitfield new rev_deleted value
564 - * @param string $comment Comment for log records
565 - */
566 - function setArchiveVisibility( $title, $items, $bitfield, $comment ) {
567 - global $wgOut;
568 -
569 - $UserAllowedAll = true;
570 - $count = 0; $Id_set = array();
571 - // To work!
572 - $archive = new PageArchive( $title );
573 - foreach( $items as $revid ) {
574 - $rev = $archive->getRevision( '', $revid );
575 - if( !isset( $rev ) ) {
576 - return false;
577 - } else if( !$rev->userCan(Revision::DELETED_RESTRICTED) ) {
578 - $UserAllowedAll=false;
579 - continue;
580 - }
581 - // For logging, maintain a count of revisions
582 - if ( $rev->mDeleted != $bitfield ) {
583 - $Id_set[]=$revid;
584 - $count++;
585 - }
586 - $this->updateArchive( $rev, $bitfield );
587 - }
588 -
589 - // Log if something was changed
590 - if ( $count > 0 ) {
591 - $this->updateLog( $title, $count, $bitfield, $comment, $title, 'ar', $Id_set );
592 - }
593 - // Where all revs allowed to be set?
594 - if ( !$UserAllowedAll ) {
595 - $wgOut->permissionRequired( 'hiderevision' ); return false;
596 - }
597 -
598 - return true;
599 - }
600 -
601 - /**
602 - * @param $title, the page these events apply to
603 - * @param array $items list of revision ID numbers
604 - * @param int $bitfield new rev_deleted value
605 - * @param string $comment Comment for log records
606 - */
607 - function setFileVisibility( $title, $items, $bitfield, $comment ) {
608 - global $wgOut;
609 -
610 - $UserAllowedAll = true;
611 - $count = 0; $Id_set = array();
612 - // To work!
613 - foreach( $items as $fileid ) {
614 - $file = new ArchivedFile( $title, $fileid );
615 - if( !isset( $file ) ) {
616 - return false;
617 - } else if( !$file->userCan(Revision::DELETED_RESTRICTED) ) {
618 - $UserAllowedAll=false;
619 - continue;
620 - }
621 - // For logging, maintain a count of revisions
622 - if ( $file->mDeleted != $bitfield ) {
623 - $Id_set[]=$fileid;
624 - $count++;
625 - }
626 - $this->updateFiles( $file, $bitfield );
627 - }
628 -
629 - // Log if something was changed
630 - if ( $count > 0 ) {
631 - $this->updateLog( $title, $count, $bitfield, $comment, $title, 'file', $Id_set );
632 - }
633 - // Where all revs allowed to be set?
634 - if ( !$UserAllowedAll ) {
635 - $wgOut->permissionRequired( 'hiderevision' ); return false;
636 - }
637 -
638 - return true;
639 - }
640 -
641423 /**
642 - * @param $title, the page these events apply to
643 - * @param array $items list of log ID numbers
644 - * @param int $bitfield new log_deleted value
645 - * @param string $comment Comment for log records
646 - */
647 - function setEventVisibility( $title, $items, $bitfield, $comment ) {
648 - global $wgOut;
649 -
650 - $UserAllowedAll = true;
651 - $logs_count = array(); $logs_Ids = array();
652 - // To work!
653 - foreach( $items as $logid ) {
654 - $event = LogReader::newFromTitle( $title, $logid );
655 - if( !isset( $event ) ) {
656 - return false;
657 - } else if( !LogViewer::userCan($event, Revision::DELETED_RESTRICTED) || $event->log_type == 'oversight' ) {
658 - // Don't hide from oversight log!!!
659 - $UserAllowedAll=false;
660 - continue;
661 - }
662 - $logtype = $event->log_type;
663 - // For logging, maintain a count of events per log type
664 - if( !isset( $logs_count[$logtype] ) ) {
665 - $logs_count[$logtype]=0;
666 - $logs_Ids[$logtype]=array();
667 - }
668 - // Which logs did we change anything about?
669 - if ( $event->log_deleted != $bitfield ) {
670 - $logs_Ids[$logtype][]=$logid;
671 - $logs_count[$logtype]++;
672 -
673 - $this->updateLogs( $event, $bitfield );
674 - $this->updateRecentChangesLog( $event, $bitfield, true );
675 - }
676 - }
677 - foreach( $logs_count as $logtype => $count ) {
678 - //Don't log or touch if nothing changed
679 - if ( $count > 0 ) {
680 - $target = SpecialPage::getTitleFor( 'Log', $logtype );
681 - $this->updateLog( $target, $count, $bitfield, $comment, $title, 'log', $logs_Ids[$logtype] );
682 - }
683 - }
684 - // Where all revs allowed to be set?
685 - if ( !$UserAllowedAll ) {
686 - $wgOut->permissionRequired( 'hiderevision' ); return false;
687 - }
688 -
689 - return true;
690 - }
691 -
692 - /**
693424 * Update the revision's rev_deleted field
694425 * @param Revision $rev
695426 * @param int $bitfield new rev_deleted bitfield value
@@ -701,65 +432,19 @@
702433 }
703434
704435 /**
705 - * Update the revision's rev_deleted field
706 - * @param Revision $rev
707 - * @param int $bitfield new rev_deleted bitfield value
708 - */
709 - function updateArchive( $rev, $bitfield ) {
710 - $this->db->update( 'archive',
711 - array( 'ar_deleted' => $bitfield ),
712 - array( 'ar_rev_id' => $rev->getId() ),
713 - 'RevisionDeleter::updateArchive' );
714 - }
715 -
716 - /**
717 - * Update the images's fa_deleted field
718 - * @param Revision $file
719 - * @param int $bitfield new rev_deleted bitfield value
720 - */
721 - function updateFiles( $file, $bitfield ) {
722 - $this->db->update( 'filearchive',
723 - array( 'fa_deleted' => $bitfield ),
724 - array( 'fa_id' => $file->mId ),
725 - 'RevisionDeleter::updateFiles' );
726 - }
727 -
728 - /**
729 - * Update the logging log_deleted field
730 - * @param Revision $rev
731 - * @param int $bitfield new rev_deleted bitfield value
732 - */
733 - function updateLogs( $event, $bitfield ) {
734 - $this->db->update( 'logging',
735 - array( 'log_deleted' => $bitfield ),
736 - array( 'log_id' => $event->log_id ),
737 - 'RevisionDeleter::updateLogs' );
738 - }
739 -
740 - /**
741436 * Update the revision's recentchanges record if fields have been hidden
742 - * @param Revision $event
743 - * @param int $bitfield new rev_deleted bitfield value
744 - */
745 - function updateRecentChangesLog( $event, $bitfield ) {
746 - $this->db->update( 'recentchanges',
747 - array( 'rc_deleted' => $bitfield,
748 - 'rc_patrolled' => 1),
749 - array( 'rc_logid' => $event->log_id ),
750 - 'RevisionDeleter::updateRecentChangesLog' );
751 - }
752 -
753 - /**
754 - * Update the revision's recentchanges record if fields have been hidden
755437 * @param Revision $rev
756438 * @param int $bitfield new rev_deleted bitfield value
757439 */
758 - function updateRecentChangesEdits( $rev, $bitfield ) {
 440+ function updateRecentChanges( $rev, $bitfield ) {
759441 $this->db->update( 'recentchanges',
760 - array( 'rc_deleted' => $bitfield,
761 - 'rc_patrolled' => 1),
762 - array( 'rc_this_oldid' => $rev->getId() ),
763 - 'RevisionDeleter::updateRecentChangesEdits' );
 442+ array(
 443+ 'rc_user' => ($bitfield & Revision::DELETED_USER) ? 0 : $rev->getUser(),
 444+ 'rc_user_text' => ($bitfield & Revision::DELETED_USER) ? wfMsg( 'rev-deleted-user' ) : $rev->getUserText(),
 445+ 'rc_comment' => ($bitfield & Revision::DELETED_COMMENT) ? wfMsg( 'rev-deleted-comment' ) : $rev->getComment() ),
 446+ array(
 447+ 'rc_this_oldid' => $rev->getId() ),
 448+ 'RevisionDeleter::updateRecentChanges' );
764449 }
765450
766451 /**
@@ -779,25 +464,11 @@
780465 * @param int $bitfield the new rev_deleted value
781466 * @param string $comment
782467 */
783 - function updateLog( $title, $count, $bitfield, $comment, $target, $prefix, $items = array() ) {
784 - // Put things hidden from sysops in the oversight log
785 - $logtype = ( $bitfield & Revision::DELETED_RESTRICTED ) ? 'oversight' : 'delete';
786 - // Add params for effected page and ids
787 - $params = array( $target->getPrefixedText(), $prefix, implode( ',', $items) );
788 - $log = new LogPage( $logtype );
789 - if ( $prefix=='log' ) {
790 - $reason = wfMsgExt('logdelete-logaction', array('parsemag'), $count, $bitfield, $target->getPrefixedText() );
791 - if ($comment) $reason .= ": $comment";
792 - $log->addEntry( 'event', $title, $reason, $params );
793 - } else if ( $prefix=='old' ) {
794 - $reason = wfMsgExt('revdelete-logaction', array('parsemag'), $count, $bitfield );
795 - if ($comment) $reason .= ": $comment";
796 - $log->addEntry( 'revision', $title, $reason, $params );
797 - } else if ( $prefix=='file' ) {
798 - $reason = wfMsgExt('revdelete-logaction', array('parsemag'), $count, $bitfield );
799 - if ($comment) $reason .= ": $comment";
800 - $log->addEntry( 'file', $title, $reason, $params );
801 - }
 468+ function updateLog( $title, $count, $bitfield, $comment ) {
 469+ $log = new LogPage( 'delete' );
 470+ $reason = "changed $count revisions to $bitfield";
 471+ $reason .= ": $comment";
 472+ $log->addEntry( 'revision', $title, $reason );
802473 }
803474 }
804475
Index: trunk/phase3/includes/Linker.php
@@ -830,13 +830,10 @@
831831 /**
832832 * Generate a user link if the current user is allowed to view it
833833 * @param $rev Revision object.
834 - * @param $isPublic, bool, show only if all users can see it
835834 * @return string HTML
836835 */
837 - function revUserLink( $rev, $isPublic = false ) {
838 - if( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
839 - $link = wfMsgHtml( 'rev-deleted-user' );
840 - } else if( $rev->userCan( Revision::DELETED_USER ) ) {
 836+ function revUserLink( $rev ) {
 837+ if( $rev->userCan( Revision::DELETED_USER ) ) {
841838 $link = $this->userLink( $rev->getRawUser(), $rev->getRawUserText() );
842839 } else {
843840 $link = wfMsgHtml( 'rev-deleted-user' );
@@ -846,122 +843,27 @@
847844 }
848845 return $link;
849846 }
850 -
851 - /**
852 - * Generate a user link if the current user is allowed to view it
853 - * @param $event, log item.
854 - * @param $isPublic, bool, show only if all users can see it
855 - * @return string HTML
856 - */
857 - function logUserLink( $event, $isPublic = false ) {
858 - if( LogViewer::isDeleted( $event, LogViewer::DELETED_USER ) && $isPublic ) {
859 - $link = wfMsgHtml( 'rev-deleted-user' );
860 - } else if( LogViewer::userCan( $event, LogViewer::DELETED_USER ) ) {
861 - if ( isset($event->user_name) ) {
862 - $link = $this->userLink( $event->log_user, $event->user_name );
863 - } else {
864 - $user = $event->log_user;
865 - $link = $this->userLink( $event->log_user, User::whoIs( $user ) );
866 - }
867 - } else {
868 - $link = wfMsgHtml( 'rev-deleted-user' );
869 - }
870 - if( LogViewer::isDeleted( $event, LogViewer::DELETED_USER ) ) {
871 - return '<span class="history-deleted">' . $link . '</span>';
872 - }
873 - return $link;
874 - }
875847
876848 /**
877 - * Generate a user link if the current user is allowed to view it
878 - * @param $file, filestore file
879 - * @param $isPublic, bool, show only if all users can see it
880 - * @return string HTML
881 - */
882 - function fileUserLink( $file, $isPublic = false ) {
883 - if( $file->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
884 - $link = wfMsgHtml( 'rev-deleted-user' );
885 - } else if( $file->userCan( Revision::DELETED_USER ) ) {
886 - $link = $this->userLink( $file->mUser, $file->mUserText );
887 - } else {
888 - $link = wfMsgHtml( 'rev-deleted-user' );
889 - }
890 - if( $file->isDeleted( Revision::DELETED_USER ) ) {
891 - return '<span class="history-deleted">' . $link . '</span>';
892 - }
893 - return $link;
894 - }
895 -
896 - /**
897849 * Generate a user tool link cluster if the current user is allowed to view it
898850 * @param $rev Revision object.
899 - * @param $isPublic, bool, show only if all users can see it
900851 * @return string HTML
901852 */
902 - function revUserTools( $rev, $isPublic = false ) {
903 - if( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
904 - $link = wfMsgHtml( 'rev-deleted-user' );
905 - } else if( $rev->userCan( Revision::DELETED_USER ) ) {
 853+ function revUserTools( $rev ) {
 854+ if( $rev->userCan( Revision::DELETED_USER ) ) {
906855 $link = $this->userLink( $rev->getRawUser(), $rev->getRawUserText() ) .
907 - ' ' . $this->userToolLinks( $rev->getRawUser(), $rev->getRawUserText() );
 856+ ' ' .
 857+ $this->userToolLinks( $rev->getRawUser(), $rev->getRawUserText() );
908858 } else {
909859 $link = wfMsgHtml( 'rev-deleted-user' );
910860 }
911861 if( $rev->isDeleted( Revision::DELETED_USER ) ) {
912 - return ' <span class="history-deleted">' . $link . '</span>';
913 - }
914 - return " $link";
915 - }
916 -
917 - /**
918 - * Generate a user tool link cluster if the current user is allowed to view it
919 - * @param $event, log item.
920 - * @param $isPublic, bool, show only if all users can see it
921 - * @return string HTML
922 - */
923 - function logUserTools( $event, $isPublic = false ) {
924 - if( LogViewer::isDeleted( $event, LogViewer::DELETED_USER ) && $isPublic ) {
925 - $link = wfMsgHtml( 'rev-deleted-user' );
926 - } else if( LogViewer::userCan( $event, LogViewer::DELETED_USER ) ) {
927 - if ( isset($event->user_name) ) {
928 - $link = $this->userLink( $event->log_user, $event->user_name ) .
929 - ' ' . $this->userToolLinks( $event->log_user, $event->user_name );
930 - } else {
931 - $usertext = User::whoIs( $event->log_user );
932 - $link = $this->userLink( $event->log_user, $usertext ) .
933 - ' ' . $this->userToolLinks( $event->log_user, $usertext );
934 - }
935 - } else {
936 - $link = wfMsgHtml( 'rev-deleted-user' );
937 - }
938 - if( LogViewer::isDeleted( $event, LogViewer::DELETED_USER ) ) {
939862 return '<span class="history-deleted">' . $link . '</span>';
940863 }
941864 return $link;
942865 }
943 -
 866+
944867 /**
945 - * Generate a user tool link cluster if the current user is allowed to view it
946 - * @param $file, filestore file
947 - * @param $isPublic, bool, show only if all users can see it
948 - * @return string HTML
949 - */
950 - function fileUserTools( $file, $isPublic = false ) {
951 - if( $file->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
952 - $link = wfMsgHtml( 'rev-deleted-user' );
953 - } else if( $file->userCan( Revision::DELETED_USER ) ) {
954 - $link = $this->userLink( $file->mUser, $file->mUserText ) .
955 - $this->userToolLinks( $file->mUser, $file->mUserText );
956 - } else {
957 - $link = wfMsgHtml( 'rev-deleted-user' );
958 - }
959 - if( $file->isDeleted( Revision::DELETED_USER ) ) {
960 - return '<span class="history-deleted">' . $link . '</span>';
961 - }
962 - return $link;
963 - }
964 -
965 - /**
966868 * This function is called by all recent changes variants, by the page history,
967869 * and by the user contributions list. It is responsible for formatting edit
968870 * comments. It escapes any HTML in the comment, but adds some CSS to format
@@ -1083,65 +985,21 @@
1084986 *
1085987 * @param Revision $rev
1086988 * @param bool $local Whether section links should refer to local page
1087 - * @param $isPublic, show only if all users can see it
1088989 * @return string HTML
1089990 */
1090 - function revComment( Revision $rev, $local = false, $isPublic = false ) {
1091 - if( $rev->isDeleted( Revision::DELETED_COMMENT ) && $isPublic ) {
1092 - $block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
1093 - } else if( $rev->userCan( Revision::DELETED_COMMENT ) ) {
 991+ function revComment( Revision $rev, $local = false ) {
 992+ if( $rev->userCan( Revision::DELETED_COMMENT ) ) {
1094993 $block = $this->commentBlock( $rev->getRawComment(), $rev->getTitle(), $local );
1095994 } else {
1096 - $block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
 995+ $block = " <span class=\"comment\">" .
 996+ wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
1097997 }
1098998 if( $rev->isDeleted( Revision::DELETED_COMMENT ) ) {
1099999 return " <span class=\"history-deleted\">$block</span>";
11001000 }
11011001 return $block;
11021002 }
1103 -
1104 - /**
1105 - * Wrap and format the given event's comment block, if the current
1106 - * user is allowed to view it.
1107 - *
1108 - * @param Revision $rev
1109 - * @return string HTML
1110 - */
1111 - function logComment( $event, $isPublic = false ) {
1112 - if( LogViewer::isDeleted( $event, LogViewer::DELETED_COMMENT ) && $isPublic ) {
1113 - $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
1114 - } else if( LogViewer::userCan( $event, LogViewer::DELETED_COMMENT ) ) {
1115 - $block = $this->commentBlock( LogViewer::getRawComment( $event ) );
1116 - } else {
1117 - $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
1118 - }
1119 - if( LogViewer::isDeleted( $event, LogViewer::DELETED_COMMENT ) ) {
1120 - return "<span class=\"history-deleted\">$block</span>";
1121 - }
1122 - return $block;
1123 - }
11241003
1125 - /**
1126 - * Wrap and format the given file's comment block, if the current
1127 - * user is allowed to view it.
1128 - *
1129 - * @param FileStore file object $file
1130 - * @return string HTML
1131 - */
1132 - function fileComment( $file, $isPublic = false ) {
1133 - if( $file->isDeleted( Revision::DELETED_COMMENT ) && $isPublic ) {
1134 - $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
1135 - } else if( $file->userCan( Revision::DELETED_COMMENT ) ) {
1136 - $block = $this->commentBlock( $file->mDescription );
1137 - } else {
1138 - $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
1139 - }
1140 - if( $file->isDeleted( Revision::DELETED_COMMENT ) ) {
1141 - return "<span class=\"history-deleted\">$block</span>";
1142 - }
1143 - return $block;
1144 - }
1145 -
11461004 /** @todo document */
11471005 function tocIndent() {
11481006 return "\n<ul>";
Index: trunk/phase3/includes/Export.php
@@ -139,10 +139,7 @@
140140 $fname = "do_list_authors" ;
141141 wfProfileIn( $fname );
142142 $this->author_list = "<contributors>";
143 - //rev_deleted
144 - $deleted = '(rev_deleted & '.Revision::DELETED_USER.') !=1 ';
145 -
146 - $sql = "SELECT DISTINCT rev_user_text,rev_user FROM {$page},{$revision} WHERE page_id=rev_page AND $deleted AND " . $cond ;
 143+ $sql = "SELECT DISTINCT rev_user_text,rev_user FROM {$page},{$revision} WHERE page_id=rev_page AND " . $cond ;
147144 $result = $this->db->query( $sql, $fname );
148145 $resultset = $this->db->resultObject( $result );
149146 while( $row = $resultset->fetchObject() ) {
Index: trunk/phase3/includes/SpecialBlockip.php
@@ -45,7 +45,7 @@
4646 var $BlockAddress, $BlockExpiry, $BlockReason;
4747
4848 function IPBlockForm( $par ) {
49 - global $wgRequest, $wgUser;
 49+ global $wgRequest;
5050
5151 $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) );
5252 $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' );
@@ -59,8 +59,6 @@
6060 $this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', $byDefault );
6161 $this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', $byDefault );
6262 $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', $byDefault );
63 - # Re-check user's rights to hide names, very serious, defaults to 0
64 - $this->BlockHideName = $wgRequest->getBool( 'wpHideName', 0 ) && $wgUser->isAllowed( 'hideuser' );
6563 }
6664
6765 function showForm( $err ) {
@@ -133,7 +131,6 @@
134132 </td>
135133 ");
136134 }
137 -
138135 $wgOut->addHTML("
139136 </tr>
140137 <tr id='wpBlockOther'>
@@ -153,46 +150,31 @@
154151 <tr id='wpAnonOnlyRow'>
155152 <td>&nbsp;</td>
156153 <td align=\"left\">
157 - " . wfCheckLabel( wfMsgHtml( 'ipbanononly' ),
 154+ " . wfCheckLabel( wfMsg( 'ipbanononly' ),
158155 'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly,
159 - array( 'tabindex' => '4' ) ) . "
 156+ array( 'tabindex' => 4 ) ) . "
160157 </td>
161158 </tr>
162159 <tr id='wpCreateAccountRow'>
163160 <td>&nbsp;</td>
164161 <td align=\"left\">
165 - " . wfCheckLabel( wfMsgHtml( 'ipbcreateaccount' ),
 162+ " . wfCheckLabel( wfMsg( 'ipbcreateaccount' ),
166163 'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount,
167 - array( 'tabindex' => '5' ) ) . "
 164+ array( 'tabindex' => 5 ) ) . "
168165 </td>
169166 </tr>
170167 <tr id='wpEnableAutoblockRow'>
171168 <td>&nbsp;</td>
172169 <td align=\"left\">
173 - " . wfCheckLabel( wfMsgHtml( 'ipbenableautoblock' ),
 170+ " . wfCheckLabel( wfMsg( 'ipbenableautoblock' ),
174171 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock,
175 - array( 'tabindex' => '6' ) ) . "
 172+ array( 'tabindex' => 6 ) ) . "
176173 </td>
177174 </tr>
178 - ");
179 - // Allow some users to hide name from block log, blocklist and listusers
180 - if ( $wgUser->isAllowed( 'hideuser' ) ) {
181 - $wgOut->addHTML("
182 - <tr>
183 - <td>&nbsp;</td>
184 - <td align=\"left\">
185 - " . wfCheckLabel( wfMsgHtml( 'ipbhidename' ),
186 - 'wpHideName', 'wpHideName', $this->BlockHideName,
187 - array( 'tabindex' => '6' ) ) . "
188 - </td>
189 - </tr>
190 - ");
191 - }
192 - $wgOut->addHTML("
193175 <tr>
194176 <td style='padding-top: 1em'>&nbsp;</td>
195177 <td style='padding-top: 1em' align=\"left\">
196 - " . Xml::submitButton( wfMsgHtml( 'ipbsubmit' ),
 178+ " . Xml::submitButton( wfMsg( 'ipbsubmit' ),
197179 array( 'name' => 'wpBlock', 'tabindex' => '7' ) ) . "
198180 </td>
199181 </tr>
@@ -301,7 +283,7 @@
302284
303285 $block = new Block( $this->BlockAddress, $userId, $wgUser->getID(),
304286 $this->BlockReason, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
305 - $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName);
 287+ $this->BlockCreateAccount, $this->BlockEnableAutoblock );
306288
307289 if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
308290
@@ -318,9 +300,8 @@
319301 $logParams[] = $expirestr;
320302 $logParams[] = $this->blockLogFlags();
321303
322 - # Make log entry, if the name is hidden, put it in the oversight log
323 - $log_type = ($this->BlockHideName) ? 'oversight' : 'block';
324 - $log = new LogPage( $log_type );
 304+ # Make log entry
 305+ $log = new LogPage( 'block' );
325306 $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
326307 $this->BlockReason, $logParams );
327308
Index: trunk/phase3/includes/ChangesList.php
@@ -12,11 +12,10 @@
1313 class RCCacheEntry extends RecentChange
1414 {
1515 var $secureName, $link;
16 - var $curlinks, $difflink, $lastlink , $usertalklink , $versionlink ;
 16+ var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
1717 var $userlink, $timestamp, $watched;
1818
19 - function newFromParent( $rc )
20 - {
 19+ function newFromParent( $rc ) {
2120 $rc2 = new RCCacheEntry;
2221 $rc2->mAttribs = $rc->mAttribs;
2322 $rc2->mExtra = $rc->mExtra;
@@ -25,7 +24,6 @@
2625 } ;
2726
2827 /**
29 - * @package MediaWiki
3028 */
3129 class ChangesList {
3230 # Called by history lists and recent changes
@@ -79,7 +77,7 @@
8078 : $nothing;
8179 $f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
8280 $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
83 - return "<tt>$f</tt>";
 81+ return $f;
8482 }
8583
8684 /**
@@ -105,32 +103,6 @@
106104 }
107105 }
108106
109 - /**
110 - * int $field one of DELETED_* bitfield constants
111 - * @return bool
112 - */
113 - function isDeleted( $rc, $field ) {
114 - return ($rc->mAttribs['rc_deleted'] & $field) == $field;
115 - }
116 -
117 - /**
118 - * Determine if the current user is allowed to view a particular
119 - * field of this revision, if it's marked as deleted.
120 - * @param int $field
121 - * @return bool
122 - */
123 - function userCan( $rc, $field ) {
124 - if( ( $rc->mAttribs['rc_deleted'] & $field ) == $field ) {
125 - global $wgUser;
126 - $permission = ( $rc->mAttribs['rc_deleted'] & Revision::DELETED_RESTRICTED ) == Revision::DELETED_RESTRICTED
127 - ? 'hiderevision'
128 - : 'deleterevision';
129 - wfDebug( "Checking for $permission due to $field match on $rc->mAttribs['rc_deleted']\n" );
130 - return $wgUser->isAllowed( $permission );
131 - } else {
132 - return true;
133 - }
134 - }
135107
136108 function insertMove( &$s, $rc ) {
137109 # Diff
@@ -166,12 +138,11 @@
167139 $s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
168140 }
169141
 142+
170143 function insertDiffHist(&$s, &$rc, $unpatrolled) {
171144 # Diff link
172 - if( !$this->userCan($rc,Revision::DELETED_TEXT) ) {
 145+ if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
173146 $diffLink = $this->message['diff'];
174 - } else if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG) {
175 - $diffLink = $this->message['diff'];
176147 } else {
177148 $rcidparam = $unpatrolled
178149 ? array( 'rcid' => $rc->mAttribs['rc_id'] )
@@ -201,12 +172,7 @@
202173 $params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW )
203174 ? 'rcid='.$rc->mAttribs['rc_id']
204175 : '';
205 - if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
206 - $articlelink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
207 - $articlelink = '<span class="history-deleted">'.$articlelink.'</span>';
208 - } else {
209 - $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
210 - }
 176+ $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
211177 if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
212178 global $wgContLang;
213179 $articlelink .= $wgContLang->getDirMark();
@@ -222,37 +188,15 @@
223189
224190 /** Insert links to user page, user talk page and eventually a blocking link */
225191 function insertUserRelatedLinks(&$s, &$rc) {
226 - if ( $this->isDeleted($rc,Revision::DELETED_USER) ) {
227 - $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
228 - } else {
229 - $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
230 - $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
231 - }
 192+ $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
 193+ $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
232194 }
233195
234 - /** insert a formatted action */
235 - function insertAction(&$s, &$rc) {
236 - # Add comment
237 - if( $rc->mAttribs['rc_type'] == RC_LOG ) {
238 - // log action
239 - if ( $this->isDeleted($rc,LogViewer::DELETED_ACTION) ) {
240 - $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
241 - } else {
242 - $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'], $rc->getTitle(), $this->skin, LogPage::extractParams($rc->mAttribs['rc_params']), true, true );
243 - }
244 - }
245 - }
246 -
247196 /** insert a formatted comment */
248197 function insertComment(&$s, &$rc) {
249198 # Add comment
250199 if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
251 - // log comment
252 - if ( $this->isDeleted($rc,Revision::DELETED_COMMENT) ) {
253 - $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>';
254 - } else {
255 - $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
256 - }
 200+ $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
257201 }
258202 }
259203
@@ -308,23 +252,19 @@
309253
310254 $s .= '<li>';
311255
312 - // Moved pages
 256+ // moved pages
313257 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
314258 $this->insertMove( $s, $rc );
315 - // Log entries (old format) or log targets, and special pages
316 - } elseif( $rc_namespace == NS_SPECIAL ) {
 259+ // log entries
 260+ } elseif ( $rc_namespace == NS_SPECIAL ) {
317261 list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
318262 if ( $specialName == 'Log' ) {
319263 $this->insertLog( $s, $rc->getTitle(), $specialSubpage );
320264 } else {
321265 wfDebug( "Unexpected special page in recentchanges\n" );
322266 }
323 - // Log entries
324 - } elseif( $rc_log_type !='' ) {
325 - $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
326 - $this->insertLog( $s, $logtitle, $rc_log_type );
327 - // All other stuff
328 - } else {
 267+ // all other stuff
 268+ } else {
329269 wfProfileIn($fname.'-page');
330270
331271 $this->insertDiffHist($s, $rc, $unpatrolled);
@@ -345,16 +285,10 @@
346286 }
347287
348288 $this->insertUserRelatedLinks($s,$rc);
349 - $this->insertAction($s, $rc);
350289 $this->insertComment($s, $rc);
351 -
352 - # Mark revision as deleted
353 - if ( !$rc_log_type && $this->isDeleted($rc,Revision::DELETED_TEXT) )
354 - $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
355 - if($rc->numberofWatchingusers > 0) {
356 - $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers));
357 - }
358290
 291+ $s .= rtrim(' ' . $this->numberofWatchingusers($rc->numberofWatchingusers));
 292+
359293 $s .= "</li>\n";
360294
361295 wfProfileOut( $fname.'-rest' );
@@ -401,14 +335,12 @@
402336 $rc->unpatrolled = false;
403337 }
404338
405 - $showrev=true;
406339 # Make article link
407340 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
408341 $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
409342 $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
410343 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
411 - } else if( $rc_namespace == NS_SPECIAL ) {
412 - // Log entries (old format) and special pages
 344+ } elseif( $rc_namespace == NS_SPECIAL ) {
413345 list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
414346 if ( $specialName == 'Log' ) {
415347 # Log updates, etc
@@ -418,16 +350,7 @@
419351 wfDebug( "Unexpected special page in recentchanges\n" );
420352 $clink = '';
421353 }
422 - } elseif ( $rc_log_type !='' ) {
423 - // Log entries
424 - $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
425 - $logname = LogPage::logName( $rc_log_type );
426 - $clink = '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')';
427 - } if ( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
428 - $clink = '<span class="history-deleted">' . $this->skin->makeKnownLinkObj( $rc->getTitle(), '' ) . '</span>';
429 - if ( !ChangesList::userCan($rc,Revision::DELETED_TEXT) )
430 - $showrev=false;
431 - } else if( $rc->unpatrolled && $rc_type == RC_NEW ) {
 354+ } elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
432355 # Unpatrolled new page, give rc_id in query
433356 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
434357 } else {
@@ -450,10 +373,7 @@
451374 $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
452375 $aprops = ' tabindex="'.$baseRC->counter.'"';
453376 $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
454 - if ( !$showrev ) {
455 - $curLink = $this->message['cur'];
456 - $diffLink = $this->message['diff'];
457 - } else if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
 377+ if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
458378 if( $rc_type != RC_NEW ) {
459379 $curLink = $this->message['cur'];
460380 }
@@ -463,27 +383,21 @@
464384 }
465385
466386 # Make "last" link
467 - if ( !$showrev ) {
468 - $lastLink = $this->message['last'];
469 - } else if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
 387+ if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
470388 $lastLink = $this->message['last'];
471389 } else {
472390 $lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
473 - $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
 391+ $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
474392 }
475 -
476 - # Make user links
477 - if ( $this->isDeleted($rc,Revision::DELETED_USER) ) {
478 - $rc->userlink = ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
479 - } else {
480 - $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
481 - $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
482 - }
483393
 394+ $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
 395+
484396 $rc->lastlink = $lastLink;
485397 $rc->curlink = $curLink;
486398 $rc->difflink = $diffLink;
487399
 400+ $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
 401+
488402 # Put accumulated information into the cache, for later display
489403 # Page moves go on their own line
490404 $title = $rc->getTitle();
@@ -505,11 +419,10 @@
506420 */
507421 function recentChangesBlockGroup( $block ) {
508422 global $wgLang, $wgContLang, $wgRCShowChangedSize;
509 - $r = '<table cellpadding="0" cellspacing="0"><tr>';
 423+ $r = '';
510424
511425 # Collate list of users
512426 $isnew = false;
513 - $namehidden = true;
514427 $unpatrolled = false;
515428 $userlinks = array();
516429 foreach( $block as $rcObj ) {
@@ -517,11 +430,6 @@
518431 if( $rcObj->mAttribs['rc_new'] ) {
519432 $isnew = true;
520433 }
521 - // if all log actions to this page were hidden, then don't
522 - // give the name of the affected page for this block
523 - if( !($rcObj->mAttribs['rc_deleted'] & LogViewer::DELETED_ACTION) ) {
524 - $namehidden = false;
525 - }
526434 $u = $rcObj->userlink;
527435 if( !isset( $userlinks[$u] ) ) {
528436 $userlinks[$u] = 0;
@@ -555,25 +463,24 @@
556464 $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
557465 $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
558466 $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
559 - $r .= '<td valign="top">'.$tl;
 467+ $r .= $tl;
560468
561469 # Main line
562 - $r .= ' '.$this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
 470+ $r .= '<tt>';
 471+ $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
563472
564473 # Timestamp
565 - $r .= ' '.$block[0]->timestamp.'&nbsp;&nbsp;</td><td>';
 474+ $r .= ' '.$block[0]->timestamp.' </tt>';
566475
567476 # Article link
568 - if ( $namehidden )
569 - $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
570 - else
571 - $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
 477+ $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
572478 $r .= $wgContLang->getDirMark();
573479
574480 $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
575481 $currentRevision = $block[0]->mAttribs['rc_this_oldid'];
576482 if( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
577483 # Changes
 484+
578485 $n = count($block);
579486 static $nchanges = array();
580487 if ( !isset( $nchanges[$n] ) ) {
@@ -583,95 +490,77 @@
584491
585492 $r .= ' (';
586493
587 - if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
588 - $r .= $nchanges[$n];
589 - } else if( $isnew ) {
 494+ if( $isnew ) {
590495 $r .= $nchanges[$n];
591496 } else {
592497 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
593498 $nchanges[$n], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
594499 }
595500
 501+ $r .= ') . . ';
 502+
596503 # Character difference
597504 $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
598505 $block[0]->mAttribs['rc_new_len'] );
599506 if( $chardiff == '' ) {
600 - $r .= '; ';
 507+ $r .= ' (';
601508 } else {
602 - $r .= '; ' . $chardiff . ' ';
 509+ $r .= ' ' . $chardiff. ' . . (';
603510 }
 511+
604512
605513 # History
606 - $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(), $this->message['history'], $curIdEq.'&action=history' );
607 -
 514+ $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
 515+ $this->message['history'], $curIdEq.'&action=history' );
608516 $r .= ')';
609517 }
610518
611519 $r .= $users;
612 - $r .=$this->numberofWatchingusers($block[0]->numberofWatchingusers);
613 -
614 - $r .= "</td></tr></table>\n";
615520
 521+ $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
 522+ $r .= "<br />\n";
 523+
616524 # Sub-entries
617 - $r .= '<div id="'.$rci.'" style="display:none; font-size:95%;"><table cellpadding="0" cellspacing="0">';
 525+ $r .= '<div id="'.$rci.'" style="display:none">';
618526 foreach( $block as $rcObj ) {
619527 # Get rc_xxxx variables
620528 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
621529 extract( $rcObj->mAttribs );
622530
623 - #$r .= '<tr><td valign="top">'.$this->spacerArrow();
624 - $r .= '<tr><td valign="top">'.$this->spacerIndent();
625 - $r .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
 531+ $r .= $this->spacerArrow();
 532+ $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;';
626533 $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
627 - $r .= '&nbsp;&nbsp;</td><td valign="top">';
 534+ $r .= '&nbsp;</tt>';
628535
629536 $o = '';
630537 if( $rc_this_oldid != 0 ) {
631538 $o = 'oldid='.$rc_this_oldid;
632539 }
633 - # Revision link
634540 if( $rc_type == RC_LOG ) {
635 - $link = $rcObj->timestamp.' ';
636 - } else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
637 - $link = '<span class="history-deleted">'.$rcObj->timestamp.'</span> ';
 541+ $link = $rcObj->timestamp;
638542 } else {
639543 $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
640 - if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
641 - $link = '<span class="history-deleted">'.$link.'</span> ';
642544 }
 545+ $link = '<tt>'.$link.'</tt>';
 546+
643547 $r .= $link;
644 -
645 - if ( !$rc_log_type ) {
646 - $r .= ' (';
647 - $r .= $rcObj->curlink;
648 - $r .= '; ';
649 - $r .= $rcObj->lastlink;
650 - $r .= ')';
651 - } else {
652 - $logname = LogPage::logName( $rc_log_type );
653 - $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
654 - $r .= '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')';
655 - }
656 - $r .= ' . . ';
 548+ $r .= ' (';
 549+ $r .= $rcObj->curlink;
 550+ $r .= '; ';
 551+ $r .= $rcObj->lastlink;
 552+ $r .= ') . . ';
657553
658554 # Character diff
659555 if( $wgRCShowChangedSize ) {
660556 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
661557 }
662 - # User links
 558+
663559 $r .= $rcObj->userlink;
664560 $r .= $rcObj->usertalklink;
665 - // log action
666 - parent::insertAction($r, $rcObj);
667 - // log comment
668 - parent::insertComment($r, $rcObj);
669 - # Mark revision as deleted
670 - if ( !$rc_log_type && $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
671 - $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
672 -
673 - $r .= "</td></tr>\n";
 561+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
 562+ $r .= "<br />\n";
674563 }
675 - $r .= "</table></div>\n";
 564+ $r .= "</div>\n";
676565
677566 $this->rcCacheIndex++;
678567 return $r;
@@ -728,23 +617,8 @@
729618 * @access private
730619 */
731620 function spacerArrow() {
732 - //FIXME: problems with FF 1.5x
733621 return $this->arrow( '', ' ' );
734622 }
735 -
736 - /**
737 - * Generate HTML for the equivilant of a spacer image for tables
738 - * @return string HTML <td> tag
739 - * @access private
740 - */
741 - function spacerColumn() {
742 - return '<td width="12"></td>';
743 - }
744 -
745 - // Adds a few spaces
746 - function spacerIndent() {
747 - return '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
748 - }
749623
750624 /**
751625 * Enhanced RC ungrouped line.
@@ -758,64 +632,46 @@
759633 extract( $rcObj->mAttribs );
760634 $curIdEq = 'curid='.$rc_cur_id;
761635
762 - $r = '<table cellspacing="0" cellpadding="0"><tr><td>';
 636+ $r = '';
763637
764 - # spacerArrow() causes issues in FF
765 - $r .= $this->spacerColumn();
766 - $r .= '<td valign="top">';
767 -
 638+ # Spacer image
 639+ $r .= $this->spacerArrow();
 640+
768641 # Flag and Timestamp
 642+ $r .= '<tt>';
 643+
769644 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
770 - $r .= '&nbsp;&nbsp;&nbsp;&nbsp;';
 645+ $r .= '&nbsp;&nbsp;&nbsp;';
771646 } else {
772 - $r .= '&nbsp;'.$this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
 647+ $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
773648 }
774 - $r .= '&nbsp;'.$rcObj->timestamp.'&nbsp;&nbsp;</td><td>';
775 -
 649+ $r .= ' '.$rcObj->timestamp.' </tt>';
 650+
776651 # Article link
777 - if ( $rc_log_type !='' ) {
778 - $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
779 - $logname = LogPage::logName( $rc_log_type );
780 - $r .= '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')';
781 - // All other stuff
782 - } else {
783 - $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
784 - }
785 - if ( $rc_type != RC_LOG ) {
786 - # Diff
787 - $r .= ' ('. $rcObj->difflink .'; ';
788 - # Hist
789 - $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
790 - }
791 - $r .= ' . . ';
792 -
 652+ $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
 653+
 654+ # Diff
 655+ $r .= ' ('. $rcObj->difflink .'; ';
 656+
 657+ # Hist
 658+ $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
 659+
793660 # Character diff
794661 if( $wgRCShowChangedSize ) {
795662 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : '&nbsp;' . $rcObj->getCharacterDifference() . ' . . ' ) ;
796663 }
797664
798665 # User/talk
799 - $r .= ' '.$rcObj->userlink . $rcObj->usertalklink;
 666+ $r .= $rcObj->userlink . $rcObj->usertalklink;
800667
801668 # Comment
802669 if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
803 - // log action
804 - if ( $this->isDeleted($rcObj,LogViewer::DELETED_ACTION) ) {
805 - $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
806 - } else {
807 - $r .= ' ' . LogPage::actionText( $rc_log_type, $rc_log_action, $rcObj->getTitle(), $this->skin, LogPage::extractParams($rc_params), true, true );
808 - }
809 - // log comment
810 - if ( $this->isDeleted($rcObj,LogViewer::DELETED_COMMENT) ) {
811 - $r .= ' <span class="history-deleted">' . wfMsg('rev-deleted-comment') . '</span>';
812 - } else {
813 - $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
814 - }
 670+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
815671 }
816672
817673 $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
818674
819 - $r .= "</td></tr></table>\n";
 675+ $r .= "<br />\n";
820676 return $r;
821677 }
822678
Index: trunk/phase3/includes/SpecialUndelete.php
@@ -99,7 +99,7 @@
100100 function listRevisions() {
101101 $dbr = wfGetDB( DB_SLAVE );
102102 $res = $dbr->select( 'archive',
103 - array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment', 'ar_rev_id', 'ar_deleted', 'ar_len' ),
 103+ array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment', 'ar_len' ),
104104 array( 'ar_namespace' => $this->title->getNamespace(),
105105 'ar_title' => $this->title->getDBkey() ),
106106 'PageArchive::listRevisions',
@@ -116,7 +116,7 @@
117117 * @return ResultWrapper
118118 * @fixme Does this belong in Image for fuller encapsulation?
119119 */
120 - function listFiles() {
 120+ function listFiles() {
121121 if( $this->title->getNamespace() == NS_IMAGE ) {
122122 $dbr = wfGetDB( DB_SLAVE );
123123 $res = $dbr->select( 'filearchive',
@@ -130,8 +130,7 @@
131131 'fa_description',
132132 'fa_user',
133133 'fa_user_text',
134 - 'fa_timestamp',
135 - 'fa_deleted' ),
 134+ 'fa_timestamp' ),
136135 array( 'fa_name' => $this->title->getDbKey() ),
137136 __METHOD__,
138137 array( 'ORDER BY' => 'fa_timestamp DESC' ) );
@@ -152,25 +151,14 @@
153152 $rev = $this->getRevision( $timestamp );
154153 return $rev ? $rev->getText() : null;
155154 }
156 -
157 - function getRevisionConds( $timestamp, $id ) {
158 - if ( $id ) {
159 - $id = intval($id);
160 - return "ar_rev_id=$id";
161 - } else if ( $timestamp ) {
162 - return "ar_timestamp=$timestamp";
163 - } else {
164 - return 'ar_rev_id=0';
165 - }
166 - }
167155
168156 /**
169157 * Return a Revision object containing data for the deleted revision.
170 - * Note that the result *may* have a null page ID.
171 - * @param string $timestamp or $id
 158+ * Note that the result *may* or *may not* have a null page ID.
 159+ * @param string $timestamp
172160 * @return Revision
173161 */
174 - function getRevision( $timestamp, $id=null ) {
 162+ function getRevision( $timestamp ) {
175163 $dbr = wfGetDB( DB_SLAVE );
176164 $row = $dbr->selectRow( 'archive',
177165 array(
@@ -183,11 +171,10 @@
184172 'ar_minor_edit',
185173 'ar_flags',
186174 'ar_text_id',
187 - 'ar_deleted',
188175 'ar_len' ),
189176 array( 'ar_namespace' => $this->title->getNamespace(),
190177 'ar_title' => $this->title->getDbkey(),
191 - $this->getRevisionConds( $dbr->timestamp($timestamp), $id ) ),
 178+ 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
192179 __METHOD__ );
193180 if( $row ) {
194181 return new Revision( array(
@@ -201,9 +188,7 @@
202189 'user_text' => $row->ar_user_text,
203190 'timestamp' => $row->ar_timestamp,
204191 'minor_edit' => $row->ar_minor_edit,
205 - 'text_id' => $row->ar_text_id,
206 - 'deleted' => $row->ar_deleted,
207 - 'len' => $row->ar_len) );
 192+ 'text_id' => $row->ar_text_id ) );
208193 } else {
209194 return null;
210195 }
@@ -275,7 +260,7 @@
276261 *
277262 * @return true on success.
278263 */
279 - function undelete( $timestamps, $comment = '', $fileVersions = array(), $Unsuppress = false) {
 264+ function undelete( $timestamps, $comment = '', $fileVersions = array() ) {
280265 // If both the set of text revisions and file revisions are empty,
281266 // restore everything. Otherwise, just restore the requested items.
282267 $restoreAll = empty( $timestamps ) && empty( $fileVersions );
@@ -283,20 +268,17 @@
284269 $restoreText = $restoreAll || !empty( $timestamps );
285270 $restoreFiles = $restoreAll || !empty( $fileVersions );
286271
287 - if( $restoreText ) {
288 - $textRestored = $this->undeleteRevisions( $timestamps, $Unsuppress );
 272+ if( $restoreFiles && $this->title->getNamespace() == NS_IMAGE ) {
 273+ $img = new Image( $this->title );
 274+ $filesRestored = $img->restore( $fileVersions );
289275 } else {
290 - $textRestored = 0;
 276+ $filesRestored = 0;
291277 }
292278
293 - if ( $restoreText && !$textRestored) {
294 - // if the image page didn't restore right, don't restore the file either!!!
295 - $filesRestored = 0;
296 - } else if( $restoreFiles && $this->title->getNamespace() == NS_IMAGE ) {
297 - $img = new Image( $this->title );
298 - $filesRestored = $img->restore( $fileVersions, $Unsuppress );
 279+ if( $restoreText ) {
 280+ $textRestored = $this->undeleteRevisions( $timestamps );
299281 } else {
300 - $filesRestored = 0;
 282+ $textRestored = 0;
301283 }
302284
303285 // Touch the log!
@@ -304,14 +286,14 @@
305287 $log = new LogPage( 'delete' );
306288
307289 if( $textRestored && $filesRestored ) {
308 - $reason = wfMsgExt( 'undeletedrevisions-files', array('parsemag'),
 290+ $reason = wfMsgForContent( 'undeletedrevisions-files',
309291 $wgContLang->formatNum( $textRestored ),
310292 $wgContLang->formatNum( $filesRestored ) );
311293 } elseif( $textRestored ) {
312 - $reason = wfMsgExt( 'undeletedrevisions', array('parsemag'),
 294+ $reason = wfMsgForContent( 'undeletedrevisions',
313295 $wgContLang->formatNum( $textRestored ) );
314296 } elseif( $filesRestored ) {
315 - $reason = wfMsgExt( 'undeletedfiles', array('parsemag'),
 297+ $reason = wfMsgForContent( 'undeletedfiles',
316298 $wgContLang->formatNum( $filesRestored ) );
317299 } else {
318300 wfDebug( "Undelete: nothing undeleted...\n" );
@@ -333,11 +315,10 @@
334316 * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
335317 * @param string $comment
336318 * @param array $fileVersions
337 - * @param bool $Unsuppress, remove all ar_deleted/fa_deleted restrictions of seletected revs
338319 *
339320 * @return int number of revisions restored
340321 */
341 - private function undeleteRevisions( $timestamps, $Unsuppress = false ) {
 322+ private function undeleteRevisions( $timestamps ) {
342323 global $wgDBtype;
343324
344325 $restoreAll = empty( $timestamps );
@@ -381,7 +362,7 @@
382363 }
383364
384365 /**
385 - * Select each archived revision...
 366+ * Restore each revision...
386367 */
387368 $result = $dbw->select( 'archive',
388369 /* fields */ array(
@@ -394,7 +375,6 @@
395376 'ar_minor_edit',
396377 'ar_flags',
397378 'ar_text_id',
398 - 'ar_deleted',
399379 'ar_len' ),
400380 /* WHERE */ array(
401381 'ar_namespace' => $this->title->getNamespace(),
@@ -404,30 +384,15 @@
405385 /* options */ array(
406386 'ORDER BY' => 'ar_timestamp' )
407387 );
408 - $rev_count = $dbw->numRows( $result );
409 - if( $rev_count < count( $timestamps ) ) {
410 - # Remove page stub per failure
411 - $dbw->delete( 'page', array( 'page_id' => $pageId ), __METHOD__);
 388+ if( $dbw->numRows( $result ) < count( $timestamps ) ) {
412389 wfDebug( __METHOD__.": couldn't find all requested rows\n" );
413390 return false;
414391 }
415392
416 - $ret = $dbw->resultObject( $result );
417 - // FIXME: We don't currently handle well changing the top revision's settings
418 - $ret->seek( $rev_count - 1 );
419 - $last_row = $ret->fetchObject();
420 - if ( !$Unsuppress && $last_row->ar_deleted && $last_row->ar_rev_id > $previousRevId ) {
421 - # Remove page stub per failure
422 - $dbw->delete( 'page', array( 'page_id' => $pageId ), __METHOD__);
423 - wfDebug( __METHOD__.": couldn't find all requested rows or not all of them could be restored\n" );
424 - return false;
425 - }
426 -
427393 $revision = null;
428394 $restored = 0;
429 -
430 - $ret->seek( 0 );
431 - while( $row = $ret->fetchObject() ) {
 395+
 396+ while( $row = $dbw->fetchObject( $result ) ) {
432397 if( $row->ar_text_id ) {
433398 // Revision was deleted in 1.5+; text is in
434399 // the regular text table, use the reference.
@@ -450,8 +415,7 @@
451416 'timestamp' => $row->ar_timestamp,
452417 'minor_edit' => $row->ar_minor_edit,
453418 'text_id' => $row->ar_text_id,
454 - 'deleted' => ($Unsuppress) ? 0 : $row->ar_deleted,
455 - 'len' => $row->ar_len
 419+ 'len' => $row->ar_len
456420 ) );
457421 $revision->insertOn( $dbw );
458422 $restored++;
@@ -513,7 +477,6 @@
514478 $this->mRestore = $request->getCheck( 'restore' ) && $posted;
515479 $this->mPreview = $request->getCheck( 'preview' ) && $posted;
516480 $this->mComment = $request->getText( 'wpComment' );
517 - $this->mUnsuppress = $request->getVal( 'wpUnsuppress' ) && $wgUser->isAllowed( 'oversight' );
518481
519482 if( $par != "" ) {
520483 $this->mTarget = $par;
@@ -549,25 +512,21 @@
550513 }
551514
552515 function execute() {
553 - global $wgOut, $wgUser;
 516+ global $wgOut;
554517 if ( $this->mAllowed ) {
555 - $wgOut->setPagetitle( wfMsgHtml( "undeletepage" ) );
 518+ $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
556519 } else {
557 - $wgOut->setPagetitle( wfMsgHtml( "viewdeletedpage" ) );
 520+ $wgOut->setPagetitle( wfMsg( "viewdeletedpage" ) );
558521 }
559522
560523 if( is_null( $this->mTargetObj ) ) {
561 - # Not all users can just browse every deleted page from the list
562 - if ( $wgUser->isAllowed( 'browsearchive' ) ) {
563 - $this->showSearchForm();
 524+ $this->showSearchForm();
564525
565 - # List undeletable articles
566 - if( $this->mSearchPrefix ) {
567 - $result = PageArchive::listPagesByPrefix( $this->mSearchPrefix );
568 - $this->showList( $result );
569 - }
570 - } else {
571 - $wgOut->addWikiText( wfMsgHtml( 'undelete-header' ) );
 526+ # List undeletable articles
 527+ if( $this->mSearchPrefix ) {
 528+ $result = PageArchive::listPagesByPrefix(
 529+ $this->mSearchPrefix );
 530+ $this->showList( $result );
572531 }
573532 return;
574533 }
@@ -575,14 +534,7 @@
576535 return $this->showRevision( $this->mTimestamp );
577536 }
578537 if( $this->mFile !== null ) {
579 - $file = new ArchivedFile( $this->mTargetObj, '', $this->mFile );
580 - // Check if user is allowed to see this file
581 - if ( !$file->userCan( Image::DELETED_FILE ) ) {
582 - $wgOut->permissionRequired( 'hiderevision' );
583 - return false;
584 - } else {
585 - return $this->showFile( $this->mFile );
586 - }
 538+ return $this->showFile( $this->mFile );
587539 }
588540 if( $this->mRestore && $this->mAction == "submit" ) {
589541 return $this->undelete();
@@ -592,7 +544,7 @@
593545
594546 function showSearchForm() {
595547 global $wgOut, $wgScript;
596 - $wgOut->addWikiText( wfMsgHtml( 'undelete-header' ) );
 548+ $wgOut->addWikiText( wfMsg( 'undelete-header' ) );
597549
598550 $wgOut->addHtml(
599551 Xml::openElement( 'form', array(
@@ -611,7 +563,6 @@
612564 '</form>' );
613565 }
614566
615 - // Generic list of deleted pages
616567 /* private */ function showList( $result ) {
617568 global $wgLang, $wgContLang, $wgUser, $wgOut;
618569
@@ -661,22 +612,11 @@
662613 return;
663614 }
664615
665 - if( $rev->isDeleted(Revision::DELETED_TEXT) ) {
666 - if( !$rev->userCan(Revision::DELETED_TEXT) ) {
667 - $wgOut->addWikiText( wfMsg( 'rev-deleted-text-permission' ) );
668 - return;
669 - } else {
670 - $wgOut->addWikiText( wfMsg( 'rev-deleted-text-view' ) );
671 - $wgOut->addHTML( '<br/>' );
672 - // and we are allowed to see...
673 - }
674 - }
675 -
676616 wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) );
677617
678618 if( $this->mPreview ) {
679619 $wgOut->addHtml( "<hr />\n" );
680 - $wgOut->addWikiTextTitle( $rev->revText(), $this->mTargetObj, false );
 620+ $wgOut->addWikiTextTitle( $rev->getText(), $this->mTargetObj, false );
681621 }
682622
683623 $wgOut->addHtml(
@@ -684,7 +624,7 @@
685625 'readonly' => true,
686626 'cols' => intval( $wgUser->getOption( 'cols' ) ),
687627 'rows' => intval( $wgUser->getOption( 'rows' ) ) ),
688 - $rev->revText() . "\n" ) .
 628+ $rev->getText() . "\n" ) .
689629 wfOpenElement( 'div' ) .
690630 wfOpenElement( 'form', array(
691631 'method' => 'post',
@@ -734,7 +674,7 @@
735675 /* private */ function showHistory() {
736676 global $wgLang, $wgUser, $wgOut;
737677
738 - $this->sk = $wgUser->getSkin();
 678+ $sk = $wgUser->getSkin();
739679 if ( $this->mAllowed ) {
740680 $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
741681 } else {
@@ -750,10 +690,9 @@
751691 }
752692 */
753693 if ( $this->mAllowed ) {
754 - $wgOut->addWikiText( '<p>' . wfMsgHtml( "undeletehistory" ) . '</p>' );
755 - $wgOut->addHtml( '<p>' . wfMsgHtml( "undeleterevdel" ) . '</p>' );
 694+ $wgOut->addWikiText( wfMsg( "undeletehistory" ) );
756695 } else {
757 - $wgOut->addWikiText( wfMsgHtml( "undeletehistorynoadmin" ) );
 696+ $wgOut->addWikiText( wfMsg( "undeletehistorynoadmin" ) );
758697 }
759698
760699 # List all stored revisions
@@ -799,16 +738,7 @@
800739 array( 'page' => $this->mTargetObj->getPrefixedText(),
801740 'type' => 'delete' ) ) ) );
802741 $logViewer->showList( $wgOut );
803 - # Show relevant lines from the oversight log if user is allowed to see it:
804 - if ( $wgUser->isAllowed( 'oversight' ) ) {
805 - $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'oversight' ) ) . "</h2>\n" );
806 - $logViewer = new LogViewer(
807 - new LogReader(
808 - new FauxRequest(
809 - array( 'page' => $this->mTargetObj->getPrefixedText(),
810 - 'type' => 'oversight' ) ) ) );
811 - $logViewer->showList( $wgOut );
812 - }
 742+
813743 if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
814744 # Format the user-visible controls (comment field, submission button)
815745 # in a nice little table
@@ -816,10 +746,6 @@
817747 $table .= '<td colspan="2">' . wfMsgWikiHtml( 'undeleteextrahelp' ) . '</td></tr><tr>';
818748 $table .= '<td align="right"><strong>' . wfMsgHtml( 'undeletecomment' ) . '</strong></td>';
819749 $table .= '<td>' . wfInput( 'wpComment', 50, $this->mComment ) . '</td>';
820 - if ( $wgUser->isAllowed( 'oversight' ) ) {
821 - $table .= '</tr><tr><td>&nbsp;</td><td>';
822 - $table .= Xml::checkLabel( wfMsg( 'revdelete-unsuppress' ), 'wpUnsuppress', 'wpUnsuppress', false, array( 'tabindex' => '2' ) );
823 - }
824750 $table .= '</tr><tr><td>&nbsp;</td><td>';
825751 $table .= wfSubmitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore' ) );
826752 $table .= wfElement( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ) ) );
@@ -835,48 +761,26 @@
836762 $target = urlencode( $this->mTarget );
837763 while( $row = $revisions->fetchObject() ) {
838764 $ts = wfTimestamp( TS_MW, $row->ar_timestamp );
839 - // We don't handle top edits with rev_deleted
840765 if ( $this->mAllowed ) {
841 - $checkBox = wfCheck( "ts$ts", false );
842 - $titleObj = SpecialPage::getTitleFor( "Undelete" );
843 - $pageLink = $this->getPageLink( $row, $titleObj, $ts, $target );
 766+ $checkBox = wfCheck( "ts$ts" );
 767+ $pageLink = $sk->makeKnownLinkObj( $titleObj,
 768+ $wgLang->timeanddate( $ts, true ),
 769+ "target=$target&timestamp=$ts" );
844770 } else {
845771 $checkBox = '';
846772 $pageLink = $wgLang->timeanddate( $ts, true );
847773 }
848 - $userLink = $this->getUser( $row );
 774+ $userLink = $sk->userLink( $row->ar_user, $row->ar_user_text ) . $sk->userToolLinks( $row->ar_user, $row->ar_user_text );
849775 $stxt = '';
850776 if (!is_null($size = $row->ar_len)) {
851777 if ($size == 0)
852778 $stxt = wfMsgHtml('historyempty');
853 - else
 779+ else
854780 $stxt = wfMsgHtml('historysize', $wgLang->formatNum( $size ) );
855781 }
856 - $comment = $this->getComment( $row );
857 - $rd='';
858 - if( $wgUser->isAllowed( 'deleterevision' ) ) {
859 - $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
860 - if( !$this->userCan( $row, Revision::DELETED_RESTRICTED ) ) {
861 - // If revision was hidden from sysops
862 - $del = wfMsgHtml( 'rev-delundel' );
863 - } else {
864 - $del = $this->sk->makeKnownLinkObj( $revdel,
865 - wfMsg( 'rev-delundel' ),
866 - 'target=' . urlencode( $this->mTarget ) .
867 - '&arid=' . urlencode( $row->ar_rev_id ) );
868 - // Bolden oversighted content
869 - if( $this->isDeleted( $row, Revision::DELETED_RESTRICTED ) )
870 - $del = "<strong>$del</strong>";
871 - }
872 - $rd = "<tt>(<small>$del</small>)</tt>";
873 - }
874 -
875 - $dflag='';
876 - if( $this->isDeleted( $row, Revision::DELETED_TEXT ) )
877 - $dflag = ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
878 -
879 - // Do we still need checkboxes?
880 - $wgOut->addHTML( "<li>$checkBox $rd $pageLink . . $userLink $stxt $comment$dflag</li>\n" );
 782+ $comment = $sk->commentBlock( $row->ar_comment );
 783+ $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $stxt $comment</li>\n" );
 784+
881785 }
882786 $revisions->free();
883787 $wgOut->addHTML("</ul>");
@@ -891,21 +795,17 @@
892796 while( $row = $files->fetchObject() ) {
893797 $ts = wfTimestamp( TS_MW, $row->fa_timestamp );
894798 if ( $this->mAllowed && $row->fa_storage_key ) {
895 - if ( !$this->userCan( $row, Revision::DELETED_RESTRICTED ) )
896 - // Grey out boxes to files restricted beyond this user.
897 - // In the future, all image storage may use FileStore, allowing
898 - // for such items to be restored and retain their fa_deleted status
899 - $checkBox = wfCheck( "", false, array("disabled" => "disabled") );
900 - else
901 - $checkBox = wfCheck( "fileid" . $row->fa_id );
 799+ $checkBox = wfCheck( "fileid" . $row->fa_id );
902800 $key = urlencode( $row->fa_storage_key );
903801 $target = urlencode( $this->mTarget );
904 - $pageLink = $this->getFileLink( $row, $titleObj, $ts, $target, $key );
 802+ $pageLink = $sk->makeKnownLinkObj( $titleObj,
 803+ $wgLang->timeanddate( $ts, true ),
 804+ "target=$target&file=$key" );
905805 } else {
906806 $checkBox = '';
907807 $pageLink = $wgLang->timeanddate( $ts, true );
908808 }
909 - $userLink = $this->getFileUser( $row );
 809+ $userLink = $sk->userLink( $row->fa_user, $row->fa_user_text ) . $sk->userToolLinks( $row->fa_user, $row->fa_user_text );
910810 $data =
911811 wfMsgHtml( 'widthheight',
912812 $wgLang->formatNum( $row->fa_width ),
@@ -913,25 +813,8 @@
914814 ' (' .
915815 wfMsgHtml( 'nbytes', $wgLang->formatNum( $row->fa_size ) ) .
916816 ')';
917 - $comment = $this->getFileComment( $row );
918 - $rd='';
919 - if( $wgUser->isAllowed( 'deleterevision' ) ) {
920 - $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
921 - if( !$this->userCan( $row, Image::DELETED_RESTRICTED ) ) {
922 - // If revision was hidden from sysops
923 - $del = wfMsgHtml( 'rev-delundel' );
924 - } else {
925 - $del = $this->sk->makeKnownLinkObj( $revdel,
926 - wfMsg( 'rev-delundel' ),
927 - 'target=' . urlencode( $this->mTarget ) .
928 - '&fileid=' . urlencode( $row->fa_id ) );
929 - // Bolden oversighted content
930 - if( $this->isDeleted( $row, Image::DELETED_RESTRICTED ) )
931 - $del = "<strong>$del</strong>";
932 - }
933 - $rd = "<tt>(<small>$del</small>)</tt>";
934 - }
935 - $wgOut->addHTML( "<li>$checkBox $rd $pageLink . . $userLink $data $comment</li>\n" );
 817+ $comment = $sk->commentBlock( $row->fa_description );
 818+ $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $data $comment</li>\n" );
936819 }
937820 $files->free();
938821 $wgOut->addHTML( "</ul>" );
@@ -947,143 +830,6 @@
948831 return true;
949832 }
950833
951 - /**
952 - * Fetch revision text link if it's available to all users
953 - * @return string
954 - */
955 - function getPageLink( $row, $titleObj, $ts, $target ) {
956 - global $wgLang;
957 -
958 - if ( !$this->userCan($row, Revision::DELETED_TEXT) ) {
959 - return '<span class="history-deleted">' . $wgLang->timeanddate( $ts, true ) . '</span>';
960 - } else {
961 - $link = $this->sk->makeKnownLinkObj( $titleObj, $wgLang->timeanddate( $ts, true ), "target=$target&timestamp=$ts" );
962 - if ( $this->isDeleted($row, Revision::DELETED_TEXT) )
963 - $link = '<span class="history-deleted">' . $link . '</span>';
964 - return $link;
965 - }
966 - }
967 -
968 - /**
969 - * Fetch image view link if it's available to all users
970 - * @return string
971 - */
972 - function getFileLink( $row, $titleObj, $ts, $target, $key ) {
973 - global $wgLang;
974 -
975 - if ( !$this->userCan($row, Image::DELETED_FILE) ) {
976 - return '<span class="history-deleted">' . $wgLang->timeanddate( $ts, true ) . '</span>';
977 - } else {
978 - $link = $this->sk->makeKnownLinkObj( $titleObj, $wgLang->timeanddate( $ts, true ), "target=$target&file=$key" );
979 - if ( $this->isDeleted($row, Image::DELETED_FILE) )
980 - $link = '<span class="history-deleted">' . $link . '</span>';
981 - return $link;
982 - }
983 - }
984 -
985 - /**
986 - * Fetch revision's user id if it's available to this user
987 - * @return string
988 - */
989 - function getUser( $row ) {
990 - if ( !$this->userCan($row, Revision::DELETED_USER) ) {
991 - return '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
992 - } else {
993 - $link = $this->sk->userLink( $row->ar_user, $row->ar_user_text ) . $this->sk->userToolLinks( $row->ar_user, $row->ar_user_text );
994 - if ( $this->isDeleted($row, Revision::DELETED_USER) )
995 - $link = '<span class="history-deleted">' . $link . '</span>';
996 - return $link;
997 - }
998 - }
999 -
1000 - /**
1001 - * Fetch file's user id if it's available to this user
1002 - * @return string
1003 - */
1004 - function getFileUser( $row ) {
1005 - if ( !$this->userCan($row, Image::DELETED_USER) ) {
1006 - return '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
1007 - } else {
1008 - $link = $this->sk->userLink( $row->fa_user, $row->fa_user_text ) . $this->sk->userToolLinks( $row->fa_user, $row->fa_user_text );
1009 - if ( $this->isDeleted($row, Image::DELETED_USER) )
1010 - $link = '<span class="history-deleted">' . $link . '</span>';
1011 - return $link;
1012 - }
1013 - }
1014 -
1015 - /**
1016 - * Fetch revision comment if it's available to this user
1017 - * @return string
1018 - */
1019 - function getComment( $row ) {
1020 - if ( !$this->userCan($row, Revision::DELETED_COMMENT) ) {
1021 - return '<span class="history-deleted"><span class="comment">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span></span>';
1022 - } else {
1023 - $link = $this->sk->commentBlock( $row->ar_comment );
1024 - if ( $this->isDeleted($row, Revision::DELETED_COMMENT) )
1025 - $link = '<span class="history-deleted">' . $link . '</span>';
1026 - return $link;
1027 - }
1028 - }
1029 -
1030 - /**
1031 - * Fetch file upload comment if it's available to this user
1032 - * @return string
1033 - */
1034 - function getFileComment( $row ) {
1035 - if ( !$this->userCan($row, Image::DELETED_COMMENT) ) {
1036 - return '<span class="history-deleted"><span class="comment">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span></span>';
1037 - } else {
1038 - $link = $this->sk->commentBlock( $row->fa_description );
1039 - if ( $this->isDeleted($row, Image::DELETED_COMMENT) )
1040 - $link = '<span class="history-deleted">' . $link . '</span>';
1041 - return $link;
1042 - }
1043 - }
1044 -
1045 - /**
1046 - * int $field one of DELETED_* bitfield constants
1047 - * for file or revision rows
1048 - * @return bool
1049 - */
1050 - function isDeleted( $row, $field ) {
1051 - if ( isset($row->ar_deleted) )
1052 - // page revisions
1053 - return ($row->ar_deleted & $field) == $field;
1054 - else if ( isset($row->fa_deleted) )
1055 - // files
1056 - return ($row->fa_deleted & $field) == $field;
1057 - return false;
1058 - }
1059 -
1060 - /**
1061 - * Determine if the current user is allowed to view a particular
1062 - * field of this revision, if it's marked as deleted.
1063 - * @param int $field
1064 - * @return bool
1065 - */
1066 - function userCan( $row, $field ) {
1067 - global $wgUser;
1068 -
1069 - if( isset($row->ar_deleted) && ($row->ar_deleted & $field) == $field ) {
1070 - // page revisions
1071 - $permission = ( $row->ar_deleted & Revision::DELETED_RESTRICTED ) == Revision::DELETED_RESTRICTED
1072 - ? 'hiderevision'
1073 - : 'deleterevision';
1074 - wfDebug( "Checking for $permission due to $field match on $row->ar_deleted\n" );
1075 - return $wgUser->isAllowed( $permission );
1076 - } else if( isset($row->fa_deleted) && ($row->fa_deleted & $field) == $field ) {
1077 - // files
1078 - $permission = ( $row->fa_deleted & Image::DELETED_RESTRICTED ) == Image::DELETED_RESTRICTED
1079 - ? 'hiderevision'
1080 - : 'deleterevision';
1081 - wfDebug( "Checking for $permission due to $field match on $row->fa_deleted\n" );
1082 - return $wgUser->isAllowed( $permission );
1083 - } else {
1084 - return true;
1085 - }
1086 - }
1087 -
1088834 function undelete() {
1089835 global $wgOut, $wgUser;
1090836 if( !is_null( $this->mTargetObj ) ) {
@@ -1092,22 +838,16 @@
1093839 $ok = $archive->undelete(
1094840 $this->mTargetTimestamp,
1095841 $this->mComment,
1096 - $this->mFileVersions,
1097 - $this->mUnsuppress );
 842+ $this->mFileVersions );
 843+
1098844 if( $ok ) {
1099845 $skin = $wgUser->getSkin();
1100846 $link = $skin->makeKnownLinkObj( $this->mTargetObj );
1101847 $wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) );
1102848 return true;
1103849 }
1104 - // Give user some idea of what is going on ...
1105 - // This can happen if the top revision would end up being deleted
1106 - $wgOut->addHtml( '<p>' . wfMsgHtml( "cannotundelete" ) . '</p>' );
1107 - $wgOut->addHtml( '<p>' . wfMsgHtml( "undeleterevdel" ) . '</p>' );
1108 - $wgOut->returnToMain( false, $this->mTargetObj );
1109 - return false;
1110850 }
1111 - $wgOut->showFatalError( wfMsgHtml( "cannotundelete" ) );
 851+ $wgOut->showFatalError( wfMsg( "cannotundelete" ) );
1112852 return false;
1113853 }
1114854 }
Index: trunk/phase3/includes/DifferenceEngine.php
@@ -174,49 +174,14 @@
175175 $newminor = wfElement( 'span', array( 'class' => 'minor' ),
176176 wfMsg( 'minoreditletter') ) . ' ';
177177 }
178 -
179 - $rdel = ''; $ldel = '';
180 - if( $wgUser->isAllowed( 'deleterevision' ) ) {
181 - $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
182 - if( !$this->mOldRev->userCan( Revision::DELETED_RESTRICTED ) ) {
183 - // If revision was hidden from sysops
184 - $ldel = wfMsgHtml('rev-delundel');
185 - } else {
186 - $ldel = $sk->makeKnownLinkObj( $revdel,
187 - wfMsgHtml('rev-delundel'),
188 - 'target=' . urlencode( $this->mOldRev->mTitle->getPrefixedDbkey() ) .
189 - '&oldid=' . urlencode( $this->mOldRev->getId() ) );
190 - // Bolden oversighted content
191 - if( $this->mOldRev->isDeleted( Revision::DELETED_RESTRICTED ) )
192 - $ldel = "<strong>$ldel</strong>";
193 - }
194 - $ldel = "&nbsp;&nbsp;&nbsp;<tt>(<small>$ldel</small>)</tt> ";
195 - // We don't currently handle well changing the top revision's settings
196 - if( $this->mNewRev->isCurrent() ) {
197 - // If revision was hidden from sysops
198 - $rdel = wfMsgHtml('rev-delundel');
199 - } else if( !$this->mNewRev->userCan( Revision::DELETED_RESTRICTED ) ) {
200 - // If revision was hidden from sysops
201 - $rdel = wfMsgHtml('rev-delundel');
202 - } else {
203 - $rdel = $sk->makeKnownLinkObj( $revdel,
204 - wfMsgHtml('rev-delundel'),
205 - 'target=' . urlencode( $this->mNewRev->mTitle->getPrefixedDbkey() ) .
206 - '&oldid=' . urlencode( $this->mNewRev->getId() ) );
207 - // Bolden oversighted content
208 - if( $this->mNewRev->isDeleted( Revision::DELETED_RESTRICTED ) )
209 - $rdel = "<strong>$rdel</strong>";
210 - }
211 - $rdel = "&nbsp;&nbsp;&nbsp;<tt>(<small>$rdel</small>)</tt> ";
212 - }
213178
214179 $oldHeader = "<strong>{$this->mOldtitle}</strong><br />" .
215 - $sk->revUserTools( $this->mOldRev, true ) . "<br />" .
216 - $oldminor . $sk->revComment( $this->mOldRev, !$diffOnly, true ) . "$ldel<br />" .
 180+ $sk->revUserTools( $this->mOldRev ) . "<br />" .
 181+ $oldminor . $sk->revComment( $this->mOldRev, !$diffOnly ) . "<br />" .
217182 $prevlink;
218183 $newHeader = "<strong>{$this->mNewtitle}</strong><br />" .
219 - $sk->revUserTools( $this->mNewRev, true ) . " $rollback<br />" .
220 - $newminor . $sk->revComment( $this->mNewRev, !$diffOnly, true ) . "$rdel<br />" .
 184+ $sk->revUserTools( $this->mNewRev ) . " $rollback<br />" .
 185+ $newminor . $sk->revComment( $this->mNewRev, !$diffOnly ) . "<br />" .
221186 $nextlink . $patrol;
222187
223188 $this->showDiff( $oldHeader, $newHeader );
@@ -237,10 +202,8 @@
238203
239204 $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
240205 #add deleted rev tag if needed
241 - if( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
 206+ if ( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
242207 $wgOut->addWikiText( wfMsg( 'rev-deleted-text-permission' ) );
243 - } else if( $this->mNewRev->isDeleted(Revision::DELETED_TEXT) ) {
244 - $wgOut->addWikiText( wfMsg( 'rev-deleted-text-view' ) );
245208 }
246209
247210 if( !$this->mNewRev->isCurrent() ) {
@@ -369,25 +332,20 @@
370333 }
371334 }
372335
373 - // Loadtext is permission safe, this just clears out the diff
 336+ #loadtext is permission safe, this just clears out the diff
374337 if ( !$this->loadText() ) {
375338 wfProfileOut( $fname );
376339 return false;
377340 } else if ( $this->mOldRev && !$this->mOldRev->userCan(Revision::DELETED_TEXT) ) {
378 - return '';
 341+ return '';
379342 } else if ( $this->mNewRev && !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
380 - return '';
 343+ return '';
381344 }
382345
383346 $difftext = $this->generateDiffBody( $this->mOldtext, $this->mNewtext );
384347
385348 // Save to cache for 7 days
386 - // Only do this for public revs, otherwise an admin can view the diff and a non-admin can nab it!
387 - if ( $this->mOldRev && $this->mOldRev->isDeleted(Revision::DELETED_TEXT) ) {
388 - wfIncrStats( 'diff_uncacheable' );
389 - } else if ( $this->mNewRev && $this->mNewRev->isDeleted(Revision::DELETED_TEXT) ) {
390 - wfIncrStats( 'diff_uncacheable' );
391 - } else if ( $key !== false && $difftext !== false ) {
 349+ if ( $key !== false && $difftext !== false ) {
392350 wfIncrStats( 'diff_cache_miss' );
393351 $wgMemc->set( $key, $difftext, 7*86400 );
394352 } else {
@@ -521,7 +479,13 @@
522480 */
523481 function addHeader( $diff, $otitle, $ntitle, $multi = '' ) {
524482 global $wgOut;
525 -
 483+
 484+ if ( $this->mOldRev && $this->mOldRev->isDeleted(Revision::DELETED_TEXT) ) {
 485+ $otitle = '<span class="history-deleted">'.$otitle.'</span>';
 486+ }
 487+ if ( $this->mNewRev && $this->mNewRev->isDeleted(Revision::DELETED_TEXT) ) {
 488+ $ntitle = '<span class="history-deleted">'.$ntitle.'</span>';
 489+ }
526490 $header = "
527491 <table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>
528492 <tr>
@@ -594,11 +558,6 @@
595559 $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a>"
596560 . " (<a href='$newEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)";
597561 }
598 - if ( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
599 - $this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>";
600 - } else if ( $this->mNewRev->isDeleted(Revision::DELETED_TEXT) ) {
601 - $this->mNewtitle = '<span class="history-deleted">'.$this->mNewtitle.'</span>';
602 - }
603562
604563 // Load the old revision object
605564 $this->mOldRev = false;
@@ -626,20 +585,11 @@
627586 $t = $wgLang->timeanddate( $this->mOldRev->getTimestamp(), true );
628587 $oldLink = $this->mOldPage->escapeLocalUrl( 'oldid=' . $this->mOldid );
629588 $oldEdit = $this->mOldPage->escapeLocalUrl( 'action=edit&oldid=' . $this->mOldid );
630 - $this->mOldPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $t ) );
631 -
632 - $this->mOldtitle = "<a href='$oldLink'>{$this->mOldPagetitle}</a>"
633 - . "(<a href='$oldEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)";
634 - // Now that we considered old rev, we can make undo link (bug 8133, multi-edit undo)
 589+ $this->mOldtitle = "<a href='$oldLink'>" . htmlspecialchars( wfMsg( 'revisionasof', $t ) )
 590+ . "</a> (<a href='$oldEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)";
 591+ //now that we considered old rev, we can make undo link (bug 8133, multi-edit undo)
635592 $newUndo = $this->mNewPage->escapeLocalUrl( 'action=edit&undoafter=' . $this->mOldid . '&undoto=' . $this->mNewid);
636 - if ( $this->mNewRev->userCan(Revision::DELETED_TEXT) )
637 - $this->mNewtitle .= " (<a href='$newUndo'>" . htmlspecialchars( wfMsg( 'editundo' ) ) . "</a>)";
638 -
639 - if ( !$this->mOldRev->userCan(Revision::DELETED_TEXT) ) {
640 - $this->mOldtitle = "<span class='history-deleted'>{$this->mOldPagetitle}</span>";
641 - } else if ( $this->mOldRev->isDeleted(Revision::DELETED_TEXT) ) {
642 - $this->mOldtitle = '<span class="history-deleted">'.$this->mOldtitle.'</span>';
643 - }
 593+ $this->mNewtitle .= " (<a href='$newUndo'>" . htmlspecialchars( wfMsg( 'editundo' ) ) . "</a>)";
644594 }
645595
646596 return true;
@@ -660,6 +610,7 @@
661611 return false;
662612 }
663613 if ( $this->mOldRev ) {
 614+ // FIXME: permission tests
664615 $this->mOldtext = $this->mOldRev->revText();
665616 if ( $this->mOldtext === false ) {
666617 return false;
Index: trunk/phase3/includes/SpecialLog.php
@@ -72,70 +72,16 @@
7373
7474 list( $this->limit, $this->offset ) = $request->getLimitOffset();
7575 }
76 -
77 - function newFromTitle( $title, $logid=0 ) {
78 - $fname = 'LogReader::newFromTitle';
7976
80 - $matchId = intval( $logid );
81 - $dbr = wfGetDB( DB_SLAVE );
82 - $res = $dbr->select( 'logging', array('*'),
83 - array('log_id' => $matchId, 'log_namespace' => $title->getNamespace(), 'log_title' => $title->getDBkey() ),
84 - $fname );
85 -
86 - if ( $res ) {
87 - $ret = $dbr->fetchObject( $res );
88 - if ( $ret ) {
89 - return $ret;
90 - }
91 - }
92 - return null;
93 - }
94 -
95 - function newFromId( $logid ) {
96 - $fname = 'LogReader::newFromId';
97 -
98 - $matchId = intval( $logid );
99 - $dbr = wfGetDB( DB_SLAVE );
100 - $res = $dbr->select( 'logging', array('*'), array('log_id' => $matchId ), $fname );
101 -
102 - if ( $res ) {
103 - $ret = $dbr->fetchObject( $res );
104 - if ( $ret ) {
105 - return $ret;
106 - }
107 - }
108 - return null;
109 - }
110 -
11177 /**
11278 * Set the log reader to return only entries of the given type.
113 - * Type restrictions enforced here
11479 * @param string $type A log type ('upload', 'delete', etc)
11580 * @private
11681 */
11782 function limitType( $type ) {
118 - global $wgLogRestrictions, $wgUser;
119 -
120 - // Restriction system
121 - if ( isset($wgLogRestrictions) ) {
122 - foreach ( $wgLogRestrictions as $logtype => $right ) {
123 - if ( !$wgUser->isAllowed( $right ) ) {
124 - $safetype = $this->db->strencode( $logtype );
125 - $this->whereClauses[] = "log_type <> '$safetype'";
126 - }
127 - }
128 - }
129 -
13083 if( empty( $type ) ) {
13184 return false;
13285 }
133 - // Can user see this log?
134 - if ( isset($wgLogRestrictions[$type]) ) {
135 - if ( !$wgUser->isAllowed( $wgLogRestrictions[$type] ) ) {
136 - return false;
137 - }
138 - }
139 -
14086 $this->type = $type;
14187 $safetype = $this->db->strencode( $type );
14288 $this->whereClauses[] = "log_type='$safetype'";
@@ -171,7 +117,7 @@
172118 * @private
173119 */
174120 function limitTitle( $page , $pattern ) {
175 - $title = Title::newFromURL( $page, false );
 121+ $title = Title::newFromText( $page );
176122 if( empty( $page ) || is_null( $title ) ) {
177123 return false;
178124 }
@@ -211,7 +157,6 @@
212158 $logging = $this->db->tableName( "logging" );
213159 $sql = "SELECT /*! STRAIGHT_JOIN */ log_type, log_action, log_timestamp,
214160 log_user, user_name,
215 - log_id, log_deleted,
216161 log_namespace, log_title, page_id,
217162 log_comment, log_params FROM $logging ";
218163 if( !empty( $this->joinClauses ) ) {
@@ -272,11 +217,6 @@
273218 * @addtogroup SpecialPage
274219 */
275220 class LogViewer {
276 - const DELETED_ACTION = 1;
277 - const DELETED_COMMENT = 2;
278 - const DELETED_USER = 4;
279 - const DELETED_RESTRICTED = 8;
280 -
281221 /**
282222 * @var LogReader $reader
283223 */
@@ -290,21 +230,7 @@
291231 global $wgUser;
292232 $this->skin = $wgUser->getSkin();
293233 $this->reader =& $reader;
294 - $this->preCacheMessages();
295234 }
296 -
297 - /**
298 - * As we use the same small set of messages in various methods and that
299 - * they are called often, we call them once and save them in $this->message
300 - */
301 - function preCacheMessages() {
302 - // Precache various messages
303 - if( !isset( $this->message ) ) {
304 - foreach( explode(' ', 'viewpagelogs revhistory imghistory rev-delundel' ) as $msg ) {
305 - $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
306 - }
307 - }
308 - }
309235
310236 /**
311237 * Take over the whole output page in $wgOut with the log display.
@@ -322,125 +248,8 @@
323249 $this->showError( $wgOut );
324250 }
325251 }
326 -
327 - /**
328 - * Determine if the current user is allowed to view a particular
329 - * field of this event, if it's marked as deleted.
330 - * @param int $field
331 - * @return bool
332 - */
333 - function userCan( $event, $field ) {
334 - if( ( $event->log_deleted & $field ) == $field ) {
335 - global $wgUser;
336 - $permission = ( $event->log_deleted & Revision::DELETED_RESTRICTED ) == Revision::DELETED_RESTRICTED
337 - ? 'hiderevision'
338 - : 'deleterevision';
339 - wfDebug( "Checking for $permission due to $field match on $event->log_deleted\n" );
340 - return $wgUser->isAllowed( $permission );
341 - } else {
342 - return true;
343 - }
344 - }
345 -
346 - /**
347 - * int $field one of DELETED_* bitfield constants
348 - * @return bool
349 - */
350 - function isDeleted( $event, $field ) {
351 - return ($event->log_deleted & $field) == $field;
352 - }
353 -
354 - /**
355 - * Fetch event's user id if it's available to all users
356 - * @return int
357 - */
358 - function getUser( $event ) {
359 - if( $this->isDeleted( $event, Revision::DELETED_USER ) ) {
360 - return 0;
361 - } else {
362 - return $event->log_user;
363 - }
364 - }
365252
366253 /**
367 - * Fetch event's user id without regard for the current user's permissions
368 - * @return string
369 - */
370 - function getRawUser( $event ) {
371 - return $event->log_user;
372 - }
373 -
374 - /**
375 - * Fetch event's username if it's available to all users
376 - * @return string
377 - */
378 - function getUserText( $event ) {
379 - if( $this->isDeleted( $event, Revision::DELETED_USER ) ) {
380 - return "";
381 - } else {
382 - if ( isset($event->user_name) ) {
383 - return $event->user_name;
384 - } else {
385 - return User::whoIs( $event->log_user );
386 - }
387 - }
388 - }
389 -
390 - /**
391 - * Fetch event's username without regard for view restrictions
392 - * @return string
393 - */
394 - function getRawUserText( $event ) {
395 - if ( isset($event->user_name) ) {
396 - return $event->user_name;
397 - } else {
398 - return User::whoIs( $event->log_user );
399 - }
400 - }
401 -
402 - /**
403 - * Fetch event comment if it's available to all users
404 - * @return string
405 - */
406 - function getComment( $event ) {
407 - if( $this->isDeleted( $event, Revision::DELETED_COMMENT ) ) {
408 - return "";
409 - } else {
410 - return $event->log_comment;
411 - }
412 - }
413 -
414 - /**
415 - * Fetch event comment without regard for the current user's permissions
416 - * @return string
417 - */
418 - function getRawComment( $event ) {
419 - return $event->log_comment;
420 - }
421 -
422 - /**
423 - * Returns the title of the page associated with this entry.
424 - * @return Title
425 - */
426 - function getTitle( $event ) {
427 - return Title::makeTitle( $event->log_namespace, $event->log_title );
428 - }
429 -
430 - /**
431 - * Return the log action if it's available to all users
432 - * default is deleted if not specified for security
433 - * @return Title
434 - */
435 - function logActionText( $log_type, $log_action, $title, $skin, $paramArray, $log_deleted = LogViewer::DELETED_ACTION ) {
436 - if( $log_deleted & LogViewer::DELETED_ACTION ) {
437 - return '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
438 - } else {
439 - $action = LogPage::actionText( $log_type, $log_action, $title, $this->skin, $paramArray, true, true );
440 - return $action;
441 - }
442 - }
443 -
444 - /**
445254 * Load the data from the linked LogReader
446255 * Preload the link cache
447256 * Initialise numResults
@@ -510,8 +319,7 @@
511320 * @private
512321 */
513322 function logLine( $s ) {
514 - global $wgLang, $wgUser;
515 -
 323+ global $wgLang, $wgUser;;
516324 $skin = $wgUser->getSkin();
517325 $title = Title::makeTitle( $s->log_namespace, $s->log_title );
518326 $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $s->log_timestamp), true );
@@ -524,64 +332,12 @@
525333 } else {
526334 $linkCache->addBadLinkObj( $title );
527335 }
528 - // User links
529 - $userLink = $this->skin->logUserTools( $s, true );
530 - // Comment
531 - $comment = $this->skin->logComment( $s, true );
532336
 337+ $userLink = $this->skin->userLink( $s->log_user, $s->user_name ) . $this->skin->userToolLinksRedContribs( $s->log_user, $s->user_name );
 338+ $comment = $this->skin->commentBlock( $s->log_comment );
533339 $paramArray = LogPage::extractParams( $s->log_params );
534 - $revert = ''; $del = '';
535 -
536 - // Some user can hide log items and have review links
537 - if( $wgUser->isAllowed( 'deleterevision' ) ) {
538 - $del = $this->showhideLinks( $s, $title );
539 - }
540 -
541 - // Show restore/unprotect/unblock
542 - $revert = $this->showReviewLinks( $s, $title, $paramArray );
543 -
544 - // Event description
545 - $action = $this->logActionText( $s->log_type, $s->log_action, $title, $this->skin, $paramArray, $s->log_deleted );
546 -
547 - $out = "<li><tt>$del</tt> $time $userLink $action $comment <small>$revert</small></li>\n";
548 - return $out;
549 - }
550 -
551 - /**
552 - * @param $s, row object
553 - * @param $s, title object
554 - * @private
555 - */
556 - function showhideLinks( $s, $title ) {
557 - $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
558 - if( !LogViewer::userCan( $s, Revision::DELETED_RESTRICTED ) ) {
559 - // If event was hidden from sysops
560 - $del = $this->message['rev-delundel'];
561 - } else if( $s->log_type == 'oversight' ) {
562 - // No one should be hiding from the oversight log
563 - $del = $this->message['rev-delundel'];
564 - } else {
565 - $del = $this->skin->makeKnownLinkObj( $revdel,
566 - $this->message['rev-delundel'],
567 - 'target=' . urlencode( $title->getPrefixedDbkey() ) . '&logid=' . $s->log_id );
568 - // Bolden oversighted content
569 - if( LogViewer::isDeleted( $s, Revision::DELETED_RESTRICTED ) )
570 - $del = "<strong>$del</strong>";
571 - }
572 - return "(<small>$del</small>)";
573 - }
574 -
575 - /**
576 - * @param $s, row object
577 - * @param $title, title object
578 - * @param $s, param array
579 - * @private
580 - */
581 - function showReviewLinks( $s, $title, $paramArray ) {
582 - global $wgUser;
583 -
584 - $reviewlink='';
585 - // Show revertmove link
 340+ $revert = '';
 341+ // show revertmove link
586342 if ( $s->log_type == 'move' && isset( $paramArray[0] ) ) {
587343 $destTitle = Title::newFromText( $paramArray[0] );
588344 if ( $destTitle ) {
@@ -593,47 +349,26 @@
594350 '&wpMovetalk=0' );
595351 }
596352 // show undelete link
597 - } else if ( $s->log_action == 'delete' && $wgUser->isAllowed( 'delete' ) ) {
598 - $reviewlink = $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ),
 353+ } elseif ( $s->log_action == 'delete' && $wgUser->isAllowed( 'delete' ) ) {
 354+ $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ),
599355 wfMsg( 'undeletebtn' ) ,
600 - 'target='. urlencode( $title->getPrefixedDBkey() ) );
 356+ 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')';
 357+
601358 // show unblock link
602359 } elseif ( $s->log_action == 'block' && $wgUser->isAllowed( 'block' ) ) {
603 - $reviewlink = $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ),
 360+ $revert = '(' . $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ),
604361 wfMsg( 'unblocklink' ),
605 - 'action=unblock&ip=' . urlencode( $s->log_title ) );
 362+ 'action=unblock&ip=' . urlencode( $s->log_title ) ) . ')';
606363 // show change protection link
607364 } elseif ( $s->log_action == 'protect' && $wgUser->isAllowed( 'protect' ) ) {
608 - $reviewlink = $this->skin->makeKnownLink( $title->getPrefixedDBkey() ,
 365+ $revert = '(' . $skin->makeKnownLink( $title->getPrefixedDBkey() ,
609366 wfMsg( 'protect_change' ),
610 - 'action=unprotect' );
 367+ 'action=unprotect' ) . ')';
611368 }
612 - // If an edit was hidden from a page give a review link to the history
613 - if ( $wgUser->isAllowed( 'deleterevision' ) && isset($paramArray[2]) ) {
614 - $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
615 - if ( $s->log_action == 'revision' ) {
616 - $reviewlink = $this->skin->makeKnownLinkObj( $title, $this->message['revhistory'],
617 - wfArrayToCGI( array('action' => 'history' ) ) ) . ':';
618 - } else if ( $s->log_action == 'file' ) {
619 - // Currently, only deleted file versions can be hidden
620 - $undelete = SpecialPage::getTitleFor( 'Undelete' );
621 - $reviewlink = $this->skin->makeKnownLinkObj( $undelete, $this->message['imghistory'],
622 - wfArrayToCGI( array('target' => $title->getPrefixedText() ) ) ) . ':';
623 - } else if ( $s->log_action == 'event' && isset($paramArray[0]) ) {
624 - // If this event was to a log, give a review link to logs for that page only
625 - $reviewlink = $this->skin->makeKnownLinkObj( $title, $this->message['viewpagelogs'],
626 - wfArrayToCGI( array('page' => $paramArray[0] ) ) ) . ':';
627 - }
628 - // Link to each hidden object ID
629 - $IdType = $paramArray[1].'id';
630 - $Ids = explode( ',', $paramArray[2] );
631 - foreach ( $Ids as $id ) {
632 - $reviewlink .= ' '.$this->skin->makeKnownLinkObj( $revdel, "#$id",
633 - wfArrayToCGI( array('target' => $paramArray[0], $IdType => $id ) ) );
634 - }
635 - }
636 - $reviewlink = ( $reviewlink=='' ) ? "" : "&nbsp;&nbsp;&nbsp;($reviewlink) ";
637 - return $reviewlink;
 369+
 370+ $action = LogPage::actionText( $s->log_type, $s->log_action, $title, $this->skin, $paramArray, true, true );
 371+ $out = "<li>$time $userLink $action $comment $revert</li>\n";
 372+ return $out;
638373 }
639374
640375 /**
@@ -674,8 +409,6 @@
675410 * @private
676411 */
677412 function getTypeMenu() {
678 - global $wgLogRestrictions, $wgUser;
679 -
680413 $out = "<select name='type'>\n";
681414
682415 $validTypes = LogPage::validTypes();
@@ -693,14 +426,7 @@
694427 // Third pass generates sorted XHTML content
695428 foreach( $m as $text => $type ) {
696429 $selected = ($type == $this->reader->queryType());
697 - // Restricted types
698 - if ( isset($wgLogRestrictions[$type]) ) {
699 - if ( $wgUser->isAllowed( $wgLogRestrictions[$type] ) ) {
700 - $out .= Xml::option( $text, $type, $selected ) . "\n";
701 - }
702 - } else {
703430 $out .= Xml::option( $text, $type, $selected ) . "\n";
704 - }
705431 }
706432
707433 $out .= '</select>';
@@ -758,12 +484,5 @@
759485 }
760486 }
761487
762 -/**
763 - * Aliases for backwards compatibility with 1.6
764 - */
765 -define( 'MW_LOG_DELETED_ACTION', LogViewer::DELETED_ACTION );
766 -define( 'MW_LOG_DELETED_USER', LogViewer::DELETED_USER );
767 -define( 'MW_LOG_DELETED_COMMENT', LogViewer::DELETED_COMMENT );
768 -define( 'MW_LOG_DELETED_RESTRICTED', LogViewer::DELETED_RESTRICTED );
769488
770489 ?>
Index: trunk/phase3/includes/DefaultSettings.php
@@ -169,7 +169,7 @@
170170 * is writable to the web server but is not exposed to the internet.
171171 *
172172 * Set $wgSaveDeletedFiles to true and set up the save path in
173 - * $wgFileStore['deleted']['directory']
 173+ * $wgFileStore['deleted']['directory'].
174174 */
175175 $wgSaveDeletedFiles = false;
176176
@@ -983,7 +983,6 @@
984984 $wgGroupPermissions['sysop']['block'] = true;
985985 $wgGroupPermissions['sysop']['createaccount'] = true;
986986 $wgGroupPermissions['sysop']['delete'] = true;
987 -$wgGroupPermissions['sysop']['browsearchive'] = true; // can see the deleted page list
988987 $wgGroupPermissions['sysop']['deletedhistory'] = true; // can view deleted history entries, but not see or restore the text
989988 $wgGroupPermissions['sysop']['editinterface'] = true;
990989 $wgGroupPermissions['sysop']['import'] = true;
@@ -1006,17 +1005,9 @@
10071006 // Permission to change users' group assignments
10081007 $wgGroupPermissions['bureaucrat']['userrights'] = true;
10091008
1010 -// Experimental permissions to enable revisiondelete:
1011 -
 1009+// Experimental permissions, not ready for production use
10121010 //$wgGroupPermissions['sysop']['deleterevision'] = true;
1013 -//$wgGroupPermissions['sysop']['hideuser'] = true;
1014 -// To see hidden revs
10151011 //$wgGroupPermissions['bureaucrat']['hiderevision'] = true;
1016 -// For private log access
1017 -//$wgGroupPermissions['bureaucrat']['oversight'] = true;
1018 -// Also, we may want titles to be effectively hidden
1019 -//$wgGroupPermissions['sysop']['browsearchive'] = false;
1020 -//$wgGroupPermissions['bureaucrat']['browsearchive'] = true;
10211012
10221013 /**
10231014 * The developer group is deprecated, but can be activated if need be
@@ -2032,20 +2023,9 @@
20332024 'move',
20342025 'import',
20352026 'patrol',
2036 - 'oversight',
20372027 );
20382028
20392029 /**
2040 - * This restricts log access to those who have a certain right
2041 - * Users without this will not see it in the option menu and can not view it
2042 - * Restricted logs are not added to recent changes
2043 - * Logs should remain non-transcludable
2044 - */
2045 -$wgLogRestrictions = array(
2046 -'oversight' => 'oversight'
2047 -);
2048 -
2049 -/**
20502030 * Lists the message key string for each log type. The localized messages
20512031 * will be listed in the user interface.
20522032 *
@@ -2061,7 +2041,6 @@
20622042 'move' => 'movelogpage',
20632043 'import' => 'importlogpage',
20642044 'patrol' => 'patrol-log-page',
2065 - 'oversight' => 'oversightlog',
20662045 );
20672046
20682047 /**
@@ -2080,7 +2059,6 @@
20812060 'move' => 'movelogpagetext',
20822061 'import' => 'importlogpagetext',
20832062 'patrol' => 'patrol-log-header',
2084 - 'oversight' => 'overlogpagetext',
20852063 );
20862064
20872065 /**
@@ -2098,18 +2076,12 @@
20992077 'delete/delete' => 'deletedarticle',
21002078 'delete/restore' => 'undeletedarticle',
21012079 'delete/revision' => 'revdelete-logentry',
2102 - 'delete/event' => 'logdelete-logentry',
21032080 'upload/upload' => 'uploadedimage',
21042081 'upload/revert' => 'uploadedimage',
21052082 'move/move' => '1movedto2',
21062083 'move/move_redir' => '1movedto2_redir',
21072084 'import/upload' => 'import-logentry-upload',
21082085 'import/interwiki' => 'import-logentry-interwiki',
2109 - 'oversight/revision' => 'revdelete-logentry',
2110 - 'oversight/file' => 'revdelete-logentry',
2111 - 'oversight/event' => 'logdelete-logentry',
2112 - 'oversight/delete' => 'deletedarticle',
2113 - 'oversight/block' => 'blocklogentry',
21142086 );
21152087
21162088 /**
Index: trunk/phase3/includes/PageHistory.php
@@ -38,21 +38,7 @@
3939 $this->mTitle =& $article->mTitle;
4040 $this->mNotificationTimestamp = NULL;
4141 $this->mSkin = $wgUser->getSkin();
42 - $this->preCacheMessages();
4342 }
44 -
45 - /**
46 - * As we use the same small set of messages in various methods and that
47 - * they are called often, we call them once and save them in $this->message
48 - */
49 - function preCacheMessages() {
50 - // Precache various messages
51 - if( !isset( $this->message ) ) {
52 - foreach( explode(' ', 'cur last rev-delundel' ) as $msg ) {
53 - $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
54 - }
55 - }
56 - }
5743
5844 /**
5945 * Print the history page for an article.
@@ -201,31 +187,35 @@
202188 $arbitrary = $this->diffButtons( $rev, $firstInList, $counter );
203189 $link = $this->revLink( $rev );
204190
 191+ $user = $this->mSkin->userLink( $rev->getUser(), $rev->getUserText() )
 192+ . $this->mSkin->userToolLinks( $rev->getUser(), $rev->getUserText() );
 193+
205194 $s .= "($curlink) ($lastlink) $arbitrary";
206195
207196 if( $wgUser->isAllowed( 'deleterevision' ) ) {
208197 $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
209198 if( $firstInList ) {
210 - // We don't currently handle well changing the top revision's settings
211 - $del = $this->message['rev-delundel'];
 199+ // We don't currently handle well changing the top revision's settings
 200+ $del = wfMsgHtml( 'rev-delundel' );
212201 } else if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
213202 // If revision was hidden from sysops
214 - $del = $this->message['rev-delundel'];
 203+ $del = wfMsgHtml( 'rev-delundel' );
215204 } else {
216205 $del = $this->mSkin->makeKnownLinkObj( $revdel,
217 - $this->message['rev-delundel'],
 206+ wfMsg( 'rev-delundel' ),
218207 'target=' . urlencode( $this->mTitle->getPrefixedDbkey() ) .
219208 '&oldid=' . urlencode( $rev->getId() ) );
220 - // Bolden oversighted content
221 - if( $rev->isDeleted( Revision::DELETED_RESTRICTED ) )
222 - $del = "<strong>$del</strong>";
223209 }
224 - $s .= " <tt>(<small>$del</small>)</tt> ";
 210+ $s .= " (<small>$del</small>) ";
225211 }
226212
227213 $s .= " $link";
228 - $s .= $this->mSkin->revUserTools( $rev, true);
229 -
 214+ #getUser is safe, but this avoids making the invalid untargeted contribs links
 215+ if( $row->rev_deleted & Revision::DELETED_USER ) {
 216+ $user = '<span class="history-deleted">' . wfMsg('rev-deleted-user') . '</span>';
 217+ }
 218+ $s .= " <span class='history-user'>$user</span>";
 219+
230220 if( $row->rev_minor_edit ) {
231221 $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') );
232222 }
@@ -251,7 +241,7 @@
252242 }
253243 #add blurb about text having been deleted
254244 if( $row->rev_deleted & Revision::DELETED_TEXT ) {
255 - $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
 245+ $s .= ' ' . wfMsgHtml( 'deletedrev' );
256246 }
257247 if( $wgUser->isAllowed( 'rollback' ) && $latest ) {
258248 $s .= ' '.$this->mSkin->generateRollback( $rev );
@@ -279,7 +269,7 @@
280270
281271 /** @todo document */
282272 function curLink( $rev, $latest ) {
283 - $cur = $this->message['cur'];
 273+ $cur = wfMsgExt( 'cur', array( 'escape') );
284274 if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
285275 return $cur;
286276 } else {
@@ -292,7 +282,7 @@
293283
294284 /** @todo document */
295285 function lastLink( $rev, $next, $counter ) {
296 - $last = $this->message['last'];
 286+ $last = wfMsgExt( 'last', array( 'escape' ) );
297287 if ( is_null( $next ) ) {
298288 # Probably no next row
299289 return $last;
Index: trunk/phase3/includes/LogPage.php
@@ -50,15 +50,13 @@
5151 function saveContent() {
5252 if( wfReadOnly() ) return false;
5353
54 - global $wgUser, $wgLogRestrictions;
 54+ global $wgUser;
5555 $fname = 'LogPage::saveContent';
5656
5757 $dbw = wfGetDB( DB_MASTER );
5858 $uid = $wgUser->getID();
5959
6060 $this->timestamp = $now = wfTimestampNow();
61 -
62 - $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
6361 $dbw->insert( 'logging',
6462 array(
6563 'log_type' => $this->type,
@@ -71,15 +69,20 @@
7270 'log_params' => $this->params
7371 ), $fname
7472 );
75 - $newId = $dbw->insertId();
7673
7774 # And update recentchanges
7875 if ( $this->updateRecentChanges ) {
79 - # Don't add private logs to RC!!!
80 - if ( !isset($wgLogRestrictions[$this->type]) || $wgLogRestrictions[$this->type]=='*' ) {
81 - RecentChange::notifyLog( $now, $this->target, $wgUser, $this->actionText, '',
82 - $this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
 76+ $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
 77+ $rcComment = $this->actionText;
 78+ if( '' != $this->comment ) {
 79+ if ($rcComment == '')
 80+ $rcComment = $this->comment;
 81+ else
 82+ $rcComment .= ': ' . $this->comment;
8383 }
 84+
 85+ RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
 86+ $this->type, $this->action, $this->target, $this->comment, $this->params );
8487 }
8588 return true;
8689 }
@@ -119,13 +122,13 @@
120123 */
121124 function logHeader( $type ) {
122125 global $wgLogHeaders;
123 - return wfMsgHtml( $wgLogHeaders[$type] );
 126+ return wfMsg( $wgLogHeaders[$type] );
124127 }
125128
126129 /**
127130 * @static
128131 */
129 - function actionText( $type, $action, $title=NULL, $skin=NULL, $params = array(), $filterWikilinks=false, $translate=false, $forRC=false ) {
 132+ function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) {
130133 global $wgLang, $wgContLang, $wgLogActions;
131134
132135 $key = "$type/$action";
@@ -182,17 +185,12 @@
183186 }
184187 } else {
185188 array_unshift( $params, $titleLink );
186 - // Oversighted blocks show as normal
187 - if ( $translate && ($key == 'block/block' || $key == 'oversight/block') ) {
 189+ if ( $translate && $key == 'block/block' ) {
188190 $params[1] = $wgLang->translateBlockExpiry( $params[1] );
189191 $params[2] = isset( $params[2] )
190192 ? self::formatBlockFlags( $params[2] )
191193 : '';
192194 }
193 - if ( $forRC ) {
194 - $params[1] = $wgLang->translateBlockExpiry( $params[1], true );
195 - $params[2] = isset( $params[2] ) ? str_replace( ",", ", ", self::formatBlockFlags( $params[2] ) ) : '';
196 - }
197195 $rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin );
198196 }
199197 }
@@ -224,7 +222,7 @@
225223 $this->comment = $comment;
226224 $this->params = LogPage::makeParamBlob( $params );
227225
228 - $this->actionText = LogPage::actionText( $this->type, $action, $target, NULL, $params, false, false, true );
 226+ $this->actionText = LogPage::actionText( $this->type, $action, $target, NULL, $params );
229227
230228 return $this->saveContent();
231229 }
Index: trunk/phase3/RELEASE-NOTES
@@ -270,10 +270,6 @@
271271 * (bug 3984) Searching in logs by title%
272272 * (bug 9244) When calling edit page for nonexistent section, generate error inside of just discarding edits, since edit links sometimes go to the wrong place.
273273 * Private logs can now be created using $wgLogRestrictions
274 -* (bug 3576) Revisiondelete completed (RSS feeds checked, carries over delete/undelete)
275 -* Log events, file revisions, archived revisions can be deleted with revisiondelete
276 -* Usernames can be hidden from block log, block list, and user list via blockip. These
277 - blocks are instead logged privately
278274 * Show thumbnail of existing image if image exists already under this filename
279275 * (bug 5546) Watchlist reflects logged actions like move, protection, undelete
280276 * (bug 9019) No warning during upload if image description page exists, but no

Follow-up revisions

RevisionCommit summaryAuthorDate
r20570Reverting SpecialRevisiondelete.php back to r17880, to fix bug 9336 ( "Specia...nickj07:41, 21 March 2007
r20779Fixing a regression (caused by r20473 and then r20525) that the move revert l...rotem17:10, 28 March 2007