You are here

function user_badges_uninstall in User Badges 7

Same name and namespace in other branches
  1. 5 user_badges.install \user_badges_uninstall()
  2. 6.2 user_badges.install \user_badges_uninstall()
  3. 6 user_badges.install \user_badges_uninstall()
  4. 7.4 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 159
@brief User Badges install file

Code

function user_badges_uninstall() {
  $dir = 'public://badges';
  if (file_prepare_directory($dir)) {

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

    // Delete directory.
    rmdir($dir);
  }

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