You are here

function user_badges_uninstall in User Badges 6.2

Same name and namespace in other branches
  1. 5 user_badges.install \user_badges_uninstall()
  2. 6 user_badges.install \user_badges_uninstall()
  3. 7.4 user_badges.install \user_badges_uninstall()
  4. 7 user_badges.install \user_badges_uninstall()
  5. 7.2 user_badges.install \user_badges_uninstall()
  6. 7.3 user_badges.install \user_badges_uninstall()

Implements hook_uninstall().

File

./user_badges.install, line 167
@brief User Badges install file

Code

function user_badges_uninstall() {

  // Delete files.
  $dir = file_create_path('badges');
  if ($dir) {
    $files = file_scan_directory($dir, '.*\\.(gif|jpg|jpeg|png)', array(
      '.',
      '..',
      'CVS',
    ), 0, FALSE);
    foreach ($files as $file) {
      file_delete($file->filename);
    }
  }

  // Delete the badges directory.
  if (file_exists($dir)) {
    rmdir($dir);
  }
  drupal_uninstall_schema('user_badges');
  variable_del('user_badges_showone');
  variable_del('user_badges_showblocked');
  variable_del('user_badges_userweight');
  variable_del('user_badges_defaulthref');
  variable_del('user_badges_vid');
}