* (bug 16434) Fix paging on Special:Prefixindex when prefix is empty (whole namespace).
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 30 Nov 2011 22:38:39 +0000 (22:38 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 30 Nov 2011 22:38:39 +0000 (22:38 +0000)
Tweaked input handling to make sure the 'from' => 'prefix' mapping doesn't happen if we have passed a namespace parameter (indicating we're working within the form). Tweaked the form paging links to include the NS even if it's 0. :)
Originally wanted to just check for presence of 'prefix' however wfArrayToCgi() strips empty values, and I'm not comfortable tweaking that without a lot more testing.

includes/specials/SpecialPrefixindex.php

index 43b7d27..3252365 100644 (file)
@@ -65,8 +65,9 @@ class SpecialPrefixindex extends SpecialAllpages {
                        $showme = $par;
                } elseif( $prefix != '' ) {
                        $showme = $prefix;
-               } elseif( $from != '' ) {
+               } elseif( $from != '' && $ns === null ) {
                        // For back-compat with Special:Allpages
+                       // Don't do this if namespace is passed, so paging works when doing NS views.
                        $showme = $from;
                }
 
@@ -216,10 +217,11 @@ class SpecialPrefixindex extends SpecialAllpages {
                                        'prefix' => $prefix
                                );
 
-                               if( $namespace ) {
+                               if( $namespace || ($prefix == '')) {
+                                       // Keep the namespace even if it's 0 for empty prefixes.
+                                       // This tells us we're not just a holdover from old links.
                                        $query['namespace'] = $namespace;
                                }
-
                                $nextLink = Linker::linkKnown(
                                                $self,
                                                wfMsgHtml( 'nextpage', str_replace( '_',' ', htmlspecialchars( $s->page_title ) ) ),