You are here

function hosting_cron_queue in Hosting 5

Same name and namespace in other branches
  1. 6.2 cron/hosting_cron.module \hosting_cron_queue()
  2. 7.4 cron/hosting_cron.module \hosting_cron_queue()
  3. 7.3 cron/hosting_cron.module \hosting_cron_queue()

File

cron/hosting_cron.module, line 19

Code

function hosting_cron_queue($count) {
  $sites = hosting_cron_get_sites($count);
  drush_set_context('DRUSH_LOG_CALLBACK', '_hosting_watchdog');
  foreach ($sites as $site) {
    $platform = node_load($site->platform);
    $web_server = node_load($platform->web_server);
    $data['uri'] = 'http://' . $site->title;
    $data['root'] = $platform->publish_path;
    $drush_path = $web_server->drush_path;
    $hostname = null;
    $username = null;
    if ($platform->web_server != HOSTING_OWN_WEB_SERVER) {
      $hostname = $web_server->title;
      $username = $web_server->script_user;
    }
    drush_backend_fork("cron", $data, $drush_path, $hostname, $username);
    $site->revision = false;
    $site->no_verify = true;

    // do not generate verify task
    $site->last_cron = mktime();
    node_save($site);
  }
}