You are here

function _backwards_compatibility in Glossify 6

Same name and namespace in other branches
  1. 6.3 glossify.module \_backwards_compatibility()

Helper function that cleans up old variables and inserts old cck values into the keyword table.

1 call to _backwards_compatibility()
glossify_enable in ./glossify.install
Implementation of hook_enable().

File

./glossify.module, line 592

Code

function _backwards_compatibility() {
  $keyword_field = variable_get('glossify_use_this_cck_field_for_keyword_synonyms', FALSE);
  $override_field = variable_get('glossify_use_this_cck_field_for_target_url_override', FALSE);
  if ($keyword_field) {
    $content_types = variable_get('glossify_glossary_content_type', array());
    foreach ($content_types as $content_type) {
      $table = 'content_type_' . $content_type;
      $q = db_query("SELECT nid FROM {$table} WHERE 1");
      while ($r = db_fetch_array($q)) {
        $node = node_load($r['nid'], NULL, TRUE);
        $keyword = $node->{$keyword_field};
        if ($override_field == 'none') {
          _keyword_table('insert', $node->nid, 'cck', $node->language, $keyword[0]['value'], '');
        }
        else {
          $override = $node->{$override_field};
          _keyword_table('insert', $node->nid, 'cck', $node->language, $keyword[0]['value'], $override[0]['value']);
        }
        _keyword_table('insert', $node->nid, 'title', $node->language, $node->title, '');
      }
    }
  }
  variable_del('glossify_glossary_content_type');
  variable_del('glossify_content_types_to_search');
  variable_del('glossify_link_first_only');
  variable_del('glossify_do_we_need_unicode_compatibility');
  variable_del('glossify_teaser');
  variable_del('glossify_style');
  variable_del('glossify_dont_break_words');
  variable_del('glossify_display_parsing_time_for_performance_debugging');
  variable_del('glossify_use_this_cck_field_for_keyword_synonyms');
  variable_del('glossify_use_this_cck_field_for_target_url_override');
}