You are here

function hosting_site_load in Hosting 7.4

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.3 site/hosting_site.nodeapi.inc \hosting_site_load()

Implements hook_load().

File

site/hosting_site.nodeapi.inc, line 444
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,
        file_public_path,
        file_private_path,
        file_temporary_path,
        p.status AS platform_status,
        s.verified,
        p.verified as platform_verified,
        p.git_root,
        p.git_remote,
        p.git_reference,
        p.git_docroot
      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['http'] = node_load($node->web_server);
  $node->servers['db'] = node_load($node->db_server);

  // Set default files paths if they are empty.
  $node->file_public_path = $node->file_public_path ?: 'sites/' . $node->title . '/files';
  $node->file_private_path = $node->file_private_path ?: 'sites/' . $node->title . '/private/files';
  $node->file_temporary_path = $node->file_temporary_path ?: 'sites/' . $node->title . '/private/temp';

  // Load default install_command, deploy_command, and test_command properties
  $node->commands = hosting_find_deploy_commands($node);
}