You are here

function xmlsitemap_user_update_6200 in XML sitemap 6.2

Migrate 6.x-1.x user variables.

File

xmlsitemap_user/xmlsitemap_user.install, line 41
Install and uninstall schema and functions for the xmlsitemap_user module.

Code

function xmlsitemap_user_update_6200() {
  drupal_load('module', 'user');
  $status = 0;
  $priority = variable_get('xmlsitemap_user_default_priority', 0.5);
  if ($priority == -1) {
    $priority = 0.5;
  }
  else {
    $status = 1;
  }
  variable_set('xmlsitemap_settings_user_user', array(
    'status' => $status,
    'priority' => $priority,
  ));
  if (db_table_exists('xmlsitemap_user_role')) {
    $query = db_query("SELECT rid, priority FROM {xmlsitemap_user_role}");
    while ($role = db_fetch_object($query)) {
      $status = 0;
      if ($role->priority == -1) {
        $role->priority = 0.5;
      }
      else {
        $status = 1;
      }
      variable_set('xmlsitemap_settings_user_' . $role->rid, array(
        'status' => $status,
        'priority' => $role->priority,
      ));
    }
  }
  return array();
}