You are here

function noderelationships_update_6003 in Node Relationships 6

Enable the new 'View in new window' option in Node reference extras settings for compatibility with existing installations.

File

./noderelationships.install, line 147
Implementation of installation/uninstallation hooks.

Code

function noderelationships_update_6003() {
  $ret = array();
  $result = db_query("SELECT type_name, field_name, settings FROM {noderelationships_settings} WHERE relation_type = 'noderef'");
  while ($row = db_fetch_object($result)) {
    $settings = unserialize($row->settings);
    $settings['view_in_new_window'] = $row->field_name;
    $success = db_query("UPDATE {noderelationships_settings} SET settings = '%s' WHERE relation_type = 'noderef' AND type_name = '%s' AND field_name = '%s'", serialize($settings), $row->type_name, $row->field_name);
    $ret[] = array(
      'success' => $success !== FALSE,
      'query' => strtr("Attempt to enable the new 'View in new window' option for %field-name in %type-name.", array(
        '%type-name' => $row->type_name,
        '%field-name' => $row->field_name,
      )),
    );
  }
  return $ret;
}