You are here

function hosting_lets_encrypt_queue in Aegir HTTPS 7.3

Implements hosting_QUEUE_TYPE_queue().

The main queue callback for refreshing Let's Encrypt certificates. We simply need to run a Verify task on each applicable site, as certificates get renewed there if they're close to their expiry dates.

Parameters

int $count: The maximum number of items to queue.

File

submodules/letsencrypt/hosting_letsencrypt.module, line 50
LetsEncrypt certificate generation service.

Code

function hosting_lets_encrypt_queue($count) {
  foreach (hosting_letsencrypt_get_sites(TRUE, $count) as $site_id) {

    /* @todo Ideally we'd be running this in the backend directly. */
    if ($task = hosting_add_task($site_id, 'verify')) {
      watchdog('hosting_letsencrypt', 'Certificate renewal: Queuing Verify task ID %task for site %site with ID %id', array(
        '%task' => $task->nid,
        '%site' => node_load($site_id)->title,
        '%id' => $site_id,
      ));
    }
    else {
      watchdog('hosting_letsencrypt', 'Certificate renewal: Failed to queue Verify task for site %site with ID %id', array(
        '%site' => node_load($site_id)->title,
        '%id' => $site_id,
      ));
    }
  }
}