bug #73: category sortkeys are set to "Special:Upload" instead of the
authorErik Moeller <erik@users.mediawiki.org>
Sat, 21 May 2005 16:56:50 +0000 (16:56 +0000)
committerErik Moeller <erik@users.mediawiki.org>
Sat, 21 May 2005 16:56:50 +0000 (16:56 +0000)
filename when categories are added from the upload screen.

includes/Article.php
includes/OutputPage.php

index dd64784..4f080c5 100644 (file)
@@ -1207,7 +1207,13 @@ class Article {
 
                # Parse the text and replace links with placeholders
                $wgOut = new OutputPage();
-               $wgOut->addWikiText( $text );
+               
+               # Pass the current title along (use linestart default)
+               # in case we're creating a wiki page which is different
+               # than the currently displayed one (e.g. image pages
+               # craeted on file uploads); otherwise, link updates will 
+               # go wrong.
+               $wgOut->addWikiText( $text, true, $this->mTitle );
 
                # Look up the links in the DB and add them to the link cache
                $wgOut->transformBuffer( RLH_FOR_UPDATE );
@@ -1972,7 +1978,6 @@ class Article {
                $shortTitle = $this->mTitle->getDBkey();
 
                $adj = $this->mCountAdjustment;
-
                if ( 0 != $id ) {
                        $u = new LinksUpdate( $id, $title );
                        array_push( $wgDeferredUpdateList, $u );
index aa3d46f..8b21f53 100644 (file)
@@ -228,10 +228,10 @@ class OutputPage {
        /**
         * Convert wikitext to HTML and add it to the buffer
         */
-       function addWikiText( $text, $linestart = true ) {
+       function addWikiText( $text, $linestart = true, &$titleObj=false ) {
                global $wgParser, $wgTitle, $wgUseTidy;
-
-               $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions, $linestart );
+               $title = $titleObj ? $titleObj : $wgTitle;
+               $parserOutput = $wgParser->parse( $text, $title, $this->mParserOptions, $linestart );
                $this->mLanguageLinks += $parserOutput->getLanguageLinks();
                $this->mCategoryLinks += $parserOutput->getCategoryLinks();
                $this->addHTML( $parserOutput->getText() );