> You're probably doing something like
> 
> global $wgOut;
> $oldOut = $wgOut;
> $wgOut->disable();
> // do API call
> $wgOut = $oldOut;
> 
> If that doesn't work, try to replace the second line with $oldOut =
> clone $wgOut;

Aha!  That did the trick.  I take it 'clone' does a deep copy?

I did some experimenting and you don't need to save $wgRequest, but you do
need to save $wgTitle.  $wgTitle doesn't need to be cloned, but $wgOut does.
Once you clone $wgOut, you don't need to disable it.  (But it probably can't
hurt, maybe it might make things more efficient?)

Perhaps this could be added to the Edit API as a temporary workaround until
the 'FIXME' part gets fixed?

At any rate it's working now, so thanks very much for your help!  Again, here
is the working code in full:

  $o = clone $wgOut;
  //$wgOut->disable();  // not necessary with clone
  $t = $wgTitle;
  $req = new FauxRequest(array(
    'action' => 'edit',
    'bot' => true,
    'token' => $p['edittoken'],
    'title' => $p['title'],
    'summary' => $this->strSummary,
    'text' => $newContent,
    'basetimestamp' => $p['starttimestamp']
  ), true);
  $processor = new ApiMain($req, true);
  $processor->execute();
  $wgTitle = $t;
  $wgOut = $o;

Cheers,
Adam.

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

Reply via email to