function google_tag_uninstall in GoogleTagManager 7.2
Same name and namespace in other branches
- 8 google_tag.install \google_tag_uninstall()
- 7 google_tag.install \google_tag_uninstall()
Implements hook_uninstall().
File
- ./
google_tag.install, line 23 - Provides install, update, and uninstall functions.
Code
function google_tag_uninstall() {
/*
// Does not apply to 2.x branch; move to hook_update_N.
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);
}
}
}
*/
$row = db_query('SELECT * FROM {gtag_config} WHERE name = \'google_tag.settings\'')
->fetchAllKeyed();
$settings = unserialize(array_shift($row));
if (!empty($settings['flush_snippets'])) {
$directory = $settings['uri'];
if (!empty($directory)) {
// Remove snippet file directory.
file_unmanaged_delete_recursive($directory . '/google_tag');
}
}
// @todo Is this relevant here or in _google_tag_snippets_save()?
drupal_clear_js_cache();
}