Index: trunk/phase3/includes/Article.php |
— | — | @@ -1652,7 +1652,7 @@ |
1653 | 1653 | * @return bool true on success |
1654 | 1654 | */ |
1655 | 1655 | function updateRestrictions( $limit = array(), $reason = '', $cascade = 0, $expiry = null ) { |
1656 | | - global $wgUser, $wgRestrictionTypes, $wgContLang, $wgGroupPermissions; |
| 1656 | + global $wgUser, $wgRestrictionTypes, $wgContLang; |
1657 | 1657 | |
1658 | 1658 | $id = $this->mTitle->getArticleID(); |
1659 | 1659 | if( !$wgUser->isAllowed( 'protect' ) || wfReadOnly() || $id == 0 ) { |
— | — | @@ -1707,11 +1707,6 @@ |
1708 | 1708 | $nullRevision = Revision::newNullRevision( $dbw, $id, $comment, true ); |
1709 | 1709 | $nullRevId = $nullRevision->insertOn( $dbw ); |
1710 | 1710 | |
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 | | - } |
1716 | 1711 | # Update restrictions table |
1717 | 1712 | foreach( $limit as $action => $restrictions ) { |
1718 | 1713 | if ($restrictions != '' ) { |
— | — | @@ -1787,8 +1782,6 @@ |
1788 | 1783 | $confirm = $wgRequest->wasPosted() && |
1789 | 1784 | $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ); |
1790 | 1785 | $reason = $wgRequest->getText( 'wpReason' ); |
1791 | | - # Flag to hide all contents of the archived revisions |
1792 | | - $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed('deleterevision'); |
1793 | 1786 | |
1794 | 1787 | # This code desperately needs to be totally rewritten |
1795 | 1788 | |
— | — | @@ -1820,7 +1813,7 @@ |
1821 | 1814 | } |
1822 | 1815 | |
1823 | 1816 | if( $confirm ) { |
1824 | | - $this->doDelete( $reason, $suppress ); |
| 1817 | + $this->doDelete( $reason ); |
1825 | 1818 | if( $wgRequest->getCheck( 'wpWatch' ) ) { |
1826 | 1819 | $this->doWatch(); |
1827 | 1820 | } elseif( $this->mTitle->userIsWatching() ) { |
— | — | @@ -1966,14 +1959,7 @@ |
1967 | 1960 | $delcom = htmlspecialchars( wfMsg( 'deletecomment' ) ); |
1968 | 1961 | $token = htmlspecialchars( $wgUser->editToken() ); |
1969 | 1962 | $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> </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 | + |
1978 | 1964 | $wgOut->addHTML( " |
1979 | 1965 | <form id='deleteconfirm' method='post' action=\"{$formaction}\"> |
1980 | 1966 | <table border='0'> |
— | — | @@ -1985,7 +1971,6 @@ |
1986 | 1972 | <input type='text' size='60' name='wpReason' id='wpReason' value=\"" . htmlspecialchars( $reason ) . "\" tabindex=\"1\" /> |
1987 | 1973 | </td> |
1988 | 1974 | </tr> |
1989 | | - $supress |
1990 | 1975 | <tr> |
1991 | 1976 | <td> </td> |
1992 | 1977 | <td>$watch</td> |
— | — | @@ -2024,12 +2009,12 @@ |
2025 | 2010 | /** |
2026 | 2011 | * Perform a deletion and output success or failure messages |
2027 | 2012 | */ |
2028 | | - function doDelete( $reason, $suppress = false ) { |
| 2013 | + function doDelete( $reason ) { |
2029 | 2014 | global $wgOut, $wgUser; |
2030 | 2015 | wfDebug( __METHOD__."\n" ); |
2031 | 2016 | |
2032 | 2017 | if (wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason))) { |
2033 | | - if ( $this->doDeleteArticle( $reason, $suppress ) ) { |
| 2018 | + if ( $this->doDeleteArticle( $reason ) ) { |
2034 | 2019 | $deleted = wfEscapeWikiText( $this->mTitle->getPrefixedText() ); |
2035 | 2020 | |
2036 | 2021 | $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); |
— | — | @@ -2052,7 +2037,7 @@ |
2053 | 2038 | * Deletes the article with database consistency, writes logs, purges caches |
2054 | 2039 | * Returns success |
2055 | 2040 | */ |
2056 | | - function doDeleteArticle( $reason, $suppress = false ) { |
| 2041 | + function doDeleteArticle( $reason ) { |
2057 | 2042 | global $wgUseSquid, $wgDeferredUpdateList; |
2058 | 2043 | global $wgUseTrackbacks; |
2059 | 2044 | |
— | — | @@ -2070,17 +2055,6 @@ |
2071 | 2056 | $u = new SiteStatsUpdate( 0, 1, -(int)$this->isCountable( $this->getContent() ), -1 ); |
2072 | 2057 | array_push( $wgDeferredUpdateList, $u ); |
2073 | 2058 | |
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 | | - |
2085 | 2059 | // For now, shunt the revision data into the archive table. |
2086 | 2060 | // Text is *not* removed from the text table; bulk storage |
2087 | 2061 | // is left intact to avoid breaking block-compression or |
— | — | @@ -2104,7 +2078,7 @@ |
2105 | 2079 | 'ar_text_id' => 'rev_text_id', |
2106 | 2080 | 'ar_text' => '\'\'', // Be explicit to appease |
2107 | 2081 | 'ar_flags' => '\'\'', // MySQL's "strict mode"... |
2108 | | - 'ar_deleted' => $bitfield |
| 2082 | + 'ar_len' => 'rev_len' |
2109 | 2083 | ), array( |
2110 | 2084 | 'page_id' => $id, |
2111 | 2085 | 'page_id = rev_page' |
— | — | @@ -2145,9 +2119,8 @@ |
2146 | 2120 | # Clear caches |
2147 | 2121 | Article::onArticleDelete( $this->mTitle ); |
2148 | 2122 | |
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' ); |
2152 | 2125 | $log->addEntry( 'delete', $this->mTitle, $reason ); |
2153 | 2126 | |
2154 | 2127 | # Clear the cached article id so the interface doesn't act like we exist |
— | — | @@ -2253,13 +2226,8 @@ |
2254 | 2227 | ); |
2255 | 2228 | } |
2256 | 2229 | |
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 | | - } |
2263 | 2230 | # Get the edit summary |
| 2231 | + $target = Revision::newFromId( $s->rev_id ); |
2264 | 2232 | $newComment = wfMsgForContent( 'revertpage', $target->getUserText(), $from ); |
2265 | 2233 | $newComment = $wgRequest->getText( 'summary', $newComment ); |
2266 | 2234 | |
— | — | @@ -2437,30 +2405,10 @@ |
2438 | 2406 | ? wfMsg( 'diff' ) |
2439 | 2407 | : $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=next&oldid='.$oldid ); |
2440 | 2408 | |
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() ); |
2461 | 2411 | |
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" . |
2465 | 2413 | "\n\t\t\t\t<div id=\"mw-revision-nav\">" . wfMsg( 'revision-nav', $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff ) . "</div>\n\t\t\t"; |
2466 | 2414 | $wgOut->setSubtitle( $r ); |
2467 | 2415 | } |
Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -25,11 +25,6 @@ |
26 | 26 | * rc_patrolled boolean whether or not someone has marked this edit as patrolled |
27 | 27 | * rc_old_len integer byte length of the text before the edit |
28 | 28 | * 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 |
34 | 29 | * |
35 | 30 | * mExtra: |
36 | 31 | * prefixedDBkey prefixed db key, used by external app via msg queue |
— | — | @@ -232,7 +227,8 @@ |
233 | 228 | |
234 | 229 | # Makes an entry in the database corresponding to an edit |
235 | 230 | /*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) |
237 | 233 | { |
238 | 234 | |
239 | 235 | if ( $bot === 'default' ) { |
— | — | @@ -267,12 +263,7 @@ |
268 | 264 | 'rc_patrolled' => 0, |
269 | 265 | 'rc_new' => 0, # obsolete |
270 | 266 | '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 |
277 | 268 | ); |
278 | 269 | |
279 | 270 | $rc->mExtra = array( |
— | — | @@ -293,7 +284,7 @@ |
294 | 285 | * @static |
295 | 286 | */ |
296 | 287 | public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default", |
297 | | - $ip='', $size=0, $newId=0 ) |
| 288 | + $ip='', $size = 0, $newId = 0 ) |
298 | 289 | { |
299 | 290 | if ( !$ip ) { |
300 | 291 | $ip = wfGetIP(); |
— | — | @@ -301,7 +292,6 @@ |
302 | 293 | $ip = ''; |
303 | 294 | } |
304 | 295 | } |
305 | | - |
306 | 296 | if ( $bot == 'default' ) { |
307 | 297 | $bot = $user->isAllowed( 'bot' ); |
308 | 298 | } |
— | — | @@ -325,14 +315,9 @@ |
326 | 316 | 'rc_moved_to_title' => '', |
327 | 317 | 'rc_ip' => $ip, |
328 | 318 | 'rc_patrolled' => 0, |
329 | | - 'rc_new' => 1, # obsolete |
| 319 | + 'rc_new' => 1, # obsolete |
330 | 320 | '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 |
337 | 322 | ); |
338 | 323 | |
339 | 324 | $rc->mExtra = array( |
— | — | @@ -354,7 +339,7 @@ |
355 | 340 | $ip = ''; |
356 | 341 | } |
357 | 342 | } |
358 | | - |
| 343 | + |
359 | 344 | $rc = new RecentChange; |
360 | 345 | $rc->mAttribs = array( |
361 | 346 | 'rc_timestamp' => $timestamp, |
— | — | @@ -377,11 +362,6 @@ |
378 | 363 | 'rc_patrolled' => 1, |
379 | 364 | 'rc_old_len' => NULL, |
380 | 365 | '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' => '' |
386 | 366 | ); |
387 | 367 | |
388 | 368 | $rc->mExtra = array( |
— | — | @@ -400,14 +380,18 @@ |
401 | 381 | RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, true ); |
402 | 382 | } |
403 | 383 | |
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 ) |
407 | 388 | { |
408 | 389 | if ( !$ip ) { |
409 | 390 | $ip = wfGetIP(); |
410 | | - if ( !$ip ) $ip = ''; |
| 391 | + if ( !$ip ) { |
| 392 | + $ip = ''; |
| 393 | + } |
411 | 394 | } |
| 395 | + |
412 | 396 | $rc = new RecentChange; |
413 | 397 | $rc->mAttribs = array( |
414 | 398 | 'rc_timestamp' => $timestamp, |
— | — | @@ -419,7 +403,7 @@ |
420 | 404 | 'rc_cur_id' => $title->getArticleID(), |
421 | 405 | 'rc_user' => $user->getID(), |
422 | 406 | 'rc_user_text' => $user->getName(), |
423 | | - 'rc_comment' => $logComment, |
| 407 | + 'rc_comment' => $comment, |
424 | 408 | 'rc_this_oldid' => 0, |
425 | 409 | 'rc_last_oldid' => 0, |
426 | 410 | 'rc_bot' => $user->isAllowed( 'bot' ) ? 1 : 0, |
— | — | @@ -430,11 +414,6 @@ |
431 | 415 | 'rc_new' => 0, # obsolete |
432 | 416 | 'rc_old_len' => NULL, |
433 | 417 | '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 |
439 | 418 | ); |
440 | 419 | $rc->mExtra = array( |
441 | 420 | 'prefixedDBkey' => $title->getPrefixedDBkey(), |
— | — | @@ -481,11 +460,6 @@ |
482 | 461 | 'rc_new' => $row->page_is_new, # obsolete |
483 | 462 | 'rc_old_len' => $row->rc_old_len, |
484 | 463 | '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 |
490 | 464 | ); |
491 | 465 | |
492 | 466 | $this->mExtra = array(); |
Index: trunk/phase3/includes/SpecialRecentchanges.php |
— | — | @@ -404,7 +404,7 @@ |
405 | 405 | rcFormatDiff( $obj ), |
406 | 406 | $title->getFullURL(), |
407 | 407 | $obj->rc_timestamp, |
408 | | - ($obj->rc_deleted & Revision::DELETED_USER) ? wfMsgHtml('rev-deleted-user') : $obj->rc_user_text, |
| 408 | + $obj->rc_user_text, |
409 | 409 | $talkpage->getFullURL() |
410 | 410 | ); |
411 | 411 | $feed->outItem( $item ); |
— | — | @@ -613,18 +613,15 @@ |
614 | 614 | return rcFormatDiffRow( $titleObj, |
615 | 615 | $row->rc_last_oldid, $row->rc_this_oldid, |
616 | 616 | $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 ); |
619 | 618 | } |
620 | 619 | |
621 | | -function rcFormatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext='' ) { |
| 620 | +function rcFormatDiffRow( $title, $oldid, $newid, $timestamp, $comment ) { |
622 | 621 | global $wgFeedDiffCutoff, $wgContLang, $wgUser; |
623 | 622 | $fname = 'rcFormatDiff'; |
624 | 623 | wfProfileIn( $fname ); |
625 | 624 | |
626 | 625 | $skin = $wgUser->getSkin(); |
627 | | - # log enties |
628 | | - if( $actiontext ) $comment = "$actiontext $comment"; |
629 | 626 | $completeText = '<p>' . $skin->formatComment( $comment ) . "</p>\n"; |
630 | 627 | |
631 | 628 | if( $title->getNamespace() >= 0 && $title->userCan( 'read' ) ) { |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -508,9 +508,7 @@ |
509 | 509 | $reason = $wgRequest->getVal( 'wpReason' ); |
510 | 510 | $image = $wgRequest->getVal( 'image' ); |
511 | 511 | $oldimage = $wgRequest->getVal( 'oldimage' ); |
512 | | - # Flag to hide all contents of the archived revisions |
513 | | - $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed('deleterevision'); |
514 | | - |
| 512 | + |
515 | 513 | # Only sysops can delete images. Previously ordinary users could delete |
516 | 514 | # old revisions, but this is no longer the case. |
517 | 515 | if ( !$wgUser->isAllowed('delete') ) { |
— | — | @@ -538,7 +536,7 @@ |
539 | 537 | # Deleting old images doesn't require confirmation |
540 | 538 | if ( !is_null( $oldimage ) || $confirm ) { |
541 | 539 | if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) { |
542 | | - $this->doDelete( $reason, $suppress ); |
| 540 | + $this->doDelete( $reason ); |
543 | 541 | } else { |
544 | 542 | $wgOut->showFatalError( wfMsg( 'sessionfailure' ) ); |
545 | 543 | } |
— | — | @@ -559,7 +557,7 @@ |
560 | 558 | * Delete an image. |
561 | 559 | * @param $reason User provided reason for deletion. |
562 | 560 | */ |
563 | | - function doDelete( $reason, $suppress=false ) { |
| 561 | + function doDelete( $reason ) { |
564 | 562 | global $wgOut, $wgRequest; |
565 | 563 | |
566 | 564 | $oldimage = $wgRequest->getVal( 'oldimage' ); |
— | — | @@ -573,12 +571,12 @@ |
574 | 572 | $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) ); |
575 | 573 | return; |
576 | 574 | } |
577 | | - if ( !$this->doDeleteOldImage( $oldimage, $suppress ) ) { |
| 575 | + if ( !$this->doDeleteOldImage( $oldimage ) ) { |
578 | 576 | return; |
579 | 577 | } |
580 | 578 | $deleted = $oldimage; |
581 | 579 | } else { |
582 | | - $ok = $this->img->delete( $reason, $suppress ); |
| 580 | + $ok = $this->img->delete( $reason ); |
583 | 581 | if( !$ok ) { |
584 | 582 | # If the deletion operation actually failed, bug out: |
585 | 583 | $wgOut->showFileDeleteError( $this->img->getName() ); |
— | — | @@ -589,7 +587,7 @@ |
590 | 588 | # Now we remove the image description page. |
591 | 589 | |
592 | 590 | $article = new Article( $this->mTitle ); |
593 | | - $article->doDeleteArticle( $reason, $suppress ); # ignore errors |
| 591 | + $article->doDeleteArticle( $reason ); # ignore errors |
594 | 592 | |
595 | 593 | $deleted = $this->img->getName(); |
596 | 594 | } |
— | — | @@ -608,11 +606,11 @@ |
609 | 607 | /** |
610 | 608 | * @return success |
611 | 609 | */ |
612 | | - function doDeleteOldImage( $oldimage, $suppress=false ) |
| 610 | + function doDeleteOldImage( $oldimage ) |
613 | 611 | { |
614 | 612 | global $wgOut; |
615 | 613 | |
616 | | - $ok = $this->img->deleteOld( $oldimage, '', $suppress ); |
| 614 | + $ok = $this->img->deleteOld( $oldimage, '' ); |
617 | 615 | if( !$ok ) { |
618 | 616 | # If we actually have a file and can't delete it, throw an error. |
619 | 617 | # Something went awry... |
Index: trunk/phase3/includes/SpecialRevisiondelete.php |
— | — | @@ -2,41 +2,36 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * 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; |
7 | 11 | */ |
8 | 12 | |
9 | 13 | function wfSpecialRevisiondelete( $par = null ) { |
10 | 14 | global $wgOut, $wgRequest; |
11 | 15 | |
12 | | - $target = $wgRequest->getText( 'target' ); |
13 | | - // handle our many different possible input types |
| 16 | + $target = $wgRequest->getVal( 'target' ); |
14 | 17 | $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 | + |
20 | 21 | if( is_null( $page ) ) { |
21 | 22 | $wgOut->showErrorPage( 'notargettitle', 'notargettext' ); |
22 | 23 | return; |
23 | 24 | } |
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 ) ) { |
28 | 27 | $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
29 | 28 | return; |
30 | 29 | } |
31 | 30 | |
32 | | - $form = new RevisionDeleteForm( $wgRequest, $oldid, $logid, $arid, $fileid ); |
| 31 | + $form = new RevisionDeleteForm( $wgRequest ); |
33 | 32 | if( $wgRequest->wasPosted() ) { |
34 | 33 | $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 ); |
41 | 36 | } |
42 | 37 | } |
43 | 38 | |
— | — | @@ -199,7 +194,7 @@ |
200 | 195 | $bitfields = 0; |
201 | 196 | $wgOut->addHtml( "<ul>" ); |
202 | 197 | foreach( $this->files as $fileid ) { |
203 | | - $file = new ArchivedFile( $this->page, $fileid ); |
| 198 | + $file = new FSarchivedFile( $this->page, $fileid ); |
204 | 199 | if( !isset( $file->mId ) ) { |
205 | 200 | $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
206 | 201 | return; |
— | — | @@ -307,11 +302,10 @@ |
308 | 303 | null ) ); |
309 | 304 | |
310 | 305 | $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 |
312 | 306 | foreach( $this->checks as $item ) { |
313 | 307 | list( $message, $name, $field ) = $item; |
314 | 308 | $wgOut->addHtml( '<div>' . |
315 | | - wfCheckLabel( wfMsgHtml( $message), $name, $name, $bitfields & $field ) . |
| 309 | + wfCheckLabel( wfMsg( $message), $name, $name, $rev->isDeleted( $field ) ) . |
316 | 310 | '</div>' ); |
317 | 311 | } |
318 | 312 | $wgOut->addHtml( '</fieldset>' ); |
— | — | @@ -332,136 +326,32 @@ |
333 | 327 | function historyLine( $rev ) { |
334 | 328 | global $wgContLang; |
335 | 329 | $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×tamp=" . $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 | | - |
356 | 330 | 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>"; |
358 | 338 | } |
359 | 339 | |
360 | 340 | /** |
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 | | - /** |
416 | 341 | * @param WebRequest $request |
417 | 342 | */ |
418 | 343 | function submit( $request ) { |
419 | 344 | $bitfield = $this->extractBitfield( $request ); |
420 | 345 | $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 | + } |
434 | 351 | } |
435 | 352 | |
436 | 353 | function success( $request ) { |
437 | 354 | 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' ); |
466 | 356 | } |
467 | 357 | |
468 | 358 | /** |
— | — | @@ -480,19 +370,10 @@ |
481 | 371 | return $bitfield; |
482 | 372 | } |
483 | 373 | |
484 | | - function save( $bitfield, $reason, $title ) { |
| 374 | + function save( $bitfield, $reason ) { |
485 | 375 | $dbw = wfGetDB( DB_MASTER ); |
486 | 376 | $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 ); |
497 | 378 | } |
498 | 379 | } |
499 | 380 | |
— | — | @@ -503,192 +384,42 @@ |
504 | 385 | } |
505 | 386 | |
506 | 387 | /** |
507 | | - * @param $title, the page these events apply to |
508 | 388 | * @param array $items list of revision ID numbers |
509 | 389 | * @param int $bitfield new rev_deleted value |
510 | 390 | * @param string $comment Comment for log records |
511 | 391 | */ |
512 | | - function setRevVisibility( $title, $items, $bitfield, $comment ) { |
513 | | - global $wgOut; |
| 392 | + function setVisibility( $items, $bitfield, $comment ) { |
| 393 | + $pages = array(); |
514 | 394 | |
515 | | - $UserAllowedAll = true; |
516 | | - $pages_count = array(); $pages_revIds = array(); |
517 | 395 | // To work! |
518 | 396 | 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 ) ) { |
521 | 399 | return false; |
522 | | - } else if( !$rev->userCan(Revision::DELETED_RESTRICTED) ) { |
523 | | - $UserAllowedAll=false; |
524 | | - continue; |
525 | 400 | } |
526 | | - $pageid = $rev->getPage(); |
| 401 | + $this->updateRevision( $rev, $bitfield ); |
| 402 | + $this->updateRecentChanges( $rev, $bitfield ); |
| 403 | + |
527 | 404 | // 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; |
531 | 410 | } |
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 | | - } |
540 | 411 | } |
541 | 412 | |
542 | 413 | // 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 ); |
550 | 418 | } |
551 | | - // Where all revs allowed to be set? |
552 | | - if ( !$UserAllowedAll ) { |
553 | | - //FIXME: still might be confusing??? |
554 | | - $wgOut->permissionRequired( 'hiderevision' ); return false; |
555 | | - } |
556 | 419 | |
557 | 420 | return true; |
558 | 421 | } |
559 | 422 | |
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 | | - |
641 | 423 | /** |
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 | | - /** |
693 | 424 | * Update the revision's rev_deleted field |
694 | 425 | * @param Revision $rev |
695 | 426 | * @param int $bitfield new rev_deleted bitfield value |
— | — | @@ -701,65 +432,19 @@ |
702 | 433 | } |
703 | 434 | |
704 | 435 | /** |
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 | | - /** |
741 | 436 | * 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 |
755 | 437 | * @param Revision $rev |
756 | 438 | * @param int $bitfield new rev_deleted bitfield value |
757 | 439 | */ |
758 | | - function updateRecentChangesEdits( $rev, $bitfield ) { |
| 440 | + function updateRecentChanges( $rev, $bitfield ) { |
759 | 441 | $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' ); |
764 | 449 | } |
765 | 450 | |
766 | 451 | /** |
— | — | @@ -779,25 +464,11 @@ |
780 | 465 | * @param int $bitfield the new rev_deleted value |
781 | 466 | * @param string $comment |
782 | 467 | */ |
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 ); |
802 | 473 | } |
803 | 474 | } |
804 | 475 | |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -830,13 +830,10 @@ |
831 | 831 | /** |
832 | 832 | * Generate a user link if the current user is allowed to view it |
833 | 833 | * @param $rev Revision object. |
834 | | - * @param $isPublic, bool, show only if all users can see it |
835 | 834 | * @return string HTML |
836 | 835 | */ |
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 ) ) { |
841 | 838 | $link = $this->userLink( $rev->getRawUser(), $rev->getRawUserText() ); |
842 | 839 | } else { |
843 | 840 | $link = wfMsgHtml( 'rev-deleted-user' ); |
— | — | @@ -846,122 +843,27 @@ |
847 | 844 | } |
848 | 845 | return $link; |
849 | 846 | } |
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 | | - } |
875 | 847 | |
876 | 848 | /** |
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 | | - /** |
897 | 849 | * Generate a user tool link cluster if the current user is allowed to view it |
898 | 850 | * @param $rev Revision object. |
899 | | - * @param $isPublic, bool, show only if all users can see it |
900 | 851 | * @return string HTML |
901 | 852 | */ |
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 ) ) { |
906 | 855 | $link = $this->userLink( $rev->getRawUser(), $rev->getRawUserText() ) . |
907 | | - ' ' . $this->userToolLinks( $rev->getRawUser(), $rev->getRawUserText() ); |
| 856 | + ' ' . |
| 857 | + $this->userToolLinks( $rev->getRawUser(), $rev->getRawUserText() ); |
908 | 858 | } else { |
909 | 859 | $link = wfMsgHtml( 'rev-deleted-user' ); |
910 | 860 | } |
911 | 861 | 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 ) ) { |
939 | 862 | return '<span class="history-deleted">' . $link . '</span>'; |
940 | 863 | } |
941 | 864 | return $link; |
942 | 865 | } |
943 | | - |
| 866 | + |
944 | 867 | /** |
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 | | - /** |
966 | 868 | * This function is called by all recent changes variants, by the page history, |
967 | 869 | * and by the user contributions list. It is responsible for formatting edit |
968 | 870 | * comments. It escapes any HTML in the comment, but adds some CSS to format |
— | — | @@ -1083,65 +985,21 @@ |
1084 | 986 | * |
1085 | 987 | * @param Revision $rev |
1086 | 988 | * @param bool $local Whether section links should refer to local page |
1087 | | - * @param $isPublic, show only if all users can see it |
1088 | 989 | * @return string HTML |
1089 | 990 | */ |
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 ) ) { |
1094 | 993 | $block = $this->commentBlock( $rev->getRawComment(), $rev->getTitle(), $local ); |
1095 | 994 | } else { |
1096 | | - $block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>"; |
| 995 | + $block = " <span class=\"comment\">" . |
| 996 | + wfMsgHtml( 'rev-deleted-comment' ) . "</span>"; |
1097 | 997 | } |
1098 | 998 | if( $rev->isDeleted( Revision::DELETED_COMMENT ) ) { |
1099 | 999 | return " <span class=\"history-deleted\">$block</span>"; |
1100 | 1000 | } |
1101 | 1001 | return $block; |
1102 | 1002 | } |
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 | | - } |
1124 | 1003 | |
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 | | - |
1146 | 1004 | /** @todo document */ |
1147 | 1005 | function tocIndent() { |
1148 | 1006 | return "\n<ul>"; |
Index: trunk/phase3/includes/Export.php |
— | — | @@ -139,10 +139,7 @@ |
140 | 140 | $fname = "do_list_authors" ; |
141 | 141 | wfProfileIn( $fname ); |
142 | 142 | $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 ; |
147 | 144 | $result = $this->db->query( $sql, $fname ); |
148 | 145 | $resultset = $this->db->resultObject( $result ); |
149 | 146 | while( $row = $resultset->fetchObject() ) { |
Index: trunk/phase3/includes/SpecialBlockip.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | var $BlockAddress, $BlockExpiry, $BlockReason; |
47 | 47 | |
48 | 48 | function IPBlockForm( $par ) { |
49 | | - global $wgRequest, $wgUser; |
| 49 | + global $wgRequest; |
50 | 50 | |
51 | 51 | $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) ); |
52 | 52 | $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' ); |
— | — | @@ -59,8 +59,6 @@ |
60 | 60 | $this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', $byDefault ); |
61 | 61 | $this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', $byDefault ); |
62 | 62 | $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' ); |
65 | 63 | } |
66 | 64 | |
67 | 65 | function showForm( $err ) { |
— | — | @@ -133,7 +131,6 @@ |
134 | 132 | </td> |
135 | 133 | "); |
136 | 134 | } |
137 | | - |
138 | 135 | $wgOut->addHTML(" |
139 | 136 | </tr> |
140 | 137 | <tr id='wpBlockOther'> |
— | — | @@ -153,46 +150,31 @@ |
154 | 151 | <tr id='wpAnonOnlyRow'> |
155 | 152 | <td> </td> |
156 | 153 | <td align=\"left\"> |
157 | | - " . wfCheckLabel( wfMsgHtml( 'ipbanononly' ), |
| 154 | + " . wfCheckLabel( wfMsg( 'ipbanononly' ), |
158 | 155 | 'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly, |
159 | | - array( 'tabindex' => '4' ) ) . " |
| 156 | + array( 'tabindex' => 4 ) ) . " |
160 | 157 | </td> |
161 | 158 | </tr> |
162 | 159 | <tr id='wpCreateAccountRow'> |
163 | 160 | <td> </td> |
164 | 161 | <td align=\"left\"> |
165 | | - " . wfCheckLabel( wfMsgHtml( 'ipbcreateaccount' ), |
| 162 | + " . wfCheckLabel( wfMsg( 'ipbcreateaccount' ), |
166 | 163 | 'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount, |
167 | | - array( 'tabindex' => '5' ) ) . " |
| 164 | + array( 'tabindex' => 5 ) ) . " |
168 | 165 | </td> |
169 | 166 | </tr> |
170 | 167 | <tr id='wpEnableAutoblockRow'> |
171 | 168 | <td> </td> |
172 | 169 | <td align=\"left\"> |
173 | | - " . wfCheckLabel( wfMsgHtml( 'ipbenableautoblock' ), |
| 170 | + " . wfCheckLabel( wfMsg( 'ipbenableautoblock' ), |
174 | 171 | 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock, |
175 | | - array( 'tabindex' => '6' ) ) . " |
| 172 | + array( 'tabindex' => 6 ) ) . " |
176 | 173 | </td> |
177 | 174 | </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> </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(" |
193 | 175 | <tr> |
194 | 176 | <td style='padding-top: 1em'> </td> |
195 | 177 | <td style='padding-top: 1em' align=\"left\"> |
196 | | - " . Xml::submitButton( wfMsgHtml( 'ipbsubmit' ), |
| 178 | + " . Xml::submitButton( wfMsg( 'ipbsubmit' ), |
197 | 179 | array( 'name' => 'wpBlock', 'tabindex' => '7' ) ) . " |
198 | 180 | </td> |
199 | 181 | </tr> |
— | — | @@ -301,7 +283,7 @@ |
302 | 284 | |
303 | 285 | $block = new Block( $this->BlockAddress, $userId, $wgUser->getID(), |
304 | 286 | $this->BlockReason, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly, |
305 | | - $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName); |
| 287 | + $this->BlockCreateAccount, $this->BlockEnableAutoblock ); |
306 | 288 | |
307 | 289 | if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) { |
308 | 290 | |
— | — | @@ -318,9 +300,8 @@ |
319 | 301 | $logParams[] = $expirestr; |
320 | 302 | $logParams[] = $this->blockLogFlags(); |
321 | 303 | |
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' ); |
325 | 306 | $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ), |
326 | 307 | $this->BlockReason, $logParams ); |
327 | 308 | |
Index: trunk/phase3/includes/ChangesList.php |
— | — | @@ -12,11 +12,10 @@ |
13 | 13 | class RCCacheEntry extends RecentChange |
14 | 14 | { |
15 | 15 | var $secureName, $link; |
16 | | - var $curlinks, $difflink, $lastlink , $usertalklink , $versionlink ; |
| 16 | + var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ; |
17 | 17 | var $userlink, $timestamp, $watched; |
18 | 18 | |
19 | | - function newFromParent( $rc ) |
20 | | - { |
| 19 | + function newFromParent( $rc ) { |
21 | 20 | $rc2 = new RCCacheEntry; |
22 | 21 | $rc2->mAttribs = $rc->mAttribs; |
23 | 22 | $rc2->mExtra = $rc->mExtra; |
— | — | @@ -25,7 +24,6 @@ |
26 | 25 | } ; |
27 | 26 | |
28 | 27 | /** |
29 | | - * @package MediaWiki |
30 | 28 | */ |
31 | 29 | class ChangesList { |
32 | 30 | # Called by history lists and recent changes |
— | — | @@ -79,7 +77,7 @@ |
80 | 78 | : $nothing; |
81 | 79 | $f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing; |
82 | 80 | $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing; |
83 | | - return "<tt>$f</tt>"; |
| 81 | + return $f; |
84 | 82 | } |
85 | 83 | |
86 | 84 | /** |
— | — | @@ -105,32 +103,6 @@ |
106 | 104 | } |
107 | 105 | } |
108 | 106 | |
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 | | - } |
135 | 107 | |
136 | 108 | function insertMove( &$s, $rc ) { |
137 | 109 | # Diff |
— | — | @@ -166,12 +138,11 @@ |
167 | 139 | $s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')'; |
168 | 140 | } |
169 | 141 | |
| 142 | + |
170 | 143 | function insertDiffHist(&$s, &$rc, $unpatrolled) { |
171 | 144 | # Diff link |
172 | | - if( !$this->userCan($rc,Revision::DELETED_TEXT) ) { |
| 145 | + if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) { |
173 | 146 | $diffLink = $this->message['diff']; |
174 | | - } else if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG) { |
175 | | - $diffLink = $this->message['diff']; |
176 | 147 | } else { |
177 | 148 | $rcidparam = $unpatrolled |
178 | 149 | ? array( 'rcid' => $rc->mAttribs['rc_id'] ) |
— | — | @@ -201,12 +172,7 @@ |
202 | 173 | $params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW ) |
203 | 174 | ? 'rcid='.$rc->mAttribs['rc_id'] |
204 | 175 | : ''; |
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 ); |
211 | 177 | if($watched) $articlelink = '<strong>'.$articlelink.'</strong>'; |
212 | 178 | global $wgContLang; |
213 | 179 | $articlelink .= $wgContLang->getDirMark(); |
— | — | @@ -222,37 +188,15 @@ |
223 | 189 | |
224 | 190 | /** Insert links to user page, user talk page and eventually a blocking link */ |
225 | 191 | 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'] ); |
232 | 194 | } |
233 | 195 | |
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 | | - |
247 | 196 | /** insert a formatted comment */ |
248 | 197 | function insertComment(&$s, &$rc) { |
249 | 198 | # Add comment |
250 | 199 | 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() ); |
257 | 201 | } |
258 | 202 | } |
259 | 203 | |
— | — | @@ -308,23 +252,19 @@ |
309 | 253 | |
310 | 254 | $s .= '<li>'; |
311 | 255 | |
312 | | - // Moved pages |
| 256 | + // moved pages |
313 | 257 | if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { |
314 | 258 | $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 ) { |
317 | 261 | list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title ); |
318 | 262 | if ( $specialName == 'Log' ) { |
319 | 263 | $this->insertLog( $s, $rc->getTitle(), $specialSubpage ); |
320 | 264 | } else { |
321 | 265 | wfDebug( "Unexpected special page in recentchanges\n" ); |
322 | 266 | } |
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 { |
329 | 269 | wfProfileIn($fname.'-page'); |
330 | 270 | |
331 | 271 | $this->insertDiffHist($s, $rc, $unpatrolled); |
— | — | @@ -345,16 +285,10 @@ |
346 | 286 | } |
347 | 287 | |
348 | 288 | $this->insertUserRelatedLinks($s,$rc); |
349 | | - $this->insertAction($s, $rc); |
350 | 289 | $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 | | - } |
358 | 290 | |
| 291 | + $s .= rtrim(' ' . $this->numberofWatchingusers($rc->numberofWatchingusers)); |
| 292 | + |
359 | 293 | $s .= "</li>\n"; |
360 | 294 | |
361 | 295 | wfProfileOut( $fname.'-rest' ); |
— | — | @@ -401,14 +335,12 @@ |
402 | 336 | $rc->unpatrolled = false; |
403 | 337 | } |
404 | 338 | |
405 | | - $showrev=true; |
406 | 339 | # Make article link |
407 | 340 | if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { |
408 | 341 | $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir"; |
409 | 342 | $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ), |
410 | 343 | $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 ) { |
413 | 345 | list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title ); |
414 | 346 | if ( $specialName == 'Log' ) { |
415 | 347 | # Log updates, etc |
— | — | @@ -418,16 +350,7 @@ |
419 | 351 | wfDebug( "Unexpected special page in recentchanges\n" ); |
420 | 352 | $clink = ''; |
421 | 353 | } |
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 ) { |
432 | 355 | # Unpatrolled new page, give rc_id in query |
433 | 356 | $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" ); |
434 | 357 | } else { |
— | — | @@ -450,10 +373,7 @@ |
451 | 374 | $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery"; |
452 | 375 | $aprops = ' tabindex="'.$baseRC->counter.'"'; |
453 | 376 | $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 ) { |
458 | 378 | if( $rc_type != RC_NEW ) { |
459 | 379 | $curLink = $this->message['cur']; |
460 | 380 | } |
— | — | @@ -463,27 +383,21 @@ |
464 | 384 | } |
465 | 385 | |
466 | 386 | # 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 ) { |
470 | 388 | $lastLink = $this->message['last']; |
471 | 389 | } else { |
472 | 390 | $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 ); |
474 | 392 | } |
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 | | - } |
483 | 393 | |
| 394 | + $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text ); |
| 395 | + |
484 | 396 | $rc->lastlink = $lastLink; |
485 | 397 | $rc->curlink = $curLink; |
486 | 398 | $rc->difflink = $diffLink; |
487 | 399 | |
| 400 | + $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text ); |
| 401 | + |
488 | 402 | # Put accumulated information into the cache, for later display |
489 | 403 | # Page moves go on their own line |
490 | 404 | $title = $rc->getTitle(); |
— | — | @@ -505,11 +419,10 @@ |
506 | 420 | */ |
507 | 421 | function recentChangesBlockGroup( $block ) { |
508 | 422 | global $wgLang, $wgContLang, $wgRCShowChangedSize; |
509 | | - $r = '<table cellpadding="0" cellspacing="0"><tr>'; |
| 423 | + $r = ''; |
510 | 424 | |
511 | 425 | # Collate list of users |
512 | 426 | $isnew = false; |
513 | | - $namehidden = true; |
514 | 427 | $unpatrolled = false; |
515 | 428 | $userlinks = array(); |
516 | 429 | foreach( $block as $rcObj ) { |
— | — | @@ -517,11 +430,6 @@ |
518 | 431 | if( $rcObj->mAttribs['rc_new'] ) { |
519 | 432 | $isnew = true; |
520 | 433 | } |
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 | | - } |
526 | 434 | $u = $rcObj->userlink; |
527 | 435 | if( !isset( $userlinks[$u] ) ) { |
528 | 436 | $userlinks[$u] = 0; |
— | — | @@ -555,25 +463,24 @@ |
556 | 464 | $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')"; |
557 | 465 | $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>'; |
558 | 466 | $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>'; |
559 | | - $r .= '<td valign="top">'.$tl; |
| 467 | + $r .= $tl; |
560 | 468 | |
561 | 469 | # Main line |
562 | | - $r .= ' '.$this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot ); |
| 470 | + $r .= '<tt>'; |
| 471 | + $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot ); |
563 | 472 | |
564 | 473 | # Timestamp |
565 | | - $r .= ' '.$block[0]->timestamp.' </td><td>'; |
| 474 | + $r .= ' '.$block[0]->timestamp.' </tt>'; |
566 | 475 | |
567 | 476 | # 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 ); |
572 | 478 | $r .= $wgContLang->getDirMark(); |
573 | 479 | |
574 | 480 | $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id']; |
575 | 481 | $currentRevision = $block[0]->mAttribs['rc_this_oldid']; |
576 | 482 | if( $block[0]->mAttribs['rc_type'] != RC_LOG ) { |
577 | 483 | # Changes |
| 484 | + |
578 | 485 | $n = count($block); |
579 | 486 | static $nchanges = array(); |
580 | 487 | if ( !isset( $nchanges[$n] ) ) { |
— | — | @@ -583,95 +490,77 @@ |
584 | 491 | |
585 | 492 | $r .= ' ('; |
586 | 493 | |
587 | | - if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) { |
588 | | - $r .= $nchanges[$n]; |
589 | | - } else if( $isnew ) { |
| 494 | + if( $isnew ) { |
590 | 495 | $r .= $nchanges[$n]; |
591 | 496 | } else { |
592 | 497 | $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(), |
593 | 498 | $nchanges[$n], $curIdEq."&diff=$currentRevision&oldid=$oldid" ); |
594 | 499 | } |
595 | 500 | |
| 501 | + $r .= ') . . '; |
| 502 | + |
596 | 503 | # Character difference |
597 | 504 | $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'], |
598 | 505 | $block[0]->mAttribs['rc_new_len'] ); |
599 | 506 | if( $chardiff == '' ) { |
600 | | - $r .= '; '; |
| 507 | + $r .= ' ('; |
601 | 508 | } else { |
602 | | - $r .= '; ' . $chardiff . ' '; |
| 509 | + $r .= ' ' . $chardiff. ' . . ('; |
603 | 510 | } |
| 511 | + |
604 | 512 | |
605 | 513 | # 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' ); |
608 | 516 | $r .= ')'; |
609 | 517 | } |
610 | 518 | |
611 | 519 | $r .= $users; |
612 | | - $r .=$this->numberofWatchingusers($block[0]->numberofWatchingusers); |
613 | | - |
614 | | - $r .= "</td></tr></table>\n"; |
615 | 520 | |
| 521 | + $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers); |
| 522 | + $r .= "<br />\n"; |
| 523 | + |
616 | 524 | # 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">'; |
618 | 526 | foreach( $block as $rcObj ) { |
619 | 527 | # Get rc_xxxx variables |
620 | 528 | // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. |
621 | 529 | extract( $rcObj->mAttribs ); |
622 | 530 | |
623 | | - #$r .= '<tr><td valign="top">'.$this->spacerArrow(); |
624 | | - $r .= '<tr><td valign="top">'.$this->spacerIndent(); |
625 | | - $r .= ' '; |
| 531 | + $r .= $this->spacerArrow(); |
| 532 | + $r .= '<tt> '; |
626 | 533 | $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); |
627 | | - $r .= ' </td><td valign="top">'; |
| 534 | + $r .= ' </tt>'; |
628 | 535 | |
629 | 536 | $o = ''; |
630 | 537 | if( $rc_this_oldid != 0 ) { |
631 | 538 | $o = 'oldid='.$rc_this_oldid; |
632 | 539 | } |
633 | | - # Revision link |
634 | 540 | 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; |
638 | 542 | } else { |
639 | 543 | $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> '; |
642 | 544 | } |
| 545 | + $link = '<tt>'.$link.'</tt>'; |
| 546 | + |
643 | 547 | $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 .= ') . . '; |
657 | 553 | |
658 | 554 | # Character diff |
659 | 555 | if( $wgRCShowChangedSize ) { |
660 | 556 | $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ; |
661 | 557 | } |
662 | | - # User links |
| 558 | + |
663 | 559 | $r .= $rcObj->userlink; |
664 | 560 | $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"; |
674 | 563 | } |
675 | | - $r .= "</table></div>\n"; |
| 564 | + $r .= "</div>\n"; |
676 | 565 | |
677 | 566 | $this->rcCacheIndex++; |
678 | 567 | return $r; |
— | — | @@ -728,23 +617,8 @@ |
729 | 618 | * @access private |
730 | 619 | */ |
731 | 620 | function spacerArrow() { |
732 | | - //FIXME: problems with FF 1.5x |
733 | 621 | return $this->arrow( '', ' ' ); |
734 | 622 | } |
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 ' '; |
748 | | - } |
749 | 623 | |
750 | 624 | /** |
751 | 625 | * Enhanced RC ungrouped line. |
— | — | @@ -758,64 +632,46 @@ |
759 | 633 | extract( $rcObj->mAttribs ); |
760 | 634 | $curIdEq = 'curid='.$rc_cur_id; |
761 | 635 | |
762 | | - $r = '<table cellspacing="0" cellpadding="0"><tr><td>'; |
| 636 | + $r = ''; |
763 | 637 | |
764 | | - # spacerArrow() causes issues in FF |
765 | | - $r .= $this->spacerColumn(); |
766 | | - $r .= '<td valign="top">'; |
767 | | - |
| 638 | + # Spacer image |
| 639 | + $r .= $this->spacerArrow(); |
| 640 | + |
768 | 641 | # Flag and Timestamp |
| 642 | + $r .= '<tt>'; |
| 643 | + |
769 | 644 | if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { |
770 | | - $r .= ' '; |
| 645 | + $r .= ' '; |
771 | 646 | } else { |
772 | | - $r .= ' '.$this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); |
| 647 | + $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); |
773 | 648 | } |
774 | | - $r .= ' '.$rcObj->timestamp.' </td><td>'; |
775 | | - |
| 649 | + $r .= ' '.$rcObj->timestamp.' </tt>'; |
| 650 | + |
776 | 651 | # 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 | + |
793 | 660 | # Character diff |
794 | 661 | if( $wgRCShowChangedSize ) { |
795 | 662 | $r .= ( $rcObj->getCharacterDifference() == '' ? '' : ' ' . $rcObj->getCharacterDifference() . ' . . ' ) ; |
796 | 663 | } |
797 | 664 | |
798 | 665 | # User/talk |
799 | | - $r .= ' '.$rcObj->userlink . $rcObj->usertalklink; |
| 666 | + $r .= $rcObj->userlink . $rcObj->usertalklink; |
800 | 667 | |
801 | 668 | # Comment |
802 | 669 | 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() ); |
815 | 671 | } |
816 | 672 | |
817 | 673 | $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers); |
818 | 674 | |
819 | | - $r .= "</td></tr></table>\n"; |
| 675 | + $r .= "<br />\n"; |
820 | 676 | return $r; |
821 | 677 | } |
822 | 678 | |
Index: trunk/phase3/includes/SpecialUndelete.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | function listRevisions() { |
101 | 101 | $dbr = wfGetDB( DB_SLAVE ); |
102 | 102 | $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' ), |
104 | 104 | array( 'ar_namespace' => $this->title->getNamespace(), |
105 | 105 | 'ar_title' => $this->title->getDBkey() ), |
106 | 106 | 'PageArchive::listRevisions', |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | * @return ResultWrapper |
118 | 118 | * @fixme Does this belong in Image for fuller encapsulation? |
119 | 119 | */ |
120 | | - function listFiles() { |
| 120 | + function listFiles() { |
121 | 121 | if( $this->title->getNamespace() == NS_IMAGE ) { |
122 | 122 | $dbr = wfGetDB( DB_SLAVE ); |
123 | 123 | $res = $dbr->select( 'filearchive', |
— | — | @@ -130,8 +130,7 @@ |
131 | 131 | 'fa_description', |
132 | 132 | 'fa_user', |
133 | 133 | 'fa_user_text', |
134 | | - 'fa_timestamp', |
135 | | - 'fa_deleted' ), |
| 134 | + 'fa_timestamp' ), |
136 | 135 | array( 'fa_name' => $this->title->getDbKey() ), |
137 | 136 | __METHOD__, |
138 | 137 | array( 'ORDER BY' => 'fa_timestamp DESC' ) ); |
— | — | @@ -152,25 +151,14 @@ |
153 | 152 | $rev = $this->getRevision( $timestamp ); |
154 | 153 | return $rev ? $rev->getText() : null; |
155 | 154 | } |
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 | | - } |
167 | 155 | |
168 | 156 | /** |
169 | 157 | * 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 |
172 | 160 | * @return Revision |
173 | 161 | */ |
174 | | - function getRevision( $timestamp, $id=null ) { |
| 162 | + function getRevision( $timestamp ) { |
175 | 163 | $dbr = wfGetDB( DB_SLAVE ); |
176 | 164 | $row = $dbr->selectRow( 'archive', |
177 | 165 | array( |
— | — | @@ -183,11 +171,10 @@ |
184 | 172 | 'ar_minor_edit', |
185 | 173 | 'ar_flags', |
186 | 174 | 'ar_text_id', |
187 | | - 'ar_deleted', |
188 | 175 | 'ar_len' ), |
189 | 176 | array( 'ar_namespace' => $this->title->getNamespace(), |
190 | 177 | 'ar_title' => $this->title->getDbkey(), |
191 | | - $this->getRevisionConds( $dbr->timestamp($timestamp), $id ) ), |
| 178 | + 'ar_timestamp' => $dbr->timestamp( $timestamp ) ), |
192 | 179 | __METHOD__ ); |
193 | 180 | if( $row ) { |
194 | 181 | return new Revision( array( |
— | — | @@ -201,9 +188,7 @@ |
202 | 189 | 'user_text' => $row->ar_user_text, |
203 | 190 | 'timestamp' => $row->ar_timestamp, |
204 | 191 | '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 ) ); |
208 | 193 | } else { |
209 | 194 | return null; |
210 | 195 | } |
— | — | @@ -275,7 +260,7 @@ |
276 | 261 | * |
277 | 262 | * @return true on success. |
278 | 263 | */ |
279 | | - function undelete( $timestamps, $comment = '', $fileVersions = array(), $Unsuppress = false) { |
| 264 | + function undelete( $timestamps, $comment = '', $fileVersions = array() ) { |
280 | 265 | // If both the set of text revisions and file revisions are empty, |
281 | 266 | // restore everything. Otherwise, just restore the requested items. |
282 | 267 | $restoreAll = empty( $timestamps ) && empty( $fileVersions ); |
— | — | @@ -283,20 +268,17 @@ |
284 | 269 | $restoreText = $restoreAll || !empty( $timestamps ); |
285 | 270 | $restoreFiles = $restoreAll || !empty( $fileVersions ); |
286 | 271 | |
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 ); |
289 | 275 | } else { |
290 | | - $textRestored = 0; |
| 276 | + $filesRestored = 0; |
291 | 277 | } |
292 | 278 | |
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 ); |
299 | 281 | } else { |
300 | | - $filesRestored = 0; |
| 282 | + $textRestored = 0; |
301 | 283 | } |
302 | 284 | |
303 | 285 | // Touch the log! |
— | — | @@ -304,14 +286,14 @@ |
305 | 287 | $log = new LogPage( 'delete' ); |
306 | 288 | |
307 | 289 | if( $textRestored && $filesRestored ) { |
308 | | - $reason = wfMsgExt( 'undeletedrevisions-files', array('parsemag'), |
| 290 | + $reason = wfMsgForContent( 'undeletedrevisions-files', |
309 | 291 | $wgContLang->formatNum( $textRestored ), |
310 | 292 | $wgContLang->formatNum( $filesRestored ) ); |
311 | 293 | } elseif( $textRestored ) { |
312 | | - $reason = wfMsgExt( 'undeletedrevisions', array('parsemag'), |
| 294 | + $reason = wfMsgForContent( 'undeletedrevisions', |
313 | 295 | $wgContLang->formatNum( $textRestored ) ); |
314 | 296 | } elseif( $filesRestored ) { |
315 | | - $reason = wfMsgExt( 'undeletedfiles', array('parsemag'), |
| 297 | + $reason = wfMsgForContent( 'undeletedfiles', |
316 | 298 | $wgContLang->formatNum( $filesRestored ) ); |
317 | 299 | } else { |
318 | 300 | wfDebug( "Undelete: nothing undeleted...\n" ); |
— | — | @@ -333,11 +315,10 @@ |
334 | 316 | * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete. |
335 | 317 | * @param string $comment |
336 | 318 | * @param array $fileVersions |
337 | | - * @param bool $Unsuppress, remove all ar_deleted/fa_deleted restrictions of seletected revs |
338 | 319 | * |
339 | 320 | * @return int number of revisions restored |
340 | 321 | */ |
341 | | - private function undeleteRevisions( $timestamps, $Unsuppress = false ) { |
| 322 | + private function undeleteRevisions( $timestamps ) { |
342 | 323 | global $wgDBtype; |
343 | 324 | |
344 | 325 | $restoreAll = empty( $timestamps ); |
— | — | @@ -381,7 +362,7 @@ |
382 | 363 | } |
383 | 364 | |
384 | 365 | /** |
385 | | - * Select each archived revision... |
| 366 | + * Restore each revision... |
386 | 367 | */ |
387 | 368 | $result = $dbw->select( 'archive', |
388 | 369 | /* fields */ array( |
— | — | @@ -394,7 +375,6 @@ |
395 | 376 | 'ar_minor_edit', |
396 | 377 | 'ar_flags', |
397 | 378 | 'ar_text_id', |
398 | | - 'ar_deleted', |
399 | 379 | 'ar_len' ), |
400 | 380 | /* WHERE */ array( |
401 | 381 | 'ar_namespace' => $this->title->getNamespace(), |
— | — | @@ -404,30 +384,15 @@ |
405 | 385 | /* options */ array( |
406 | 386 | 'ORDER BY' => 'ar_timestamp' ) |
407 | 387 | ); |
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 ) ) { |
412 | 389 | wfDebug( __METHOD__.": couldn't find all requested rows\n" ); |
413 | 390 | return false; |
414 | 391 | } |
415 | 392 | |
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 | | - |
427 | 393 | $revision = null; |
428 | 394 | $restored = 0; |
429 | | - |
430 | | - $ret->seek( 0 ); |
431 | | - while( $row = $ret->fetchObject() ) { |
| 395 | + |
| 396 | + while( $row = $dbw->fetchObject( $result ) ) { |
432 | 397 | if( $row->ar_text_id ) { |
433 | 398 | // Revision was deleted in 1.5+; text is in |
434 | 399 | // the regular text table, use the reference. |
— | — | @@ -450,8 +415,7 @@ |
451 | 416 | 'timestamp' => $row->ar_timestamp, |
452 | 417 | 'minor_edit' => $row->ar_minor_edit, |
453 | 418 | 'text_id' => $row->ar_text_id, |
454 | | - 'deleted' => ($Unsuppress) ? 0 : $row->ar_deleted, |
455 | | - 'len' => $row->ar_len |
| 419 | + 'len' => $row->ar_len |
456 | 420 | ) ); |
457 | 421 | $revision->insertOn( $dbw ); |
458 | 422 | $restored++; |
— | — | @@ -513,7 +477,6 @@ |
514 | 478 | $this->mRestore = $request->getCheck( 'restore' ) && $posted; |
515 | 479 | $this->mPreview = $request->getCheck( 'preview' ) && $posted; |
516 | 480 | $this->mComment = $request->getText( 'wpComment' ); |
517 | | - $this->mUnsuppress = $request->getVal( 'wpUnsuppress' ) && $wgUser->isAllowed( 'oversight' ); |
518 | 481 | |
519 | 482 | if( $par != "" ) { |
520 | 483 | $this->mTarget = $par; |
— | — | @@ -549,25 +512,21 @@ |
550 | 513 | } |
551 | 514 | |
552 | 515 | function execute() { |
553 | | - global $wgOut, $wgUser; |
| 516 | + global $wgOut; |
554 | 517 | if ( $this->mAllowed ) { |
555 | | - $wgOut->setPagetitle( wfMsgHtml( "undeletepage" ) ); |
| 518 | + $wgOut->setPagetitle( wfMsg( "undeletepage" ) ); |
556 | 519 | } else { |
557 | | - $wgOut->setPagetitle( wfMsgHtml( "viewdeletedpage" ) ); |
| 520 | + $wgOut->setPagetitle( wfMsg( "viewdeletedpage" ) ); |
558 | 521 | } |
559 | 522 | |
560 | 523 | 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(); |
564 | 525 | |
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 ); |
572 | 531 | } |
573 | 532 | return; |
574 | 533 | } |
— | — | @@ -575,14 +534,7 @@ |
576 | 535 | return $this->showRevision( $this->mTimestamp ); |
577 | 536 | } |
578 | 537 | 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 ); |
587 | 539 | } |
588 | 540 | if( $this->mRestore && $this->mAction == "submit" ) { |
589 | 541 | return $this->undelete(); |
— | — | @@ -592,7 +544,7 @@ |
593 | 545 | |
594 | 546 | function showSearchForm() { |
595 | 547 | global $wgOut, $wgScript; |
596 | | - $wgOut->addWikiText( wfMsgHtml( 'undelete-header' ) ); |
| 548 | + $wgOut->addWikiText( wfMsg( 'undelete-header' ) ); |
597 | 549 | |
598 | 550 | $wgOut->addHtml( |
599 | 551 | Xml::openElement( 'form', array( |
— | — | @@ -611,7 +563,6 @@ |
612 | 564 | '</form>' ); |
613 | 565 | } |
614 | 566 | |
615 | | - // Generic list of deleted pages |
616 | 567 | /* private */ function showList( $result ) { |
617 | 568 | global $wgLang, $wgContLang, $wgUser, $wgOut; |
618 | 569 | |
— | — | @@ -661,22 +612,11 @@ |
662 | 613 | return; |
663 | 614 | } |
664 | 615 | |
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 | | - |
676 | 616 | wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) ); |
677 | 617 | |
678 | 618 | if( $this->mPreview ) { |
679 | 619 | $wgOut->addHtml( "<hr />\n" ); |
680 | | - $wgOut->addWikiTextTitle( $rev->revText(), $this->mTargetObj, false ); |
| 620 | + $wgOut->addWikiTextTitle( $rev->getText(), $this->mTargetObj, false ); |
681 | 621 | } |
682 | 622 | |
683 | 623 | $wgOut->addHtml( |
— | — | @@ -684,7 +624,7 @@ |
685 | 625 | 'readonly' => true, |
686 | 626 | 'cols' => intval( $wgUser->getOption( 'cols' ) ), |
687 | 627 | 'rows' => intval( $wgUser->getOption( 'rows' ) ) ), |
688 | | - $rev->revText() . "\n" ) . |
| 628 | + $rev->getText() . "\n" ) . |
689 | 629 | wfOpenElement( 'div' ) . |
690 | 630 | wfOpenElement( 'form', array( |
691 | 631 | 'method' => 'post', |
— | — | @@ -734,7 +674,7 @@ |
735 | 675 | /* private */ function showHistory() { |
736 | 676 | global $wgLang, $wgUser, $wgOut; |
737 | 677 | |
738 | | - $this->sk = $wgUser->getSkin(); |
| 678 | + $sk = $wgUser->getSkin(); |
739 | 679 | if ( $this->mAllowed ) { |
740 | 680 | $wgOut->setPagetitle( wfMsg( "undeletepage" ) ); |
741 | 681 | } else { |
— | — | @@ -750,10 +690,9 @@ |
751 | 691 | } |
752 | 692 | */ |
753 | 693 | if ( $this->mAllowed ) { |
754 | | - $wgOut->addWikiText( '<p>' . wfMsgHtml( "undeletehistory" ) . '</p>' ); |
755 | | - $wgOut->addHtml( '<p>' . wfMsgHtml( "undeleterevdel" ) . '</p>' ); |
| 694 | + $wgOut->addWikiText( wfMsg( "undeletehistory" ) ); |
756 | 695 | } else { |
757 | | - $wgOut->addWikiText( wfMsgHtml( "undeletehistorynoadmin" ) ); |
| 696 | + $wgOut->addWikiText( wfMsg( "undeletehistorynoadmin" ) ); |
758 | 697 | } |
759 | 698 | |
760 | 699 | # List all stored revisions |
— | — | @@ -799,16 +738,7 @@ |
800 | 739 | array( 'page' => $this->mTargetObj->getPrefixedText(), |
801 | 740 | 'type' => 'delete' ) ) ) ); |
802 | 741 | $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 | + |
813 | 743 | if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) { |
814 | 744 | # Format the user-visible controls (comment field, submission button) |
815 | 745 | # in a nice little table |
— | — | @@ -816,10 +746,6 @@ |
817 | 747 | $table .= '<td colspan="2">' . wfMsgWikiHtml( 'undeleteextrahelp' ) . '</td></tr><tr>'; |
818 | 748 | $table .= '<td align="right"><strong>' . wfMsgHtml( 'undeletecomment' ) . '</strong></td>'; |
819 | 749 | $table .= '<td>' . wfInput( 'wpComment', 50, $this->mComment ) . '</td>'; |
820 | | - if ( $wgUser->isAllowed( 'oversight' ) ) { |
821 | | - $table .= '</tr><tr><td> </td><td>'; |
822 | | - $table .= Xml::checkLabel( wfMsg( 'revdelete-unsuppress' ), 'wpUnsuppress', 'wpUnsuppress', false, array( 'tabindex' => '2' ) ); |
823 | | - } |
824 | 750 | $table .= '</tr><tr><td> </td><td>'; |
825 | 751 | $table .= wfSubmitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore' ) ); |
826 | 752 | $table .= wfElement( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ) ) ); |
— | — | @@ -835,48 +761,26 @@ |
836 | 762 | $target = urlencode( $this->mTarget ); |
837 | 763 | while( $row = $revisions->fetchObject() ) { |
838 | 764 | $ts = wfTimestamp( TS_MW, $row->ar_timestamp ); |
839 | | - // We don't handle top edits with rev_deleted |
840 | 765 | 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×tamp=$ts" ); |
844 | 770 | } else { |
845 | 771 | $checkBox = ''; |
846 | 772 | $pageLink = $wgLang->timeanddate( $ts, true ); |
847 | 773 | } |
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 ); |
849 | 775 | $stxt = ''; |
850 | 776 | if (!is_null($size = $row->ar_len)) { |
851 | 777 | if ($size == 0) |
852 | 778 | $stxt = wfMsgHtml('historyempty'); |
853 | | - else |
| 779 | + else |
854 | 780 | $stxt = wfMsgHtml('historysize', $wgLang->formatNum( $size ) ); |
855 | 781 | } |
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 | + |
881 | 785 | } |
882 | 786 | $revisions->free(); |
883 | 787 | $wgOut->addHTML("</ul>"); |
— | — | @@ -891,21 +795,17 @@ |
892 | 796 | while( $row = $files->fetchObject() ) { |
893 | 797 | $ts = wfTimestamp( TS_MW, $row->fa_timestamp ); |
894 | 798 | 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 ); |
902 | 800 | $key = urlencode( $row->fa_storage_key ); |
903 | 801 | $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" ); |
905 | 805 | } else { |
906 | 806 | $checkBox = ''; |
907 | 807 | $pageLink = $wgLang->timeanddate( $ts, true ); |
908 | 808 | } |
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 ); |
910 | 810 | $data = |
911 | 811 | wfMsgHtml( 'widthheight', |
912 | 812 | $wgLang->formatNum( $row->fa_width ), |
— | — | @@ -913,25 +813,8 @@ |
914 | 814 | ' (' . |
915 | 815 | wfMsgHtml( 'nbytes', $wgLang->formatNum( $row->fa_size ) ) . |
916 | 816 | ')'; |
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" ); |
936 | 819 | } |
937 | 820 | $files->free(); |
938 | 821 | $wgOut->addHTML( "</ul>" ); |
— | — | @@ -947,143 +830,6 @@ |
948 | 831 | return true; |
949 | 832 | } |
950 | 833 | |
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×tamp=$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 | | - |
1088 | 834 | function undelete() { |
1089 | 835 | global $wgOut, $wgUser; |
1090 | 836 | if( !is_null( $this->mTargetObj ) ) { |
— | — | @@ -1092,22 +838,16 @@ |
1093 | 839 | $ok = $archive->undelete( |
1094 | 840 | $this->mTargetTimestamp, |
1095 | 841 | $this->mComment, |
1096 | | - $this->mFileVersions, |
1097 | | - $this->mUnsuppress ); |
| 842 | + $this->mFileVersions ); |
| 843 | + |
1098 | 844 | if( $ok ) { |
1099 | 845 | $skin = $wgUser->getSkin(); |
1100 | 846 | $link = $skin->makeKnownLinkObj( $this->mTargetObj ); |
1101 | 847 | $wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) ); |
1102 | 848 | return true; |
1103 | 849 | } |
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; |
1110 | 850 | } |
1111 | | - $wgOut->showFatalError( wfMsgHtml( "cannotundelete" ) ); |
| 851 | + $wgOut->showFatalError( wfMsg( "cannotundelete" ) ); |
1112 | 852 | return false; |
1113 | 853 | } |
1114 | 854 | } |
Index: trunk/phase3/includes/DifferenceEngine.php |
— | — | @@ -174,49 +174,14 @@ |
175 | 175 | $newminor = wfElement( 'span', array( 'class' => 'minor' ), |
176 | 176 | wfMsg( 'minoreditletter') ) . ' '; |
177 | 177 | } |
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 = " <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 = " <tt>(<small>$rdel</small>)</tt> "; |
212 | | - } |
213 | 178 | |
214 | 179 | $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 />" . |
217 | 182 | $prevlink; |
218 | 183 | $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 />" . |
221 | 186 | $nextlink . $patrol; |
222 | 187 | |
223 | 188 | $this->showDiff( $oldHeader, $newHeader ); |
— | — | @@ -237,10 +202,8 @@ |
238 | 203 | |
239 | 204 | $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" ); |
240 | 205 | #add deleted rev tag if needed |
241 | | - if( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) { |
| 206 | + if ( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) { |
242 | 207 | $wgOut->addWikiText( wfMsg( 'rev-deleted-text-permission' ) ); |
243 | | - } else if( $this->mNewRev->isDeleted(Revision::DELETED_TEXT) ) { |
244 | | - $wgOut->addWikiText( wfMsg( 'rev-deleted-text-view' ) ); |
245 | 208 | } |
246 | 209 | |
247 | 210 | if( !$this->mNewRev->isCurrent() ) { |
— | — | @@ -369,25 +332,20 @@ |
370 | 333 | } |
371 | 334 | } |
372 | 335 | |
373 | | - // Loadtext is permission safe, this just clears out the diff |
| 336 | + #loadtext is permission safe, this just clears out the diff |
374 | 337 | if ( !$this->loadText() ) { |
375 | 338 | wfProfileOut( $fname ); |
376 | 339 | return false; |
377 | 340 | } else if ( $this->mOldRev && !$this->mOldRev->userCan(Revision::DELETED_TEXT) ) { |
378 | | - return ''; |
| 341 | + return ''; |
379 | 342 | } else if ( $this->mNewRev && !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) { |
380 | | - return ''; |
| 343 | + return ''; |
381 | 344 | } |
382 | 345 | |
383 | 346 | $difftext = $this->generateDiffBody( $this->mOldtext, $this->mNewtext ); |
384 | 347 | |
385 | 348 | // 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 ) { |
392 | 350 | wfIncrStats( 'diff_cache_miss' ); |
393 | 351 | $wgMemc->set( $key, $difftext, 7*86400 ); |
394 | 352 | } else { |
— | — | @@ -521,7 +479,13 @@ |
522 | 480 | */ |
523 | 481 | function addHeader( $diff, $otitle, $ntitle, $multi = '' ) { |
524 | 482 | 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 | + } |
526 | 490 | $header = " |
527 | 491 | <table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'> |
528 | 492 | <tr> |
— | — | @@ -594,11 +558,6 @@ |
595 | 559 | $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a>" |
596 | 560 | . " (<a href='$newEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)"; |
597 | 561 | } |
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 | | - } |
603 | 562 | |
604 | 563 | // Load the old revision object |
605 | 564 | $this->mOldRev = false; |
— | — | @@ -626,20 +585,11 @@ |
627 | 586 | $t = $wgLang->timeanddate( $this->mOldRev->getTimestamp(), true ); |
628 | 587 | $oldLink = $this->mOldPage->escapeLocalUrl( 'oldid=' . $this->mOldid ); |
629 | 588 | $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) |
635 | 592 | $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>)"; |
644 | 594 | } |
645 | 595 | |
646 | 596 | return true; |
— | — | @@ -660,6 +610,7 @@ |
661 | 611 | return false; |
662 | 612 | } |
663 | 613 | if ( $this->mOldRev ) { |
| 614 | + // FIXME: permission tests |
664 | 615 | $this->mOldtext = $this->mOldRev->revText(); |
665 | 616 | if ( $this->mOldtext === false ) { |
666 | 617 | return false; |
Index: trunk/phase3/includes/SpecialLog.php |
— | — | @@ -72,70 +72,16 @@ |
73 | 73 | |
74 | 74 | list( $this->limit, $this->offset ) = $request->getLimitOffset(); |
75 | 75 | } |
76 | | - |
77 | | - function newFromTitle( $title, $logid=0 ) { |
78 | | - $fname = 'LogReader::newFromTitle'; |
79 | 76 | |
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 | | - |
111 | 77 | /** |
112 | 78 | * Set the log reader to return only entries of the given type. |
113 | | - * Type restrictions enforced here |
114 | 79 | * @param string $type A log type ('upload', 'delete', etc) |
115 | 80 | * @private |
116 | 81 | */ |
117 | 82 | 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 | | - |
130 | 83 | if( empty( $type ) ) { |
131 | 84 | return false; |
132 | 85 | } |
133 | | - // Can user see this log? |
134 | | - if ( isset($wgLogRestrictions[$type]) ) { |
135 | | - if ( !$wgUser->isAllowed( $wgLogRestrictions[$type] ) ) { |
136 | | - return false; |
137 | | - } |
138 | | - } |
139 | | - |
140 | 86 | $this->type = $type; |
141 | 87 | $safetype = $this->db->strencode( $type ); |
142 | 88 | $this->whereClauses[] = "log_type='$safetype'"; |
— | — | @@ -171,7 +117,7 @@ |
172 | 118 | * @private |
173 | 119 | */ |
174 | 120 | function limitTitle( $page , $pattern ) { |
175 | | - $title = Title::newFromURL( $page, false ); |
| 121 | + $title = Title::newFromText( $page ); |
176 | 122 | if( empty( $page ) || is_null( $title ) ) { |
177 | 123 | return false; |
178 | 124 | } |
— | — | @@ -211,7 +157,6 @@ |
212 | 158 | $logging = $this->db->tableName( "logging" ); |
213 | 159 | $sql = "SELECT /*! STRAIGHT_JOIN */ log_type, log_action, log_timestamp, |
214 | 160 | log_user, user_name, |
215 | | - log_id, log_deleted, |
216 | 161 | log_namespace, log_title, page_id, |
217 | 162 | log_comment, log_params FROM $logging "; |
218 | 163 | if( !empty( $this->joinClauses ) ) { |
— | — | @@ -272,11 +217,6 @@ |
273 | 218 | * @addtogroup SpecialPage |
274 | 219 | */ |
275 | 220 | class LogViewer { |
276 | | - const DELETED_ACTION = 1; |
277 | | - const DELETED_COMMENT = 2; |
278 | | - const DELETED_USER = 4; |
279 | | - const DELETED_RESTRICTED = 8; |
280 | | - |
281 | 221 | /** |
282 | 222 | * @var LogReader $reader |
283 | 223 | */ |
— | — | @@ -290,21 +230,7 @@ |
291 | 231 | global $wgUser; |
292 | 232 | $this->skin = $wgUser->getSkin(); |
293 | 233 | $this->reader =& $reader; |
294 | | - $this->preCacheMessages(); |
295 | 234 | } |
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 | | - } |
309 | 235 | |
310 | 236 | /** |
311 | 237 | * Take over the whole output page in $wgOut with the log display. |
— | — | @@ -322,125 +248,8 @@ |
323 | 249 | $this->showError( $wgOut ); |
324 | 250 | } |
325 | 251 | } |
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 | | - } |
365 | 252 | |
366 | 253 | /** |
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 | | - /** |
445 | 254 | * Load the data from the linked LogReader |
446 | 255 | * Preload the link cache |
447 | 256 | * Initialise numResults |
— | — | @@ -510,8 +319,7 @@ |
511 | 320 | * @private |
512 | 321 | */ |
513 | 322 | function logLine( $s ) { |
514 | | - global $wgLang, $wgUser; |
515 | | - |
| 323 | + global $wgLang, $wgUser;; |
516 | 324 | $skin = $wgUser->getSkin(); |
517 | 325 | $title = Title::makeTitle( $s->log_namespace, $s->log_title ); |
518 | 326 | $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $s->log_timestamp), true ); |
— | — | @@ -524,64 +332,12 @@ |
525 | 333 | } else { |
526 | 334 | $linkCache->addBadLinkObj( $title ); |
527 | 335 | } |
528 | | - // User links |
529 | | - $userLink = $this->skin->logUserTools( $s, true ); |
530 | | - // Comment |
531 | | - $comment = $this->skin->logComment( $s, true ); |
532 | 336 | |
| 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 ); |
533 | 339 | $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 |
586 | 342 | if ( $s->log_type == 'move' && isset( $paramArray[0] ) ) { |
587 | 343 | $destTitle = Title::newFromText( $paramArray[0] ); |
588 | 344 | if ( $destTitle ) { |
— | — | @@ -593,47 +349,26 @@ |
594 | 350 | '&wpMovetalk=0' ); |
595 | 351 | } |
596 | 352 | // 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' ), |
599 | 355 | wfMsg( 'undeletebtn' ) , |
600 | | - 'target='. urlencode( $title->getPrefixedDBkey() ) ); |
| 356 | + 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')'; |
| 357 | + |
601 | 358 | // show unblock link |
602 | 359 | } elseif ( $s->log_action == 'block' && $wgUser->isAllowed( 'block' ) ) { |
603 | | - $reviewlink = $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ), |
| 360 | + $revert = '(' . $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ), |
604 | 361 | wfMsg( 'unblocklink' ), |
605 | | - 'action=unblock&ip=' . urlencode( $s->log_title ) ); |
| 362 | + 'action=unblock&ip=' . urlencode( $s->log_title ) ) . ')'; |
606 | 363 | // show change protection link |
607 | 364 | } elseif ( $s->log_action == 'protect' && $wgUser->isAllowed( 'protect' ) ) { |
608 | | - $reviewlink = $this->skin->makeKnownLink( $title->getPrefixedDBkey() , |
| 365 | + $revert = '(' . $skin->makeKnownLink( $title->getPrefixedDBkey() , |
609 | 366 | wfMsg( 'protect_change' ), |
610 | | - 'action=unprotect' ); |
| 367 | + 'action=unprotect' ) . ')'; |
611 | 368 | } |
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=='' ) ? "" : " ($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; |
638 | 373 | } |
639 | 374 | |
640 | 375 | /** |
— | — | @@ -674,8 +409,6 @@ |
675 | 410 | * @private |
676 | 411 | */ |
677 | 412 | function getTypeMenu() { |
678 | | - global $wgLogRestrictions, $wgUser; |
679 | | - |
680 | 413 | $out = "<select name='type'>\n"; |
681 | 414 | |
682 | 415 | $validTypes = LogPage::validTypes(); |
— | — | @@ -693,14 +426,7 @@ |
694 | 427 | // Third pass generates sorted XHTML content |
695 | 428 | foreach( $m as $text => $type ) { |
696 | 429 | $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 { |
703 | 430 | $out .= Xml::option( $text, $type, $selected ) . "\n"; |
704 | | - } |
705 | 431 | } |
706 | 432 | |
707 | 433 | $out .= '</select>'; |
— | — | @@ -758,12 +484,5 @@ |
759 | 485 | } |
760 | 486 | } |
761 | 487 | |
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 ); |
769 | 488 | |
770 | 489 | ?> |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | * is writable to the web server but is not exposed to the internet. |
171 | 171 | * |
172 | 172 | * Set $wgSaveDeletedFiles to true and set up the save path in |
173 | | - * $wgFileStore['deleted']['directory'] |
| 173 | + * $wgFileStore['deleted']['directory']. |
174 | 174 | */ |
175 | 175 | $wgSaveDeletedFiles = false; |
176 | 176 | |
— | — | @@ -983,7 +983,6 @@ |
984 | 984 | $wgGroupPermissions['sysop']['block'] = true; |
985 | 985 | $wgGroupPermissions['sysop']['createaccount'] = true; |
986 | 986 | $wgGroupPermissions['sysop']['delete'] = true; |
987 | | -$wgGroupPermissions['sysop']['browsearchive'] = true; // can see the deleted page list |
988 | 987 | $wgGroupPermissions['sysop']['deletedhistory'] = true; // can view deleted history entries, but not see or restore the text |
989 | 988 | $wgGroupPermissions['sysop']['editinterface'] = true; |
990 | 989 | $wgGroupPermissions['sysop']['import'] = true; |
— | — | @@ -1006,17 +1005,9 @@ |
1007 | 1006 | // Permission to change users' group assignments |
1008 | 1007 | $wgGroupPermissions['bureaucrat']['userrights'] = true; |
1009 | 1008 | |
1010 | | -// Experimental permissions to enable revisiondelete: |
1011 | | - |
| 1009 | +// Experimental permissions, not ready for production use |
1012 | 1010 | //$wgGroupPermissions['sysop']['deleterevision'] = true; |
1013 | | -//$wgGroupPermissions['sysop']['hideuser'] = true; |
1014 | | -// To see hidden revs |
1015 | 1011 | //$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; |
1021 | 1012 | |
1022 | 1013 | /** |
1023 | 1014 | * The developer group is deprecated, but can be activated if need be |
— | — | @@ -2032,20 +2023,9 @@ |
2033 | 2024 | 'move', |
2034 | 2025 | 'import', |
2035 | 2026 | 'patrol', |
2036 | | - 'oversight', |
2037 | 2027 | ); |
2038 | 2028 | |
2039 | 2029 | /** |
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 | | -/** |
2050 | 2030 | * Lists the message key string for each log type. The localized messages |
2051 | 2031 | * will be listed in the user interface. |
2052 | 2032 | * |
— | — | @@ -2061,7 +2041,6 @@ |
2062 | 2042 | 'move' => 'movelogpage', |
2063 | 2043 | 'import' => 'importlogpage', |
2064 | 2044 | 'patrol' => 'patrol-log-page', |
2065 | | - 'oversight' => 'oversightlog', |
2066 | 2045 | ); |
2067 | 2046 | |
2068 | 2047 | /** |
— | — | @@ -2080,7 +2059,6 @@ |
2081 | 2060 | 'move' => 'movelogpagetext', |
2082 | 2061 | 'import' => 'importlogpagetext', |
2083 | 2062 | 'patrol' => 'patrol-log-header', |
2084 | | - 'oversight' => 'overlogpagetext', |
2085 | 2063 | ); |
2086 | 2064 | |
2087 | 2065 | /** |
— | — | @@ -2098,18 +2076,12 @@ |
2099 | 2077 | 'delete/delete' => 'deletedarticle', |
2100 | 2078 | 'delete/restore' => 'undeletedarticle', |
2101 | 2079 | 'delete/revision' => 'revdelete-logentry', |
2102 | | - 'delete/event' => 'logdelete-logentry', |
2103 | 2080 | 'upload/upload' => 'uploadedimage', |
2104 | 2081 | 'upload/revert' => 'uploadedimage', |
2105 | 2082 | 'move/move' => '1movedto2', |
2106 | 2083 | 'move/move_redir' => '1movedto2_redir', |
2107 | 2084 | 'import/upload' => 'import-logentry-upload', |
2108 | 2085 | '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', |
2114 | 2086 | ); |
2115 | 2087 | |
2116 | 2088 | /** |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -38,21 +38,7 @@ |
39 | 39 | $this->mTitle =& $article->mTitle; |
40 | 40 | $this->mNotificationTimestamp = NULL; |
41 | 41 | $this->mSkin = $wgUser->getSkin(); |
42 | | - $this->preCacheMessages(); |
43 | 42 | } |
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 | | - } |
57 | 43 | |
58 | 44 | /** |
59 | 45 | * Print the history page for an article. |
— | — | @@ -201,31 +187,35 @@ |
202 | 188 | $arbitrary = $this->diffButtons( $rev, $firstInList, $counter ); |
203 | 189 | $link = $this->revLink( $rev ); |
204 | 190 | |
| 191 | + $user = $this->mSkin->userLink( $rev->getUser(), $rev->getUserText() ) |
| 192 | + . $this->mSkin->userToolLinks( $rev->getUser(), $rev->getUserText() ); |
| 193 | + |
205 | 194 | $s .= "($curlink) ($lastlink) $arbitrary"; |
206 | 195 | |
207 | 196 | if( $wgUser->isAllowed( 'deleterevision' ) ) { |
208 | 197 | $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); |
209 | 198 | 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' ); |
212 | 201 | } else if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { |
213 | 202 | // If revision was hidden from sysops |
214 | | - $del = $this->message['rev-delundel']; |
| 203 | + $del = wfMsgHtml( 'rev-delundel' ); |
215 | 204 | } else { |
216 | 205 | $del = $this->mSkin->makeKnownLinkObj( $revdel, |
217 | | - $this->message['rev-delundel'], |
| 206 | + wfMsg( 'rev-delundel' ), |
218 | 207 | 'target=' . urlencode( $this->mTitle->getPrefixedDbkey() ) . |
219 | 208 | '&oldid=' . urlencode( $rev->getId() ) ); |
220 | | - // Bolden oversighted content |
221 | | - if( $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) |
222 | | - $del = "<strong>$del</strong>"; |
223 | 209 | } |
224 | | - $s .= " <tt>(<small>$del</small>)</tt> "; |
| 210 | + $s .= " (<small>$del</small>) "; |
225 | 211 | } |
226 | 212 | |
227 | 213 | $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 | + |
230 | 220 | if( $row->rev_minor_edit ) { |
231 | 221 | $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') ); |
232 | 222 | } |
— | — | @@ -251,7 +241,7 @@ |
252 | 242 | } |
253 | 243 | #add blurb about text having been deleted |
254 | 244 | if( $row->rev_deleted & Revision::DELETED_TEXT ) { |
255 | | - $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>'; |
| 245 | + $s .= ' ' . wfMsgHtml( 'deletedrev' ); |
256 | 246 | } |
257 | 247 | if( $wgUser->isAllowed( 'rollback' ) && $latest ) { |
258 | 248 | $s .= ' '.$this->mSkin->generateRollback( $rev ); |
— | — | @@ -279,7 +269,7 @@ |
280 | 270 | |
281 | 271 | /** @todo document */ |
282 | 272 | function curLink( $rev, $latest ) { |
283 | | - $cur = $this->message['cur']; |
| 273 | + $cur = wfMsgExt( 'cur', array( 'escape') ); |
284 | 274 | if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) { |
285 | 275 | return $cur; |
286 | 276 | } else { |
— | — | @@ -292,7 +282,7 @@ |
293 | 283 | |
294 | 284 | /** @todo document */ |
295 | 285 | function lastLink( $rev, $next, $counter ) { |
296 | | - $last = $this->message['last']; |
| 286 | + $last = wfMsgExt( 'last', array( 'escape' ) ); |
297 | 287 | if ( is_null( $next ) ) { |
298 | 288 | # Probably no next row |
299 | 289 | return $last; |
Index: trunk/phase3/includes/LogPage.php |
— | — | @@ -50,15 +50,13 @@ |
51 | 51 | function saveContent() { |
52 | 52 | if( wfReadOnly() ) return false; |
53 | 53 | |
54 | | - global $wgUser, $wgLogRestrictions; |
| 54 | + global $wgUser; |
55 | 55 | $fname = 'LogPage::saveContent'; |
56 | 56 | |
57 | 57 | $dbw = wfGetDB( DB_MASTER ); |
58 | 58 | $uid = $wgUser->getID(); |
59 | 59 | |
60 | 60 | $this->timestamp = $now = wfTimestampNow(); |
61 | | - |
62 | | - $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' ); |
63 | 61 | $dbw->insert( 'logging', |
64 | 62 | array( |
65 | 63 | 'log_type' => $this->type, |
— | — | @@ -71,15 +69,20 @@ |
72 | 70 | 'log_params' => $this->params |
73 | 71 | ), $fname |
74 | 72 | ); |
75 | | - $newId = $dbw->insertId(); |
76 | 73 | |
77 | 74 | # And update recentchanges |
78 | 75 | 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; |
83 | 83 | } |
| 84 | + |
| 85 | + RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '', |
| 86 | + $this->type, $this->action, $this->target, $this->comment, $this->params ); |
84 | 87 | } |
85 | 88 | return true; |
86 | 89 | } |
— | — | @@ -119,13 +122,13 @@ |
120 | 123 | */ |
121 | 124 | function logHeader( $type ) { |
122 | 125 | global $wgLogHeaders; |
123 | | - return wfMsgHtml( $wgLogHeaders[$type] ); |
| 126 | + return wfMsg( $wgLogHeaders[$type] ); |
124 | 127 | } |
125 | 128 | |
126 | 129 | /** |
127 | 130 | * @static |
128 | 131 | */ |
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 ) { |
130 | 133 | global $wgLang, $wgContLang, $wgLogActions; |
131 | 134 | |
132 | 135 | $key = "$type/$action"; |
— | — | @@ -182,17 +185,12 @@ |
183 | 186 | } |
184 | 187 | } else { |
185 | 188 | 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' ) { |
188 | 190 | $params[1] = $wgLang->translateBlockExpiry( $params[1] ); |
189 | 191 | $params[2] = isset( $params[2] ) |
190 | 192 | ? self::formatBlockFlags( $params[2] ) |
191 | 193 | : ''; |
192 | 194 | } |
193 | | - if ( $forRC ) { |
194 | | - $params[1] = $wgLang->translateBlockExpiry( $params[1], true ); |
195 | | - $params[2] = isset( $params[2] ) ? str_replace( ",", ", ", self::formatBlockFlags( $params[2] ) ) : ''; |
196 | | - } |
197 | 195 | $rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin ); |
198 | 196 | } |
199 | 197 | } |
— | — | @@ -224,7 +222,7 @@ |
225 | 223 | $this->comment = $comment; |
226 | 224 | $this->params = LogPage::makeParamBlob( $params ); |
227 | 225 | |
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 ); |
229 | 227 | |
230 | 228 | return $this->saveContent(); |
231 | 229 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -270,10 +270,6 @@ |
271 | 271 | * (bug 3984) Searching in logs by title% |
272 | 272 | * (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. |
273 | 273 | * 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 |
278 | 274 | * Show thumbnail of existing image if image exists already under this filename |
279 | 275 | * (bug 5546) Watchlist reflects logged actions like move, protection, undelete |
280 | 276 | * (bug 9019) No warning during upload if image description page exists, but no |