Index: trunk/phase3/includes/SpecialUndelete.php |
— | — | @@ -97,14 +97,19 @@ |
98 | 98 | * |
99 | 99 | * @return ResultWrapper |
100 | 100 | */ |
101 | | - function listRevisions() { |
| 101 | + function listRevisions( $startTime, $limit ) { |
| 102 | + $whereClause = array( 'ar_namespace' => $this->title->getNamespace(), |
| 103 | + 'ar_title' => $this->title->getDBkey() ); |
| 104 | + if ( $startTime ) |
| 105 | + $whereClause[] = "ar_timestamp < $startTime"; |
| 106 | + |
102 | 107 | $dbr = wfGetDB( DB_SLAVE ); |
103 | 108 | $res = $dbr->select( 'archive', |
104 | 109 | array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment', 'ar_len' ), |
105 | | - array( 'ar_namespace' => $this->title->getNamespace(), |
106 | | - 'ar_title' => $this->title->getDBkey() ), |
| 110 | + $whereClause, |
107 | 111 | 'PageArchive::listRevisions', |
108 | | - array( 'ORDER BY' => 'ar_timestamp DESC' ) ); |
| 112 | + array( 'ORDER BY' => 'ar_timestamp DESC', |
| 113 | + 'LIMIT' => intval($limit) ) ); |
109 | 114 | $ret = $dbr->resultObject( $res ); |
110 | 115 | return $ret; |
111 | 116 | } |
— | — | @@ -822,7 +827,7 @@ |
823 | 828 | } |
824 | 829 | |
825 | 830 | /* private */ function showHistory() { |
826 | | - global $wgLang, $wgContLang, $wgUser, $wgOut; |
| 831 | + global $wgLang, $wgContLang, $wgUser, $wgOut, $wgRequest; |
827 | 832 | |
828 | 833 | $sk = $wgUser->getSkin(); |
829 | 834 | if ( $this->mAllowed ) { |
— | — | @@ -846,12 +851,28 @@ |
847 | 852 | } |
848 | 853 | |
849 | 854 | # List all stored revisions |
850 | | - $revisions = $archive->listRevisions(); |
| 855 | + $tmpLimit = $wgRequest->getIntOrNull ( 'limit' ); |
| 856 | + $tmpLimit = (is_null($tmpLimit))? 5001 : $tmpLimit + 1; |
| 857 | + $revisions = $archive->listRevisions( $wgRequest->getVal ( 'offset' ), |
| 858 | + $tmpLimit ); |
851 | 859 | $files = $archive->listFiles(); |
852 | 860 | |
853 | 861 | $haveRevisions = $revisions && $revisions->numRows() > 0; |
854 | 862 | $haveFiles = $files && $files->numRows() > 0; |
855 | 863 | |
| 864 | + $hasMore = false; |
| 865 | + if ( $revisions && $revisions->numRows() >= $tmpLimit ) { |
| 866 | + $revisions->seek ( $revisions->numRows() - 2 ); |
| 867 | + $tmp = $revisions->fetchObject(); |
| 868 | + $revisions->rewind ( ); |
| 869 | + |
| 870 | + $titleObj = SpecialPage::getTitleFor ( 'Undelete' ); |
| 871 | + $tmplink = $sk->makeKnownLinkObj ( $titleObj, wfMsg( 'undelete-next-revs', 5000 ), |
| 872 | + "target={$this->mTarget}&limit=5000&offset={$tmp->ar_timestamp}" ); |
| 873 | + |
| 874 | + $wgOut->addHTML ( wfMsg ( 'undelete-more-revs', $tmpLimit - 1, $tmplink ) ); |
| 875 | + $hasMore = true; |
| 876 | + } |
856 | 877 | # Batch existence check on user and talk pages |
857 | 878 | if( $haveRevisions ) { |
858 | 879 | $batch = new LinkBatch(); |
— | — | @@ -935,16 +956,17 @@ |
936 | 957 | $target = urlencode( $this->mTarget ); |
937 | 958 | $remaining = $revisions->numRows(); |
938 | 959 | $earliestLiveTime = $this->getEarliestTime( $this->mTargetObj ); |
939 | | - |
940 | | - while( $row = $revisions->fetchObject() ) { |
941 | | - $remaining--; |
| 960 | + |
| 961 | + if ( $hasMore ) $remaining --; |
| 962 | + |
| 963 | + while( ( $row = $revisions->fetchObject() ) && $remaining-- ) { |
942 | 964 | $ts = wfTimestamp( TS_MW, $row->ar_timestamp ); |
943 | 965 | if ( $this->mAllowed ) { |
944 | 966 | $checkBox = Xml::check( "ts$ts" ); |
945 | 967 | $pageLink = $sk->makeKnownLinkObj( $titleObj, |
946 | 968 | $wgLang->timeanddate( $ts, true ), |
947 | 969 | "target=$target×tamp=$ts" ); |
948 | | - if( ($remaining > 0) || |
| 970 | + if( ($remaining > 0 || $hasMore ) || |
949 | 971 | ($earliestLiveTime && $ts > $earliestLiveTime ) ) { |
950 | 972 | $diffLink = '(' . |
951 | 973 | $sk->makeKnownLinkObj( $titleObj, |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2006,6 +2006,9 @@ |
2007 | 2007 | 'It may have already been undeleted.', |
2008 | 2008 | 'undelete-error-short' => 'Error undeleting file: $1', |
2009 | 2009 | 'undelete-error-long' => "Errors were encountered while undeleting the file:\n\n$1", |
| 2010 | +'undelete-more-revs' => '<b><font style="color: red">WARNING!</font> This page has more deleted revisions than are displayed here.</b><br /> |
| 2011 | +$1 revisions are displayed below. You may select revisions from this list or select none to restore all revisions (including those not displayed). ($2)', |
| 2012 | +'undelete-next-revs' => 'View next $1 revisions', |
2010 | 2013 | |
2011 | 2014 | # Namespace form on various pages |
2012 | 2015 | 'namespace' => 'Namespace:', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -87,6 +87,9 @@ |
88 | 88 | does not exists |
89 | 89 | * (bug 8396) Ignore out-of-date serialised message caches |
90 | 90 | * (bug 12195) Undeleting pages now requires 'undelete' permission |
| 91 | +* Only show most recent 5000 revisions on Special:Undelete by default. Accept |
| 92 | + limit and offset parameters. Undelete with no revisions selected still |
| 93 | + undeletes all revisions, regardless of how many are displayed. |
91 | 94 | |
92 | 95 | === Bug fixes in 1.12 === |
93 | 96 | |