You are here

function metatag_update_7009 in Metatag 7

Fix {metatag} records for taxonomy terms.

File

./metatag.install, line 1068
Install, update, and uninstall functions for the metatag module.

Code

function metatag_update_7009() {
  if (module_exists('taxonomy')) {

    // Fix the {metatag} table first.
    metatag_update_7015();

    // Remove duplicates.
    _metatag_remove_dupes('taxonomy_term');
  }

  // The taxonomy term entity doesn't support a 'language' option, so reset it
  // to LANGUAGE_NONE.
  $result = db_query("UPDATE {metatag} SET language = :language WHERE entity_type='taxonomy_term'", array(
    ':language' => LANGUAGE_NONE,
  ));
  if ($result
    ->rowCount() > 0) {
    drupal_set_message(t('Fixed language values for @count taxonomy terms.', array(
      '@count' => $result
        ->rowCount(),
    )));
  }
}