Index: branches/wmf/1.16wmf4/includes/LogEventsList.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | if( !isset( $this->message ) ) { |
42 | 42 | $messages = array( 'revertmerge', 'protect_change', 'unblocklink', 'change-blocklink', |
43 | 43 | 'revertmove', 'undeletelink', 'undeleteviewlink', 'revdel-restore', 'hist', 'diff', |
44 | | - 'pipe-separator' ); |
| 44 | + 'pipe-separator', 'revdel-restore-deleted', 'revdel-restore-visible' ); |
45 | 45 | foreach( $messages as $msg ) { |
46 | 46 | $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) ); |
47 | 47 | } |
— | — | @@ -391,57 +391,8 @@ |
392 | 392 | ) . ')'; |
393 | 393 | // If an edit was hidden from a page give a review link to the history |
394 | 394 | } 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 ); |
446 | 397 | // Hidden log items, give review link |
447 | 398 | } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'event', 'deletedhistory' ) ) { |
448 | 399 | if( count($paramArray) >= 1 ) { |
Property changes on: branches/wmf/1.16wmf4/includes/LogEventsList.php |
___________________________________________________________________ |
Name: svn:mergeinfo |
449 | 400 | + /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 @@ |
698 | 698 | return null; |
699 | 699 | } |
700 | 700 | } |
| 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 | + } |
701 | 838 | } |
702 | 839 | |
703 | 840 | /** |
Property changes on: branches/wmf/1.16wmf4/includes/specials/SpecialRevisiondelete.php |
___________________________________________________________________ |
Name: svn:mergeinfo |
704 | 841 | + /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 @@ |
1511 | 1511 | 'logdelete-failure' => "'''Log visibility could not be set:''' |
1512 | 1512 | $1", |
1513 | 1513 | 'revdel-restore' => 'change visibility', |
| 1514 | +'revdel-restore-deleted' => 'deleted revisions', |
| 1515 | +'revdel-restore-visible' => 'visible revisions', |
1514 | 1516 | 'pagehist' => 'Page history', |
1515 | 1517 | 'deletedhist' => 'Deleted history', |
1516 | 1518 | 'revdelete-content' => 'content', |
Property changes on: branches/wmf/1.16wmf4/languages/messages/MessagesEn.php |
___________________________________________________________________ |
Name: svn:mergeinfo |
1517 | 1519 | - /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 |
1518 | 1520 | + /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 |