You are here

function hosting_site_load in Hosting 7.3

Same name and namespace in other branches
  1. 5 site/hosting_site.module \hosting_site_load()
  2. 6.2 site/hosting_site.nodeapi.inc \hosting_site_load()
  3. 7.4 site/hosting_site.nodeapi.inc \hosting_site_load()

Implements hook_load().

File

site/hosting_site.nodeapi.inc, line 406
Site nodeapi implementations.

Code

function hosting_site_load($nodes) {
  foreach ($nodes as $nid => &$node) {
    $additions = db_query('SELECT  client, db_server, db_name, platform, profile, web_server, publish_path,
        language AS site_language, last_cron, cron_key, s.status AS site_status,
        p.status AS platform_status, s.verified, p.verified as platform_verified
      FROM {hosting_site} s
        LEFT JOIN {hosting_platform} p ON s.platform = p.nid
      WHERE s.vid = :vid', array(
      ':vid' => $node->vid,
    ))
      ->fetch();
    foreach ($additions as $property => &$value) {
      $node->{$property} = is_numeric($value) ? (int) $value : $value;
    }
  }

  // Create a "servers" array based on our two base servers.
  $node->servers['web'] = node_load($node->web_server);
  $node->servers['db'] = node_load($node->db_server);
}