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()