You are here

function rotor_uninstall in Rotor Banner 7

Same name and namespace in other branches
  1. 5.7 rotor.install \rotor_uninstall()
  2. 5 rotor.install \rotor_uninstall()
  3. 6.2 rotor.install \rotor_uninstall()
  4. 6 rotor.install \rotor_uninstall()

Implementation of hook_uninstall().

File

./rotor.install, line 41
Provides install and uninstall functions for rotor.

Code

function rotor_uninstall() {
  $result = db_query("SELECT nid FROM {node} WHERE type = 'rotor_item'");
  if ($result) {
    while ($node = db_fetch_array($result)) {
      node_delete($node);
    }
  }
  drupal_uninstall_schema('rotor');
  db_query("DELETE FROM {variable} WHERE name LIKE 'rotor_%'");
  $ret = array();
  $displays = array(
    'rotor',
  );
  $result = db_query("SELECT DISTINCT vid FROM {views_display} WHERE display_plugin IN ('" . implode("','", $displays) . "')");
  while ($row = db_fetch_array($result)) {
    db_query("DELETE FROM {views_view} WHERE vid = %d", $row['vid']);
    db_query("DELETE FROM {views_display} WHERE vid = %d", $row['vid']);
  }
  db_query("DELETE FROM {cache_views}");
  return $ret;
  drupal_set_message(t('Rotor Banner unistalled'));
}