On Fri, Nov 4, 2016 at 3:53 PM Gergo Tisza gtisza@wikimedia.org wrote:
On Fri, Nov 4, 2016 at 12:15 PM, Daniel Barrett danb@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