Do not assume that PHP_SAPI is cli when running jobs
It (probably) isn't on WMF
This passes an explicit parameter from where the method is called in the
job. This is a bit hacky since the parameter isn't in all the base
classes. Perhaps this could form a temporary solution to the immediate
I should note, I believe this would work, however I have not tested
it with WMFs actual config...