Comments

alan d.’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

Create diff.install & paste in

/**
 * @file
 * Provides uninstallation functions.
 */

/**
 * Implements hook_uninstall().
 */
function diff_uninstall() {
  // Unset diff variables.
  $node_types = array_keys(node_type_get_types());
  foreach ($node_types as $node_type) {
    variable_del('enable_revisions_page_' . $node_type);
    variable_del('show_diff_inline_' . $node_type);
    variable_del('show_preview_changes_' . $node_type);
  }
}

alan d.’s picture

Title: Diff should delete it's variables on uninstall. » Diff should track the variables that it defines

And also there is no tracking of these settings if the machine name is altered. This one is for the main module file.

/**
 * Implements hook_node_type_update().
 *
 * This tracks the diff settings in case the node content type is renamed.
 */
function diff_node_type_update($info) {
  if (!empty($info->old_type) && $info->old_type != $info->type) {
    $type_variables = array(
      'show_preview_changes',
      'enable_revisions_page',
      'show_diff_inline',
    );
    foreach ($type_variables as $prefix) {
      $setting = variable_get($prefix . '_' . $info->old_type, FALSE);
      if ($setting !== FALSE) {
        variable_del($prefix . '_' . $info->old_type);
        variable_set($prefix . '_' . $info->type, $setting);
      }
    }
  }
}
alan d.’s picture

Status: Active » Needs review
StatusFileSize
new1.6 KB
alan d.’s picture

I missed the content type delete hook :)

tim.plunkett’s picture

Issue tags: +Needs backport to D6

Fixing tags

alan d.’s picture

This still applies to the 6.x branches and 7.x-2.x branch, but has been fixed in 7.x-3.x branch.

mitchell’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Fixed

Marking this as fixed, as it is committed to the latest dev branch.

Please reopen this issue if this change introduced any bugs.

Follow-ups should be added in separate issues.

Automatically closed -- issue fixed for 2 weeks with no activity.