You are here

function _mail_edit_modules_uninstalled in Mail Editor 7

Implements hook_modules_uninstalled().

Removes templates when a module is uninstalled.

Parameters

array $modules:

1 call to _mail_edit_modules_uninstalled()
mail_edit_modules_uninstalled in ./mail_edit.module
Implements hook_modules_uninstalled().

File

./mail_edit.admin.inc, line 729
Administrative interface for the Mail Editor module.

Code

function _mail_edit_modules_uninstalled(array $modules) {
  _mail_edit_key_registry_rebuild();
  $templates = db_select('mail_edit_registry', 'mer')
    ->fields('mer')
    ->condition('mer.module', $modules, 'IN')
    ->execute();
  $ids = array();
  foreach ($templates as $template) {
    $ids[] = $template->id;
  }
  if (!empty($ids)) {
    db_delete('mail_edit')
      ->condition('id', $ids, 'IN')
      ->execute();
    db_delete('mail_edit_registry')
      ->condition('id', $ids, 'IN')
      ->execute();
  }
}