On Fri, Nov 4, 2016 at 9:09 PM Chad <innocentkil...@gmail.com> wrote:

> On Fri, Nov 4, 2016 at 3:53 PM Gergo Tisza <gti...@wikimedia.org> wrote:
>
> On Fri, Nov 4, 2016 at 12:15 PM, Daniel Barrett <d...@cimpress.com> wrote:
>
> Never mind, I got it working. Just add those URL query parameters to the
> WebRequest object that's being used:
>
>         RequestContext::getMain()->getRequest()->setVal('bar', 1');
>
> Then pass the WebRequest object to the DerivativeRequest (first
> parameter). Works great!
>
>
> RequestContext::getMain()->getRequest() describes the current request, so
> you'll probably want to create a DerivativeRequest from that and then only
> change the parameters in the DerivativeRequest.
> https://www.mediawiki.org/wiki/API:Calling_internally has examples.
>
>
> If you're doing this from within a parser function or hook (which is what
> it
> sounds like), you'll want to make sure you disable the cache for the given
> pages it's used on from within your callback function. Otherwise results
> will get wonky :)
>
> $parser->disableCache();
>
> -Chad
>

Gah, pressed send a little quickly. I also wanted to add:

A caveat though: I would be a little suspicious of code that involves
putting request parameters into the page output. Need to handle
both proper escaping *as well as* the case when you're being parsed
from a non-web request (like a jobqueue job).

-Chad
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to