You are here

function xmlsitemap_link_type_rename in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap.module \xmlsitemap_link_type_rename()

Rename a link type.

1 call to xmlsitemap_link_type_rename()
xmlsitemap_menu_update_6201 in xmlsitemap_menu/xmlsitemap_menu.install
Rename the menu type to 'menu_link'.

File

./xmlsitemap.module, line 1002
Main file for the xmlsitemap module.

Code

function xmlsitemap_link_type_rename($entity_old, $entity_new, $bundles = NULL) {
  $variables = db_query("SELECT name FROM {variable} WHERE name LIKE '%s%%'", 'xmlsitemap_settings_' . $entity_old . '_');
  while ($variable = db_result($variables)) {
    $value = variable_get($variable, NULL);
    variable_del($variable);
    if (isset($value)) {
      $variable_new = str_replace('xmlsitemap_settings_' . $entity_old, 'xmlsitemap_settings_' . $entity_new, $variable);
      variable_set($variable_new, $value);
    }
  }
  db_query("UPDATE {xmlsitemap} SET type = '%s' WHERE type = '%s'", $entity_new, $entity_old);
  xmlsitemap_get_link_info(NULL, TRUE);
}