You are here

function node_gallery_uninstall in Node Gallery 6.3

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

Implements hook_uninstall()

File

./node_gallery.install, line 330
Install, update and uninstall functions for the node_gallery module.

Code

function node_gallery_uninstall() {
  global $conf;
  include_once './' . drupal_get_path('module', 'node') . '/node.module';
  include_once './' . drupal_get_path('module', 'user') . '/user.module';
  $types = node_get_types();
  foreach (array(
    NODE_GALLERY_DEFAULT_GALLERY_TYPE,
    NODE_GALLERY_DEFAULT_IMAGE_TYPE,
  ) 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',
          ),
        )),
      )));
    }
  }
  $param = array(
    'type_name' => NODE_GALLERY_DEFAULT_IMAGE_TYPE,
    'field_name' => NODE_GALLERY_DEFAULT_IMAGE_FIELD,
  );
  if (node_gallery_cck_field_exists($param)) {
    drupal_set_message(t('The !field field is still present.  You may !delete_link.', array(
      '!field' => NODE_GALLERY_DEFAULT_IMAGE_FIELD,
      '!delete_link' => l(t('delete it'), 'admin/content/node-type/' . NODE_GALLERY_DEFAULT_IMAGE_TYPE . '/fields/' . NODE_GALLERY_DEFAULT_IMAGE_FIELD . '/remove', array(
        'attributes' => array(
          'target' => '_blank',
        ),
      )),
    )));
  }
  $ret = drupal_uninstall_schema('node_gallery');
  $variables = array(
    'node_gallery_galleries_summary_view',
    'node_gallery_install_defaults',
    'node_gallery_plupload_integration',
    'node_gallery_plupload_manage_images_integration',
    'node_gallery_plupload_manage_images_limit',
    'node_gallery_plupload_wizard',
    'node_gallery_jquery_ui_integration',
    'node_gallery_sort_images_max',
  );
  foreach ($variables as $var) {
    variable_del($var);
  }
  cache_clear_all();
}