(bug 31549; follow-up r83563) Do not include old-style from links in nav links on...
authorBrian Wolff <bawolff@users.mediawiki.org>
Sun, 9 Oct 2011 03:50:03 +0000 (03:50 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Sun, 9 Oct 2011 03:50:03 +0000 (03:50 +0000)
They can intefere with contradicting pageuntil links which breaks navigation in categories.

Not including release notes since tagging 1.18, and first public release that had bug was 1.18. However bug was present in 1.17wmf1

includes/CategoryPage.php

index 8e7ee64..1c9585f 100644 (file)
@@ -68,14 +68,27 @@ class CategoryPage extends Article {
                // Use these as defaults for back compat --catrope
                $oldFrom = $wgRequest->getVal( 'from' );
                $oldUntil = $wgRequest->getVal( 'until' );
+
+               $reqArray = $wgRequest->getValues();
                
                $from = $until = array();
                foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
                        $from[$type] = $wgRequest->getVal( "{$type}from", $oldFrom );
                        $until[$type] = $wgRequest->getVal( "{$type}until", $oldUntil );
+
+                       // Do not want old-style from/until propagating in nav links.
+                       if ( !isset( $reqArray["{$type}from"] ) && isset( $reqArray["from"] ) ) {
+                               $reqArray["{$type}from"] = $reqArray["from"];
+                       }
+                       if ( !isset( $reqArray["{$type}to"] ) && isset( $reqArray["to"] ) ) {
+                               $reqArray["{$type}to"] = $reqArray["to"];
+                       }
                }
 
-               $viewer = new $this->mCategoryViewerClass( $this->mTitle, $from, $until, $wgRequest->getValues() );
+               unset( $reqArray["from"] );
+               unset( $reqArray["to"] );
+
+               $viewer = new $this->mCategoryViewerClass( $this->mTitle, $from, $until, $reqArray );
                $wgOut->addHTML( $viewer->getHTML() );
        }
 }