* (bug 8777) Suppress 'previous' link on Special:Allpages when at first page
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 26 Jan 2007 09:24:28 +0000 (09:24 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 26 Jan 2007 09:24:28 +0000 (09:24 +0000)
There was a check for explicit 'from' the first title, but not for empty from. :P

RELEASE-NOTES
includes/SpecialAllpages.php

index 5c02bac..11e2917 100644 (file)
@@ -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 ==
 
index 40acd0a..398a596 100644 (file)
@@ -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;
+                               }
                        }
                }