You are here

function hosting_client_update_6003 in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 client/hosting_client.install \hosting_client_update_6003()
  2. 7.3 client/hosting_client.install \hosting_client_update_6003()

Implements hook_update_N().

Remove duplicate client nodes.

Those may have been created in development versions of 2.x code, see https://drupal.org/node/1146014

File

client/hosting_client.install, line 339
Define database schema, install and update functions for the hosting_client module.

Code

function hosting_client_update_6003() {
  $q = db_query("SELECT n.nid FROM {node} n LEFT JOIN {hosting_client} hc ON n.nid = hc.nid WHERE n.type = 'client' AND hc.nid IS NULL;");
  while ($nid = db_result($q)) {
    node_delete($nid);
  }
  return array();

  // never fail
}