You are here

function weight_uninstall in Weight 6

Same name and namespace in other branches
  1. 5 weight.install \weight_uninstall()
  2. 7 weight.install \weight_uninstall()

Implementation of hook_uninstall().

File

./weight.install, line 19
This module uses the sticky column of the node table to add weighting to nodes.

Code

function weight_uninstall() {

  // We need to unset any weighted nodes and reset sticky to normal values.
  $weight_node_types = variable_get('weight_node_types', array());
  if ($weight_node_types) {
    $list = implode("', '", $weight_node_types);
    db_query("UPDATE {node} n SET n.sticky = 1 WHERE n.sticky > 1 AND n.type IN ('" . $list . "')");
    db_query("UPDATE {node} n SET n.sticky = 0 WHERE n.sticky < 0 AND n.type IN ('" . $list . "')");
  }

  // Delete our variables.
  variable_del('weight_node_types');
  variable_del('weight_range');
  variable_del('weight_use_menu');
}