You are here

function node_gallery_uninstall in Node Gallery 6.2

Same name and namespace in other branches
  1. 6.3 node_gallery.install \node_gallery_uninstall()
  2. 6 node_gallery.install \node_gallery_uninstall()
  3. 7 node_gallery.install \node_gallery_uninstall()

Implementation of hook_uninstall()

File

./node_gallery.install, line 99
Node gallery install file.

Code

function node_gallery_uninstall() {
  global $conf;
  $types = node_get_types();
  foreach (array(
    'node_gallery_gallery',
    'node_gallery_image',
  ) as $content_type) {
    if (in_array($content_type, array_keys($types))) {
      drupal_set_message(t('The !content_type content type is still present.  You may !delete_link.', array(
        '!content_type' => $content_type,
        '!delete_link' => l(t('delete it'), 'admin/content/node-type/' . str_replace('_', '-', $content_type) . '/delete', array(
          'attributes' => array(
            'target' => '_blank',
          ),
        )),
      )));
    }
  }

  // Remove our imagecache presets
  foreach (array(
    'node-gallery-cover',
    'node-gallery-display',
    'node-gallery-thumbnail',
  ) as $preset_name) {
    $preset = imagecache_preset_by_name($preset_name);
    if ($preset['presetid']) {
      drupal_set_message(t('The !preset_name imagecache preset is still present.  You may !delete_link.', array(
        '!preset_name' => $preset_name,
        '!delete_link' => l(t('delete it'), 'admin/build/imagecache/' . $preset['presetid'] . '/delete', array(
          'attributes' => array(
            'target' => '_blank',
          ),
        )),
      )));
    }
  }
  $ret = drupal_uninstall_schema('node_gallery');
  foreach ($conf as $key => $value) {
    if (strpos($key, 'node_gallery') === 0) {
      variable_del($key);
    }
  }
  cache_clear_all();
}