You are here

function flag_lists_uninstall in Flag Lists 6

Same name and namespace in other branches
  1. 7.3 flag_lists.install \flag_lists_uninstall()
  2. 7 flag_lists.install \flag_lists_uninstall()

File

./flag_lists.install, line 184
The Flag lists module install file.

Code

function flag_lists_uninstall() {

  // Remove our template flags.
  if (module_exists(flag)) {
    $names = db_fetch_array(db_query("SELECT DISTINCT fid from {flag_lists_types} fl LEFT JOIN {flags} f on fl.name = f.name"));
    if (count($fids)) {
      foreach ($fids as $fid) {
        db_query('DELETE FROM {flags} WHERE fid = %d', $this->fid);
        db_query('DELETE FROM {flag_content} WHERE fid = %d', $this->fid);
        db_query('DELETE FROM {flag_types} WHERE fid = %d', $this->fid);
        db_query('DELETE FROM {flag_counts} WHERE fid = %d', $this->fid);
      }
    }
  }
  drupal_uninstall_schema('flag_lists');
  db_query("DELETE FROM {variable} WHERE name LIKE 'flag_lists%'");
  drupal_set_message(t('Flag lists has been uninstalled.'));
}