r66904 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66903‎ | r66904 | r66905 >
Date:02:07, 26 May 2010
Author:werdna
Status:deferred
Tags:
Comment:
Merge r66823 and r66793
Modified paths:
  • /branches/wmf/1.16wmf4/includes/LogEventsList.php (modified) (history)
  • /branches/wmf/1.16wmf4/includes/specials/SpecialRevisiondelete.php (modified) (history)
  • /branches/wmf/1.16wmf4/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/includes/LogEventsList.php
@@ -40,7 +40,7 @@
4141 if( !isset( $this->message ) ) {
4242 $messages = array( 'revertmerge', 'protect_change', 'unblocklink', 'change-blocklink',
4343 'revertmove', 'undeletelink', 'undeleteviewlink', 'revdel-restore', 'hist', 'diff',
44 - 'pipe-separator' );
 44+ 'pipe-separator', 'revdel-restore-deleted', 'revdel-restore-visible' );
4545 foreach( $messages as $msg ) {
4646 $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
4747 }
@@ -391,57 +391,8 @@
392392 ) . ')';
393393 // If an edit was hidden from a page give a review link to the history
394394 } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) {
395 - if( count($paramArray) >= 2 ) {
396 - // Different revision types use different URL params...
397 - $key = $paramArray[0];
398 - // $paramArray[1] is a CSV of the IDs
399 - $Ids = explode( ',', $paramArray[1] );
400 - $query = $paramArray[1];
401 - $revert = array();
402 - // Diff link for single rev deletions
403 - if( count($Ids) == 1 ) {
404 - // Live revision diffs...
405 - if( in_array( $key, array( 'oldid', 'revision' ) ) ) {
406 - $revert[] = $this->skin->link(
407 - $title,
408 - $this->message['diff'],
409 - array(),
410 - array(
411 - 'diff' => intval( $Ids[0] ),
412 - 'unhide' => 1
413 - ),
414 - array( 'known', 'noclasses' )
415 - );
416 - // Deleted revision diffs...
417 - } else if( in_array( $key, array( 'artimestamp','archive' ) ) ) {
418 - $revert[] = $this->skin->link(
419 - SpecialPage::getTitleFor( 'Undelete' ),
420 - $this->message['diff'],
421 - array(),
422 - array(
423 - 'target' => $title->getPrefixedDBKey(),
424 - 'diff' => 'prev',
425 - 'timestamp' => $Ids[0]
426 - ),
427 - array( 'known', 'noclasses' )
428 - );
429 - }
430 - }
431 - // View/modify link...
432 - $revert[] = $this->skin->link(
433 - SpecialPage::getTitleFor( 'Revisiondelete' ),
434 - $this->message['revdel-restore'],
435 - array(),
436 - array(
437 - 'target' => $title->getPrefixedText(),
438 - 'type' => $key,
439 - 'ids' => $query
440 - ),
441 - array( 'known', 'noclasses' )
442 - );
443 - // Pipe links
444 - $revert = wfMsg( 'parentheses', $wgLang->pipeList( $revert ) );
445 - }
 395+ $revert = RevisionDeleter::getLogLinks( $title, $paramArray,
 396+ $this->skin, $this->message );
446397 // Hidden log items, give review link
447398 } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'event', 'deletedhistory' ) ) {
448399 if( count($paramArray) >= 1 ) {
Property changes on: branches/wmf/1.16wmf4/includes/LogEventsList.php
___________________________________________________________________
Name: svn:mergeinfo
449400 + /branches/REL1_15/phase3/includes/LogEventsList.php:51646
/branches/sqlite/includes/LogEventsList.php:58211-58321
/branches/wmf-deployment/includes/LogEventsList.php:53381,60970
/trunk/phase3/includes/LogEventsList.php:63549,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,66793
Index: branches/wmf/1.16wmf4/includes/specials/SpecialRevisiondelete.php
@@ -697,6 +697,143 @@
698698 return null;
699699 }
700700 }
 701+
 702+ // Checks if a revision still exists in the revision table.
 703+ // If it doesn't, returns the corresponding ar_timestamp field
 704+ // so that this key can be used instead.
 705+ public static function checkRevisionExistence( $title, $revid ) {
 706+ $dbr = wfGetDB( DB_SLAVE );
 707+ $exists = $dbr->selectField( 'revision', '1',
 708+ array( 'rev_id' => $revid ), __METHOD__ );
 709+
 710+ if ( $exists ) {
 711+ return true;
 712+ }
 713+
 714+ $timestamp = $dbr->selectField( 'archive', 'ar_timestamp',
 715+ array( 'ar_namespace' => $title->getNamespace(),
 716+ 'ar_title' => $title->getDBkey(),
 717+ 'ar_rev_id' => $revid ), __METHOD__ );
 718+
 719+ return $timestamp;
 720+ }
 721+
 722+ // Creates utility links for log entries.
 723+ public static function getLogLinks( $title, $paramArray, $skin, $messages ) {
 724+ global $wgLang;
 725+
 726+ if( count($paramArray) >= 2 ) {
 727+ // Different revision types use different URL params...
 728+ $originalKey = $key = $paramArray[0];
 729+ // $paramArray[1] is a CSV of the IDs
 730+ $Ids = explode( ',', $paramArray[1] );
 731+ $query = $paramArray[1];
 732+ $revert = array();
 733+
 734+ // For if undeleted revisions are found amidst deleted ones.
 735+ $undeletedRevisions = array();
 736+
 737+ // This is not going to work if some revs are deleted and some
 738+ // aren't.
 739+ if ($key == 'revision') {
 740+ foreach( $Ids as $k => $id ) {
 741+ $existResult =
 742+ self::checkRevisionExistence( $title, $id );
 743+
 744+ if ($existResult !== true) {
 745+ $key = 'archive';
 746+ $Ids[$k] = $existResult;
 747+ } elseif ($key != $originalKey) {
 748+ // Undeleted revision amidst deleted ones
 749+ unset($Ids[$k]);
 750+ $undeletedRevisions[] = $id;
 751+ }
 752+ }
 753+ }
 754+
 755+ // Diff link for single rev deletions
 756+ if( count($Ids) == 1 && !count($undeletedRevisions) ) {
 757+ // Live revision diffs...
 758+ if( in_array( $key, array( 'oldid', 'revision' ) ) ) {
 759+ $revert[] = $skin->link(
 760+ $title,
 761+ $messages['diff'],
 762+ array(),
 763+ array(
 764+ 'diff' => intval( $Ids[0] ),
 765+ 'unhide' => 1
 766+ ),
 767+ array( 'known', 'noclasses' )
 768+ );
 769+ // Deleted revision diffs...
 770+ } else if( in_array( $key, array( 'artimestamp','archive' ) ) ) {
 771+ $revert[] = $skin->link(
 772+ SpecialPage::getTitleFor( 'Undelete' ),
 773+ $messages['diff'],
 774+ array(),
 775+ array(
 776+ 'target' => $title->getPrefixedDBKey(),
 777+ 'diff' => 'prev',
 778+ 'timestamp' => $Ids[0]
 779+ ),
 780+ array( 'known', 'noclasses' )
 781+ );
 782+ }
 783+ }
 784+
 785+ // View/modify link...
 786+ if ( count($undeletedRevisions) ) {
 787+ // FIXME THIS IS A HORRIBLE HORRIBLE HACK AND SHOULD DIE
 788+ // It's not possible to pass a list of both deleted and
 789+ // undeleted revisions to SpecialRevisionDelete, so we're
 790+ // stuck with two links. See bug
 791+ $restoreLinks = array();
 792+
 793+ $restoreLinks[] = $skin->link(
 794+ SpecialPage::getTitleFor( 'Revisiondelete' ),
 795+ $messages['revdel-restore-visible'],
 796+ array(),
 797+ array(
 798+ 'target' => $title->getPrefixedText(),
 799+ 'type' => $originalKey,
 800+ 'ids' => implode(',', $undeletedRevisions),
 801+ ),
 802+ array( 'known', 'noclasses' )
 803+ );
 804+
 805+ $restoreLinks[] = $skin->link(
 806+ SpecialPage::getTitleFor( 'Revisiondelete' ),
 807+ $messages['revdel-restore-deleted'],
 808+ array(),
 809+ array(
 810+ 'target' => $title->getPrefixedText(),
 811+ 'type' => $key,
 812+ 'ids' => implode(',', $Ids),
 813+ ),
 814+ array( 'known', 'noclasses' )
 815+ );
 816+
 817+ $revert[] = $messages['revdel-restore'] . ' [' .
 818+ $wgLang->pipeList( $restoreLinks ) . ']';
 819+ } else {
 820+ $revert[] = $skin->link(
 821+ SpecialPage::getTitleFor( 'Revisiondelete' ),
 822+ $messages['revdel-restore'],
 823+ array(),
 824+ array(
 825+ 'target' => $title->getPrefixedText(),
 826+ 'type' => $key,
 827+ 'ids' => implode(',', $Ids),
 828+ ),
 829+ array( 'known', 'noclasses' )
 830+ );
 831+ }
 832+
 833+ // Pipe links
 834+ $revert = wfMsg( 'parentheses', $wgLang->pipeList( $revert ) );
 835+ }
 836+ return $revert;
 837+ }
701838 }
702839
703840 /**
Property changes on: branches/wmf/1.16wmf4/includes/specials/SpecialRevisiondelete.php
___________________________________________________________________
Name: svn:mergeinfo
704841 + /branches/REL1_15/phase3/includes/specials/SpecialRevisiondelete.php:51646
/branches/sqlite/includes/specials/SpecialRevisiondelete.php:58211-58321
/branches/wmf/1.16wmf4/includes/LogEventsList.php:66793
/branches/wmf-deployment/includes/specials/SpecialRevisiondelete.php:53381,56967,60970
/trunk/phase3/includes/specials/SpecialRevisiondelete.php:63045,63047,63549,63764,63897-63901,64846,64860,64862,66793
Index: branches/wmf/1.16wmf4/languages/messages/MessagesEn.php
@@ -1510,6 +1510,8 @@
15111511 'logdelete-failure' => "'''Log visibility could not be set:'''
15121512 $1",
15131513 'revdel-restore' => 'change visibility',
 1514+'revdel-restore-deleted' => 'deleted revisions',
 1515+'revdel-restore-visible' => 'visible revisions',
15141516 'pagehist' => 'Page history',
15151517 'deletedhist' => 'Deleted history',
15161518 'revdelete-content' => 'content',
Property changes on: branches/wmf/1.16wmf4/languages/messages/MessagesEn.php
___________________________________________________________________
Name: svn:mergeinfo
15171519 - /branches/wmf/1.16wmf3/languages/messages/MessagesEn.php:64760
/branches/wmf-deployment/languages/messages/MessagesEn.php:60970
/trunk/phase3/languages/messages/MessagesEn.php:63545-63546,63549,63643,63764,63897-63901,64784,64786,64789,64800,64851,64876,65027,65112
15181520 + /branches/wmf/1.16wmf3/languages/messages/MessagesEn.php:64760
/branches/wmf-deployment/languages/messages/MessagesEn.php:60970
/trunk/phase3/languages/messages/MessagesEn.php:63545-63546,63549,63643,63764,63897-63901,64784,64786,64789,64800,64851,64876,65027,65112,66823

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r66793Ugly temporary fix for bug 21279:...werdna14:19, 23 May 2010
r66823Add messages for r66793werdna12:47, 24 May 2010

Status & tagging log