Add Linker::link flag for using article path (reapplying from r41410, was not a part...
authorMatt Johnston <mattj@users.mediawiki.org>
Thu, 2 Oct 2008 21:04:36 +0000 (21:04 +0000)
committerMatt Johnston <mattj@users.mediawiki.org>
Thu, 2 Oct 2008 21:04:36 +0000 (21:04 +0000)
includes/Linker.php

index dd899fe..bc9eb69 100644 (file)
@@ -204,8 +204,18 @@ class Linker {
                }
                wfProfileOut( __METHOD__ . '-checkPageExistence' );
 
+               $oldquery = array();
+               if( in_array( "forcearticlepath", $options ) && $query ){
+                       $oldquery = $query;
+                       $query = array();
+               }
+
                # Note: we want the href attribute first, for prettiness.
                $attribs = array( 'href' => $this->linkUrl( $target, $query, $options ) );
+               if( in_array( 'forcearticlepath', $options ) && $oldquery ){
+                       $attribs['href'] = wfAppendQuery( $attribs['href'], wfArrayToCgi( $oldquery ) );
+               }
+
                $attribs = array_merge(
                        $attribs,
                        $this->linkAttribs( $target, $customAttribs, $options )