You are here

function s3fs_uninstall in S3 File System 7

Same name and namespace in other branches
  1. 7.3 s3fs.install \s3fs_uninstall()
  2. 7.2 s3fs.install \s3fs_uninstall()

Implements hook_uninstall().

Removes our settings variables, as well as the copies made for API-compatibility with AmazonS3 (if AmazonS3 isn't installed).

File

./s3fs.install, line 101
Install, update and uninstall functions for the S3 File System module.

Code

function s3fs_uninstall() {

  // Copied from _s3fs_get_config(), since it's not defined during uninstall.
  $config = array();
  $variable_names = db_select('variable', 'v')
    ->fields('v', array(
    'name',
  ))
    ->condition('name', 's3fs_%', 'LIKE')
    ->execute()
    ->fetchCol(0);
  foreach ($variable_names as $name) {
    $shortname = str_replace('s3fs_', '', $name);
    $config[$shortname] = variable_get($name, '');
  }
  foreach ($config as $name => $value) {
    variable_del($name);
    if (!module_exists('amazons3')) {
      $amazons3_name = str_replace('s3fs_', 'amazons3_', $name);
      variable_del($amazons3_name);
    }
  }
}