From: Erik Moeller Date: Sat, 21 May 2005 16:56:50 +0000 (+0000) Subject: bug #73: category sortkeys are set to "Special:Upload" instead of the X-Git-Tag: 1.5.0alpha2~134 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=249ca2beb5b4a638b7b4f7d0634b3e21122cc882;p=lhc%2Fweb%2Fwiklou.git bug #73: category sortkeys are set to "Special:Upload" instead of the filename when categories are added from the upload screen. --- diff --git a/includes/Article.php b/includes/Article.php index dd64784ada..4f080c58ac 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index aa3d46f501..8b21f534c0 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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() );