Skip to content
Snippets Groups Projects
Commit 8a7ca1dc authored by Jim Berry's avatar Jim Berry
Browse files

Enhance clean up actions in hook_uninstall().

  Delete realm variables and realm settings.
  Remove the snippet directory.
parent b7019df0
No related branches found
Tags 7.x-1.2-rc3
No related merge requests found
......@@ -21,6 +21,30 @@ function google_tag_uninstall() {
db_delete('variable')
->condition('name', db_like('google_tag_') . '%', 'LIKE')
->execute();
if (module_exists('variable_realm') && module_exists('variable_store')) {
db_delete('variable_store')
->condition('name', db_like('google_tag_') . '%', 'LIKE')
->execute();
// Remove variables from realm variable list.
$realms = variable_realm_list();
foreach ($realms as $realm => $label) {
$variables = variable_get('variable_realm_list_' . $realm, array());
if ($variables) {
foreach ($variables as $key => $variable) {
if (substr($variable, 0, 10) == 'google_tag') {
unset($variables[$key]);
}
}
variable_set('variable_realm_list_' . $realm, $variables);
}
}
}
@file_unmanaged_delete_recursive('public://google_tag');
// @todo Is this relevant here or in _google_tag_snippets_save()?
drupal_clear_js_cache();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment