On Nov 30, 2010, at 5:13 PM, Platonides wrote:

> Jim Hu wrote:
>> For the past couple of years, I've been using various scripts to mine data 
>> out of my wikis from other sites/services on the same server (but sometimes 
>> on different virtual hosts).  To do this, I've been doing something that is 
>> probably really bad coding practice - I fool maintenance/commandLine.inc 
>> into thinking it's being invoked by the command line instead of from a 
>> webserver.  
>> 
>> Typically, I'm doing something like:
>> 
>> unset($_SERVER);
>> $argv = array('foo');
>> require_once("$wikipath/maintenance/commandLine.inc");
>> 
>> # need MW stuff to create $dbr
>> $dbr =& wfGetDB( DB_SLAVE );
>> $result =  $dbr->select ( <some query>);
>> 
>> # do something with the result
>> ...
>> 
>> but we are often also using Title, Article, and/or Revision objects, 
>> Categories etc.  My approach seems to fail in MW versions post 1.14.  I'm 
>> reviewing a bunch of this code now to see if I can clean some other things 
>> up/make it easier to maintain/make it forward compatible, so I thought I'd 
>> ask the list: is there a better way to do this?  
>> 
>> Thanks!
>> 
>> Jim
> 
> 
> You could create a new style maintenance script which overrides setup()

Ah!  Of course!  Thanks.

Jim


> 
> 
> _______________________________________________
> MediaWiki-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

=====================================
Jim Hu
Associate Professor
Dept. of Biochemistry and Biophysics
2128 TAMU
Texas A&M Univ.
College Station, TX 77843-2128
979-862-4054


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

Reply via email to