You are here

function flag_uninstall in Flag 5

Same name and namespace in other branches
  1. 6.2 flag.install \flag_uninstall()
  2. 6 flag.install \flag_uninstall()
  3. 7.3 flag.install \flag_uninstall()
  4. 7.2 flag.install \flag_uninstall()

Implementation of hook_uninstall().

1 call to flag_uninstall()
flag_views_bookmark_update_prepare in includes/flag.views_bookmark.inc
Prepare for the Views Bookmark to Flag migration.

File

./flag.install, line 158
Flag module install/update hooks.

Code

function flag_uninstall() {
  db_query('DROP TABLE {flags}');
  db_query('DROP TABLE {flag_content}');
  db_query('DROP TABLE {flag_types}');
  db_query('DROP TABLE {flag_counts}');
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query('DELETE FROM {sequences} WHERE name = "{flags}_fid"');
      break;
    case 'pgsql':
      db_query("DROP SEQUENCE {flags}_fid_seq");
      break;
  }
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'flag_%'");
  while ($row = db_fetch_object($result)) {
    variable_del($row->name);
  }
  drupal_set_message(t('Flag has been uninstalled.'));
}