Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-21 Thread Andreas Plank
Hi, thanks for your suggestions, at the end I found it :-) It was a closed data base connection, that prevented Title::newFrom...-methods to get articleId etc. --- the eval part --- $dbReadOnly2 = wfGetDB(DB_SLAVE); # do some stuff $dbReadOnly2-close(); # use another method that needs data base

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-16 Thread Andreas Plank
Hi Platonides (sorry I posted from a wrong Email address, I try again with a proper subject line to get the thread line correct on http://news.gmane.org/gmane.science.linguistics.wikipedia.technical) 2013/1/15 Platonides platoni...@gmail.com: I tried to get the content via getArticleID() ...

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-16 Thread Andreas Plank
Hi, One of Tyler Romeo's suggested approach is to use Article::newFromTitle($titleObj) ... but it does need a second argument of type IContextSource. I do not know how to get it or how to instantiate it yet. At the moment it does not retrieve the page content as well because of the missing

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-16 Thread Krenair
You could try RequestContext::getMain() to get the context source object. Alex Monk On 16/01/13 16:56, Andreas Plank wrote: Hi, One of Tyler Romeo's suggested approach is to use Article::newFromTitle($titleObj) ... but it does need a second argument of type IContextSource. I do not know how

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-16 Thread Andreas Plank
2013/1/16 Krenair kren...@gmail.com: You could try RequestContext::getMain() to get the context source object. Alex Monk On 16/01/13 16:56, Andreas Plank wrote: I tried many functions in various classes: RequestContext WikiPage Title Article ... but it is always the same I do not get the raw

[Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-15 Thread Andreas Plank
Hi, I'm using MW 1.20.2 and I want to get the content of a page for further parsing in a PHP application. The PHP application is triggered via a special page (Special:MobileKeyV1) and parses nature guides for mobile devices. I tried to get the content via getArticleID() ...

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-15 Thread Harsh Kothari
Hi Andreas Try this $someobj = WikiPage::newFromId( $ID ); if(is_object( $someobj ) ){ $text = $someobj-getRawText(); or you can use $text = $someobj-getText(); } else{ return true; } Thanks Harsh --- Harsh Kothari Research Fellow,

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-15 Thread Tyler Romeo
I think the best thing to do would be to just avoid getting the article ID in the first place. If you have a Title object, you can just pass that object directly to either Article::newFromTitle or to WikiPage::factory. *--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-15 Thread bawolff
While it may be true that there are better methods to call for this purpose, an article's id should be 0 if and only if it does not exist (or perhaps if its in a fake namespace like special). -bawolff On Tue, Jan 15, 2013 at 10:15 AM, Tyler Romeo tylerro...@gmail.com wrote: I think the best

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-15 Thread Tyler Romeo
That is true. Also if it's interwiki. *--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerro...@gmail.com On Tue, Jan 15, 2013 at 11:12 AM, bawolff bawolff...@gmail.com wrote: While it may be true that there are better

Re: [Wikitech-l] Problem to get an article's content in MW 1.20.2

2013-01-15 Thread Platonides
On 15/01/13 14:44, Andreas Plank wrote: Hi, I'm using MW 1.20.2 and I want to get the content of a page for further parsing in a PHP application. The PHP application is triggered via a special page (Special:MobileKeyV1) and parses nature guides for mobile devices. I tried to get the