Article is an ancient evil. A class in charge of the presentational logic to view a page from the front-end (and I'm not even sure it's ideal for that). Endowed with a public interface to act as a model for pages.
It's PURE EVIL!!!

WikiPage the actual model for pages. Article inherits some WikiPage stuff for backwards compatibility but should never be used for that purpose.

Ideally one day we'll have a better system for outputting pages, actions, and special pages to the front-end and we'll eliminate the Article class in it's entirety.

--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

On Fri, 17 Aug 2012 09:35:02 -0700, Tyler Romeo <[email protected]> wrote:

What exactly is the difference between Article and WikiPage? It seems like
one is just an encapsulation of the other.

*--*
*Tyler Romeo*
Stevens Institute of Technology, Class of 2015
Major in Computer Science
www.whizkidztech.com | [email protected]



On Fri, Aug 17, 2012 at 12:03 PM, Daniel Friesen
<[email protected]>wrote:

On Fri, 17 Aug 2012 08:02:23 -0700, Mauricio Etchevest <
[email protected]> wrote:

 Hi,

I´m developing a extension and I need to add an article to a category.

I only get the title of the article, so I try this:

$articleToAdd = new Article($title);

$context = $articleToAdd->getContext();
$resArticle = MediaWiki::articleFromTitle($**title, $context);

$linksupdate = new LinksUpdate($resArticle->**getTitle(),
$resArticle->getParserOutput()**, $f);
$ps = $linksupdate->getParserOutput(**);
$categoriesLinks = $ps->getCategoryLinks();


..so I get all the categories for the article, but I need to add and
remove
a category.  How can I do that ?



Thanks!
Maurice.-


Firstly, don't use Article, use WikiPage.

We don't have an API to add/remove categories. So adding a category is
nothing but appending category WikiText to the end of the page. And
removing one is an ugly mess of using regexps to find some WikiText that
looks like the category link you're looking for and erasing it.

On the other hand we DO have an api for things hooked into the parser to
add categories that aren't marked up in the page (maintenance categories
from tag extensions, etc...)

--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to