You are here

function ultimate_cron_poorman_trigger in Ultimate Cron 7.2

Send the actual HTTP request for launching threads.

1 call to ultimate_cron_poorman_trigger()
UltimateCronSerialLauncher::launchPoorman in plugins/ultimate_cron/launcher/serial.class.php
Poormans cron launcher.

File

./ultimate_cron.poorman.inc, line 216
Poormans cron functions.

Code

function ultimate_cron_poorman_trigger() {
  $url_options = variable_get('ultimate_cron_poorman_url_options', array());
  $http_options = variable_get('ultimate_cron_poorman_http_options', array());
  $url_options = array(
    'query' => array(
      'timestamp' => REQUEST_TIME,
      'cron_key' => variable_get('cron_key', 'drupal'),
    ),
    'absolute' => TRUE,
  ) + $url_options;
  $plugin = _ultimate_cron_plugin_require('settings', 'poorman');
  $settings = $plugin
    ->getDefaultSettings();
  $http_options = array(
    'headers' => array(
      'User-Agent' => $settings['user_agent'],
    ),
  ) + $http_options;
  $url = url('admin/config/system/cron/poorman', $url_options);
  $response = drupal_http_request($url, $http_options);
  if (!empty($response->error)) {
    watchdog('ultimate_cron', 'Could not trigger poorman at @url. Error: @error', array(
      '@url' => $url,
      '@error' => $response->error,
    ), WATCHDOG_ERROR);
  }
}