You are here

function taxonomy_defaults_update_6101 in Taxonomy Defaults 7

Same name and namespace in other branches
  1. 6.2 taxonomy_defaults.install \taxonomy_defaults_update_6101()
  2. 6 taxonomy_defaults.install \taxonomy_defaults_update_6101()

Update taxonomy defaults weighting. Previous versions of taxonomy defaults had to run BEFORE taxonomy, but now it must run AFTER taxonomy

File

./taxonomy_defaults.install, line 81
Install, update and uninstall functions for the taxonomy_defaults module.

Code

function taxonomy_defaults_update_6101() {
  $ret = array();
  $weight = 0;
  $query = "SELECT weight FROM {system} WHERE type = 'module' AND status = 1 and name = 'taxonomy'";
  $result = db_query("SELECT weight FROM {system} WHERE type = :type AND status = :status and name = :name", array(
    ':type' => 'module',
    ':status' => 1,
    ':name' => 'taxonomy',
  ));
  if ($row = db_fetch_object($result)) {
    $weight = $row->weight;
  }
  $weight = $weight + 1;

  // TODO Please convert this statement to the D7 database API syntax.
  db_query("UPDATE {system} SET weight = " . $weight . " WHERE name = 'taxonomy_defaults'");

  // hook_update_N() no longer returns a $ret array. Instead, return
  // nothing or a translated string indicating the update ran successfully.
  // See http://drupal.org/node/224333#update_sql.
  return t('TODO Add a descriptive string here to show in the UI.');
}