You are here

function cpn_uninstall in Code per Node 6

Same name and namespace in other branches
  1. 7 cpn.install \cpn_uninstall()

Implementation of hook_uninstall().

File

./cpn.install, line 61
Installation, schema and update hook implementations.

Code

function cpn_uninstall() {
  drupal_uninstall_schema('cpn');

  // Drop fields from blocks table, as defined in hook_schema_alter().
  $ret = array();
  $schema = array();
  cpn_schema_alter($schema);
  foreach ($schema['blocks']['fields'] as $name => $spec) {
    db_drop_field($ret, 'blocks', $name);
  }

  // Delete CSS & JS files.
  cpn_recursive_delete(file_create_path(variable_get('cpn_path', 'cpn')));

  // Delete the variables.
  variable_del('cpn_aggregation_css');
  variable_del('cpn_aggregation_js');
  variable_del('cpn_global_css');
  variable_del('cpn_global_css_admin');
  variable_del('cpn_global_css_agree');
  variable_del('cpn_global_js');
  variable_del('cpn_global_js_admin');
  variable_del('cpn_global_js_agree');
  variable_del('cpn_path');
  variable_del('cpn_syntax_highlighting');
  variable_del('cpn_wrapper_block_css');
  variable_del('cpn_wrapper_block_js');
  variable_del('cpn_wrapper_node_css');
  variable_del('cpn_wrapper_node_js');

  // Delete the content type variables.
  foreach (array_keys(node_get_types('names')) as $node_type) {
    foreach (array(
      'css',
      'js',
    ) as $type) {
      variable_del('cpn_' . $type . '_enabled_' . $node_type);
      variable_del('cpn_' . $type . '_' . $node_type);
    }
  }
}