Hey Brion,
Thanks. It does look like the code that adds the category links takes place in Parser::replaceInternalLinks, which appears to be only called if Parser::parse is invoked on the article being saved. We are actually using a Special page to create request articles, so visitors can come and submit a request for how-to article to be written about, so the newly created articles are not necessarily parsed automatically. It's a slightly different approach we've been using to reduce the amount of wiki-knowledge that's required to participate in our community.
http://wiki.ehow.com/Special:RequestTopic
So it looks like the hack-workaround for this is to parse the article after inserting it into the database, that seems to do the trick for now.
$article = new Article($title); $ret = $article->insertNewArticle($details, "", false, false, false, $user); $options = ParserOptions::newFromUser( $wgUser ); $wgParser->parse($details, $title, $options);
Thanks! Travis
Date: Tue, 06 Dec 2005 11:59:53 -0800 From: Brion Vibber brion@pobox.com Subject: Re: [Wikitech-l] Article->insertNewArticle and category links To: Wikimedia developers wikitech-l@wikimedia.org Message-ID: 4395EDB9.7000907@pobox.com Content-Type: text/plain; charset="iso-8859-1"
Travis Derouin wrote:
Is there any reason why when inserting a new article from outside EditPage.php doesn't update the category links?
Shitty coding practices. ;) This stuff needs more refactoring still.
$title = Title::newFromText("Hellos"); $article = new Article($title); $ret = $article->insertNewArticle("hi there![[Category:Greetings]]", "", false, false, false)
The article is successfully created and links to the Greetings category. However, the "Greetings" category does not show the new article in the list of articles in that category.
At the moment you'll have to manually run the post-save updates; you should find several examples of this in the code.
-- brion vibber (brion @ pobox.com)
wikitech-l@lists.wikimedia.org