You are here

function hosting_update_7303 in Hosting 7.4

Same name and namespace in other branches
  1. 7.3 hosting.install \hosting_update_7303()

Force a re-verification of all enabled sites.

File

./hosting.install, line 603
Define database schemas and update functions for the hosting module.

Code

function hosting_update_7303() {

  // 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 === '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');
    }
  }
}