You are here

function hosting_https_update_7300 in Aegir HTTPS 7.3

Force a re-verification of all enabled SSL sites.

File

./hosting_https.install, line 121
Define the database schema and uninstall function for the hosting_https module.

Code

function hosting_https_update_7300() {

  // node_access_rebuild from the the update hook fails without the following defintion.
  if (!defined('HOSTING_ADMIN_CLIENT')) {
    define('HOSTING_ADMIN_CLIENT', variable_get('hosting_admin_client', 1));
  }
  $apache_nids = array();
  $http_servers = hosting_get_servers('http', FALSE);
  $servers = node_load_multiple(array_keys($http_servers));
  foreach ($servers as $server) {
    if (!empty($server->services['http'])) {
      if ($server->services['http']->type === 'https_apache') {
        $apache_nids[] = $server->nid;
      }
    }
  }
  if ($apache_nids) {
    $site_query = db_select('hosting_site', 'hs');
    $site_query
      ->innerJoin('hosting_platform', 'hp', 'hs.platform = hp.nid');
    $site_query
      ->addField('hs', 'nid');
    $site_query
      ->condition('hs.status', 1);
    $site_query
      ->condition('hp.status', 1);
    $site_query
      ->condition('hp.web_server', $apache_nids, 'IN');
    $result = $site_query
      ->execute();
    while ($site = $result
      ->fetch()) {
      hosting_add_task($site->nid, 'verify');
    }
  }
}