You are here

function hosting_site_data_node_update in Hosting 7.3

Same name and namespace in other branches
  1. 7.4 example/site_data/hosting_site_data.module \hosting_site_data_node_update()

Implements hook_node_update().

File

example/site_data/hosting_site_data.module, line 46
The hosting site data example.

Code

function hosting_site_data_node_update($node) {
  if (FALSE === db_query("SELECT site_data FROM {hosting_site_data} WHERE vid = :vid", array(
    ':vid' => $node->vid,
  ))
    ->fetchField()) {
    hosting_site_data_node_insert($node);
  }
  else {
    db_update('hosting_site_data')
      ->fields(array(
      'site_data' => $node->site_data,
    ))
      ->condition('vid', $node->vid)
      ->execute();
  }
}