From 64522a7f90e9697e4e0794fcc2d26344da03b298 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 26 Jan 2007 09:24:28 +0000 Subject: [PATCH] * (bug 8777) Suppress 'previous' link on Special:Allpages when at first page There was a check for explicit 'from' the first title, but not for empty from. :P --- RELEASE-NOTES | 2 ++ includes/SpecialAllpages.php | 48 +++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5c02bacf64..11e29176cb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -149,6 +149,8 @@ lighter making things easier to read. * (bug 8652) Catch exceptions generated by malformed XML in multipage media * (bug 8782) Help text in Makefile * (bug 8780) Clarify message for command-line scripts if LocalSettings.php exists but is not readable +* (bug 8777) Suppress 'previous' link on Special:Allpages when at first page + == Languages updated == diff --git a/includes/SpecialAllpages.php b/includes/SpecialAllpages.php index 40acd0a748..398a59681b 100644 --- a/includes/SpecialAllpages.php +++ b/includes/SpecialAllpages.php @@ -260,31 +260,35 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) { if ( $including ) { $out2 = ''; } else { - - # Get the last title from previous chunk - $dbr = wfGetDB( DB_SLAVE ); - $res_prev = $dbr->select( - 'page', - 'page_title', - array( 'page_namespace' => $namespace, 'page_title < '.$dbr->addQuotes($from) ), - $fname, - array( 'ORDER BY' => 'page_title DESC', 'LIMIT' => $this->maxPerPage, 'OFFSET' => ($this->maxPerPage - 1 ) ) - ); - - # Get first title of previous complete chunk - if( $dbr->numrows( $res_prev ) >= $this->maxPerPage ) { - $pt = $dbr->fetchObject( $res_prev ); - $prevTitle = Title::makeTitle( $namespace, $pt->page_title ); + if( $from == '' ) { + // First chunk; no previous link. + $prevTitle = null; } else { - # The previous chunk is not complete, need to link to the very first title - # available in the database - $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title', array( 'page_namespace' => $namespace ), $fname, array( 'LIMIT' => 1) ); + # Get the last title from previous chunk + $dbr = wfGetDB( DB_SLAVE ); + $res_prev = $dbr->select( + 'page', + 'page_title', + array( 'page_namespace' => $namespace, 'page_title < '.$dbr->addQuotes($from) ), + $fname, + array( 'ORDER BY' => 'page_title DESC', 'LIMIT' => $this->maxPerPage, 'OFFSET' => ($this->maxPerPage - 1 ) ) + ); - # Show the previous link if it s not the current requested chunk - if( $from != $reallyFirstPage_title ) { - $prevTitle = Title::makeTitle( $namespace, $reallyFirstPage_title ); + # Get first title of previous complete chunk + if( $dbr->numrows( $res_prev ) >= $this->maxPerPage ) { + $pt = $dbr->fetchObject( $res_prev ); + $prevTitle = Title::makeTitle( $namespace, $pt->page_title ); } else { - $prevTitle = null; + # The previous chunk is not complete, need to link to the very first title + # available in the database + $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title', array( 'page_namespace' => $namespace ), $fname, array( 'LIMIT' => 1) ); + + # Show the previous link if it s not the current requested chunk + if( $from != $reallyFirstPage_title ) { + $prevTitle = Title::makeTitle( $namespace, $reallyFirstPage_title ); + } else { + $prevTitle = null; + } } } -- 2.20.1