private function doDispatchAsyncJobFor($type, $title, $parameters, $dispatchableCallbackJob)
 {
     $parameters['async-job'] = array('type' => $type, 'title' => $title->getPrefixedDBkey());
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_METHOD, 'POST');
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_CONTENT_TYPE, "application/x-www-form-urlencoded");
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_CONTENT, 'parameters=' . json_encode($parameters));
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_CONNECTION_FAILURE_REPEAT, 2);
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_ON_COMPLETED_CALLBACK, function ($requestResponse) {
         wfDebugLog('smw', 'SMW\\DeferredRequestDispatchManager: ' . json_encode($requestResponse->getList()) . "\n");
     });
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_ON_FAILED_CALLBACK, function ($requestResponse) use($dispatchableCallbackJob, $title, $type, $parameters) {
         wfDebugLog('smw', "SMW\\DeferredRequestDispatchManager: Connection to SpecialDeferredRequestDispatcher failed therefore adding {$type} for " . $title->getPrefixedDBkey() . "\n");
         call_user_func_array($dispatchableCallbackJob, array($title, $parameters));
     });
     $this->httpRequest->execute();
     return true;
 }
 private function doPostJobWith($type, $title, $parameters, $dispatchableCallbackJob)
 {
     // Build requestToken as source verification during the POST request
     $parameters['timestamp'] = time();
     $parameters['requestToken'] = SpecialDeferredRequestDispatcher::getRequestToken($parameters['timestamp']);
     $parameters['async-job'] = array('type' => $type, 'title' => $title->getPrefixedDBkey());
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_METHOD, 'POST');
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_CONTENT_TYPE, "application/x-www-form-urlencoded");
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_CONTENT, 'parameters=' . json_encode($parameters));
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_CONNECTION_FAILURE_REPEAT, 2);
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_ON_COMPLETED_CALLBACK, function ($requestResponse) use($parameters) {
         $requestResponse->set('type', $parameters['async-job']['type']);
         $requestResponse->set('title', $parameters['async-job']['title']);
         wfDebugLog('smw', 'SMW\\DeferredRequestDispatchManager: ' . json_encode($requestResponse->getList(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n");
     });
     $this->httpRequest->setOption(ONOI_HTTP_REQUEST_ON_FAILED_CALLBACK, function ($requestResponse) use($dispatchableCallbackJob, $title, $type, $parameters) {
         $requestResponse->set('type', $parameters['async-job']['type']);
         $requestResponse->set('title', $parameters['async-job']['title']);
         wfDebugLog('smw', "SMW\\DeferredRequestDispatchManager: Connection to SpecialDeferredRequestDispatcher failed on {$type} with " . json_encode($requestResponse->getList(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . " " . $title->getPrefixedDBkey() . "\n");
         call_user_func_array($dispatchableCallbackJob, array($title, $parameters));
     });
     $this->httpRequest->execute();
     return true;
 }
 /**
  * @since  2.0
  *
  * @param integer $timeout
  *
  * @return SparqlDatabase
  */
 public function setConnectionTimeoutInSeconds($timeout = 10)
 {
     $this->httpRequest->setOption(CURLOPT_CONNECTTIMEOUT, $timeout);
     return $this;
 }