You are here

function avatar_selection_uninstall in Avatar Selection 6

Same name and namespace in other branches
  1. 5.2 avatar_selection.install \avatar_selection_uninstall()
  2. 5 avatar_selection.install \avatar_selection_uninstall()
  3. 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 64
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');
  variable_del('avatar_selection_imagecache_preset');

  // 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.
  drupal_uninstall_schema('avatar_selection');

  // 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');
}