From 52a40adc04676a729bcb7ad4e50bcdfb9a09d59f Mon Sep 17 00:00:00 2001 From: Daniel Cannon Date: Tue, 4 Dec 2007 23:05:58 +0000 Subject: [PATCH] * Add "show all" option to Special:Undelete when some revisions are excluded, despite that showing all revisions may fail less than gracefully. --- RELEASE-NOTES | 2 ++ includes/SpecialUndelete.php | 17 ++++++++++++----- languages/messages/MessagesEn.php | 4 +++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0dcc80f593..9c1385cfda 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -90,6 +90,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Only show most recent 5000 revisions on Special:Undelete by default. Accept limit and offset parameters. Undelete with no revisions selected still undeletes all revisions, regardless of how many are displayed. +* Add "show all" option to Special:Undelete when some revisions are excluded, + despite that showing all revisions may fail less than gracefully. === Bug fixes in 1.12 === diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 2175b6670c..482aac1938 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -102,14 +102,16 @@ class PageArchive { 'ar_title' => $this->title->getDBkey() ); if ( $startTime && is_numeric($startTime) ) $whereClause[] = "ar_timestamp < $startTime"; - + + $optionsClause = array( 'ORDER BY' => 'ar_timestamp DESC' ); + if ( $limit > 0 ) $optionsClause['LIMIT'] = intval($limit); + $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( 'archive', array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment', 'ar_len' ), $whereClause, 'PageArchive::listRevisions', - array( 'ORDER BY' => 'ar_timestamp DESC', - 'LIMIT' => intval($limit) ) ); + $optionsClause ) ; $ret = $dbr->resultObject( $res ); return $ret; } @@ -855,6 +857,8 @@ class UndeleteForm { $tmpLimit = (is_null($tmpLimit))? 5001 : $tmpLimit + 1; $revisions = $archive->listRevisions( $wgRequest->getVal ( 'offset' ), $tmpLimit ); + if ( $tmpLimit < 1 ) $tmpLimit = $revisions->numRows() + 1; + $files = $archive->listFiles(); $haveRevisions = $revisions && $revisions->numRows() > 0; @@ -871,10 +875,13 @@ class UndeleteForm { $offset = 0; $titleObj = SpecialPage::getTitleFor ( 'Undelete' ); - $tmplink = $sk->makeKnownLinkObj ( $titleObj, wfMsg( 'undelete-next-revs', 5000 ), + $nextLink = $sk->makeKnownLinkObj ( $titleObj, wfMsg( 'undelete-next-revs', 5000 ), "target={$this->mTarget}&limit=5000&offset=$offset" ); + + $allLink = $sk->makeKnownLinkObj ( $titleObj, wfMsg( 'undelete-show-all' ), + "target={$this->mTarget}&limit=-1&offset=0" ); - $wgOut->addHTML ( wfMsg ( 'undelete-more-revs', $tmpLimit - 1, $tmplink ) ); + $wgOut->addHTML ( wfMsg ( 'undelete-more-revs', $tmpLimit - 1, $nextLink, $allLink ) ); $hasMore = true; } # Batch existence check on user and talk pages diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index af01d52981..d40dee6c40 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2007,8 +2007,10 @@ Consult the [[Special:Log/delete|deletion log]] for a record of recent deletions 'undelete-error-short' => 'Error undeleting file: $1', 'undelete-error-long' => "Errors were encountered while undeleting the file:\n\n$1", 'undelete-more-revs' => 'WARNING! This page has more deleted revisions than are displayed here.
-$1 revisions are displayed below. You may select revisions from this list or select none to restore all revisions (including those not displayed). ($2)', +$1 revisions are displayed below. You may select revisions from this list or select none to restore all revisions (including those not displayed).
+($2) ($3)', 'undelete-next-revs' => 'View next $1 revisions', +'undelete-show-all' => 'Show all revisions', # Namespace form on various pages 'namespace' => 'Namespace:', -- 2.20.1