You are here

function synonyms_update_7101 in Synonyms 7

Implements hook_update_N().

Update to version 7.x-1.1 of Synonyms module.

File

./synonyms.install, line 106
Install, update, and uninstall functions for the Synonyms module.

Code

function synonyms_update_7101() {
  $result = db_select('variable', 'var')
    ->fields('var', array(
    'name',
  ))
    ->condition('var.name', db_like('synonyms_settings_') . '%', 'LIKE')
    ->execute();
  foreach ($result as $var) {
    $settings = variable_get($var->name);

    // Term merging has been deprecated in favor of Term Merge module.
    unset($settings['term_merge']);

    // Enabled synonyms now stored as field names, since the field independency
    // has been introduced. See issue http://drupal.org/node/1850748.
    drupal_load('module', 'synonyms');
    $settings['synonyms'] = $settings['synonyms'] ? array(
      'synonyms_synonyms',
    ) : array();
    variable_set($var->name, $settings);
  }
  return t('Updated settings of synonyms.');
}