You are here

function flag_lists_uninstall in Flag Lists 7

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

Implements hook_uninstall().

File

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

Code

function flag_lists_uninstall() {

  // Remove our template flags.
  $query = db_select('flag_lists_types', 'fl');
  $query
    ->leftJoin('flags', 'f', 'fl.name = f.name');
  $query
    ->addField('fl', 'fid', 'fid');
  $query
    ->distinct();
  $fids = $query
    ->execute();
  foreach ($fids as $fid) {
    db_delete('flags')
      ->condition('fid', $fid->fid);
    db_delete('flag_content')
      ->condition('fid', $fid->fid);
    db_delete('flag_types')
      ->condition('fid', $fid->fid);
    db_delete('flag_counts')
      ->condition('fid', $fid->fid);
  }
  db_delete('variable')
    ->condition('name', 'flag_lists%', 'LIKE');
  drupal_set_message(t('Flag lists has been uninstalled.'));
}