You are here

nodewords_tokens.install in Nodewords: D6 Meta Tags 6.2

Install, update and uninstall functions for the Tokens for meta tags module.

File

nodewords_tokens/nodewords_tokens.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the Tokens for meta tags module.
 */

/**
 * Implements hook_install().
 */
function nodewords_tokens_install() {
  $node_types = array_keys(node_get_types('names'));
  $variables = array(
    'nodewords_filter_modules_output_',
    'nodewords_filter_regexp_',
    'nodewords_use_alt_attribute_',
  );
  foreach ($node_types as $node_type) {
    foreach ($variables as $variable) {
      variable_del($variable . $node_type);
    }
  }
  db_query("UPDATE {system} SET weight = 12 WHERE name = 'nodewords_tokens' AND type = 'module'");
}

/**
 * Implements hook_update_N().
 */
function nodewords_tokens_update_6101() {
  $ret = array();
  $ret[] = update_sql("UPDATE {system} SET weight = 12 WHERE name = 'nodewords_tokens' AND type = 'module'");
  return $ret;
}

/**
 * Implements hook_update_N().
 */
function nodewords_tokens_update_6102() {
  $ret = array();
  $value = variable_get('nodewords_first_keywords', NULL);
  if (isset($value)) {
    variable_set('nodewords_global_keywords_1', $value);
    variable_del('nodewords_first_keywords');
  }
  $value = variable_get('nodewords_last_keywords', NULL);
  if (isset($value)) {
    variable_set('nodewords_global_keywords_2', $value);
    variable_del('nodewords_last_keywords');
  }
  $ret[] = array(
    'success' => TRUE,
    'query' => 'Updated the module settings',
  );
  variable_del('nodewords_tokens_installed');
  return $ret;
}

/**
 * Implements hook_update_N().
 */
function nodewords_tokens_update_6104() {
  $ret = array();
  variable_del('nodewords_remove_extra_whitespaces');
  $ret[] = array(
    'success' => TRUE,
    'query' => 'Removed obsolete persistent variables',
  );
  return $ret;
}

/**
 * Implements hook_uninstall().
 */
function nodewords_tokens_uninstall() {
  variable_del('nodewords_description_generation_source');
  variable_del('nodewords_filter_modules_output');
  variable_del('nodewords_filter_regexp');
  variable_del('nodewords_global_keywords_1');
  variable_del('nodewords_global_keywords_2');
  variable_del('nodewords_keyword_vids');
  variable_del('nodewords_use_alt_attribute');
}