You are here

function taxonomy_defaults_install in Taxonomy Defaults 7

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

Hook sets taxonomy_defaults 'weight' so that it runs after taxonomy

File

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

Code

function taxonomy_defaults_install() {
  $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.
  $ret[] = db_query("UPDATE {system} SET weight = " . $weight . " WHERE name = 'taxonomy_defaults'");
  return $ret;
}