function avatar_selection_uninstall in Avatar Selection 5.2
Same name and namespace in other branches
- 5 avatar_selection.install \avatar_selection_uninstall()
- 6 avatar_selection.install \avatar_selection_uninstall()
- 7 avatar_selection.install \avatar_selection_uninstall()
Implementation of hook_uninstall().
Remove all the variables, files and sql tables used by the module.
File
- ./
avatar_selection.install, line 65 - The Avatar Selection module install file.
Code
function avatar_selection_uninstall() {
// Delete the variables we created.
variable_del('avatar_selection_disable_user_upload');
variable_del('avatar_selection_force_user_avatar_reg');
variable_del('avatar_selection_force_user_avatar');
variable_del('avatar_selection_avatar_per_page');
variable_del('avatar_selection_set_random_default');
variable_del('avatar_selection_distinctive_avatars');
// Delete the images.
$dir = file_create_path('avatar_selection') . '/';
$listings = file_scan_directory($dir, '.*\\.(gif|GIF|Gif|jpg|JPG|Jpg|jpeg|JPEG|Jpeg|png|PNG|Png)', array(
'.',
'..',
'CVS',
), 0, FALSE);
if ($listings) {
foreach ($listings as $listing) {
file_delete($dir . $listing->basename);
}
}
// Drop the avatar_selection table.
switch ($GLOBALS['db_type']) {
case 'mysqli':
case 'mysql':
$deleted = db_query("DROP TABLE IF EXISTS {avatar_selection}");
$deleted = db_query("DROP TABLE IF EXISTS {avatar_selection_roles}");
$deleted = db_query("DROP TABLE IF EXISTS {avatar_selection_og}");
break;
case 'pgsql':
$deleted = db_query("DROP TABLE {avatar_selection}");
$deleted = db_query("DROP TABLE {avatar_selection_roles}");
$deleted = db_query("DROP TABLE {avatar_selection_og}");
break;
}
// Clear the cache tables.
cache_clear_all(null, 'cache');
cache_clear_all(null, 'cache_filter');
cache_clear_all(null, 'cache_menu');
cache_clear_all(null, 'cache_page');
}