Handle some extra cases in triggerJobs()

* $wgEnableAPI may be false, though it is a basic part of MediaWiki.
  This only disables api.php and not internal callers so just do that.
* Various socket functions may disabled. Though this is a terrible
  wack-a-mole security measure to handle MediaWiki exploits or
  non-authenticated services, it may still be in use, so work
  around it.

Change-Id: I54a209e003ffce1fe36a5898fe0da735cf5e32e4