From: Brion Vibber Date: Fri, 26 Jan 2007 09:24:28 +0000 (+0000) Subject: * (bug 8777) Suppress 'previous' link on Special:Allpages when at first page X-Git-Tag: 1.31.0-rc.0~54180 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=64522a7f90e9697e4e0794fcc2d26344da03b298;p=lhc%2Fweb%2Fwiklou.git * (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 --- 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; + } } }