You are here

function user_badges_uninstall in User Badges 5

Same name and namespace in other branches
  1. 6.2 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()

Implementation of hook_uninstall()

File

./user_badges.install, line 153
@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);
  }

  // Remove database tables.
  db_query("DROP TABLE {user_badges_badges}");
  db_query("DROP TABLE {user_badges_roles}");
  db_query("DROP TABLE {user_badges_user}");
  db_query("DROP TABLE {user_badges_product}");
}