You are here

function gallery_assist_uninstall in Gallery Assist 7

Same name and namespace in other branches
  1. 6 gallery_assist.install \gallery_assist_uninstall()

Implements hook_uninstall().

File

./gallery_assist.install, line 394
Install, update and uninstall functions for the Gallery Assist module.

Code

function gallery_assist_uninstall() {
  $t = get_t();

  // Remove the Gallery Assist directory and all gallery folders in it.
  $path = file_default_scheme() . '://gallery_assist';
  file_unmanaged_delete_recursive($path);

  // Delete all gallery assist nodes form the node and the node_revisions tables.
  $nodes = db_select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('type', 'gallery_assist')
    ->execute()
    ->fetchCol();
  node_delete_multiple($nodes);

  // Delete all gallery assist settings variables.
  db_delete('variable')
    ->condition('name', db_like('gallery_assist_') . '%', 'LIKE')
    ->execute();
  drupal_set_message($t('The module Gallery Assist was uninstalled sucessfull. <br />Articles from type "Gallery" are removed too. <br />Articles with assigned gallery-functionality can are removed (if desired) using the <a href="@conten_admin">content</a> administration.', array(
    '@conten_admin' => url('admin/content'),
  )));
  watchdog('action', $t('The module Gallery Assist was uninstalled sucessfull.<br />Articles from type "Gallery" and articles with assigned gallery-functionality can are removed (if desired) using the content and structure administration.'));
}