You are here

function revisioning_uninstall in Revisioning 7

Same name and namespace in other branches
  1. 8 revisioning.install \revisioning_uninstall()
  2. 6.4 revisioning.install \revisioning_uninstall()
  3. 6 revisioning.install \revisioning_uninstall()
  4. 6.3 revisioning.install \revisioning_uninstall()

Implements hook_uninstall().

File

./revisioning.install, line 38
Install and uninstall hooks for Revisioning module.

Code

function revisioning_uninstall() {

  // Delete all revisioning_* variables at once.
  db_query("DELETE FROM {variable} WHERE name LIKE 'revisioning_%%'");

  // See above.
  variable_del('page_manager_override_anyway');
  foreach (node_type_get_types() as $type) {

    // Maybe revisioning_auto_publish_<type> and new_revisions_<type>
    // should be used in array, like 'revision_moderation' below?
    variable_del('new_revisions_' . $type->type);

    // Remove 'revision_moderation' from all node_options_<type> variables.
    $variable_name = 'node_options_' . $type->type;
    if ($node_options = variable_get($variable_name, NULL)) {
      $node_options = array_diff($node_options, array(
        'revision_moderation',
      ));
      variable_set($variable_name, $node_options);
    }
  }

  // Make sure that unpublished nodes do not reveal their taxonomy terms, once
  // Revisioning is uninstalled.
  if (module_exists('taxonomy')) {
    require_once 'revisioning.taxonomy.inc';
    foreach (node_load_multiple(FALSE) as $node) {

      // Modify node objects to be consistent with Revisioning being
      // uninstalled, before updating the {taxonomy_index} table accordingly.
      unset($node->revision_moderation);
      revisioning_update_taxonomy_index($node, FALSE);
    }
  }
}