You are here

function location_update_6306 in Location 7.3

Same name and namespace in other branches
  1. 6.3 location.install \location_update_6306()
  2. 7.5 location.install \location_update_6306()
  3. 7.4 location.install \location_update_6306()

Add per-location-field weights and defaults.

File

./location.install, line 1478
Install, update and uninstall functions for the location module.

Code

function location_update_6306() {

  // Skip this update if it was already done on the 5.x side.
  if (variable_get('location_update_5306_done', FALSE)) {
    variable_del('location_update_5306_done');
    return array();
  }
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'location_settings_%'");
  foreach ($result as $row) {
    $var = variable_get($row->name, array());
    $collect = $var['form']['fields'];
    $var['form']['fields'] = array();
    foreach ($collect as $k => $v) {
      $var['form']['fields'][$k]['collect'] = $v;
    }

    // Country 3 has changed to 4 to make requirements code easier.
    if (isset($var['form']['fields']['country']['collect']) && $var['form']['fields']['country']['collect'] == 3) {
      $var['form']['fields']['country']['collect'] = 4;
    }

    // Weight and default values don't need to get set for now.
    variable_set($row->name, $var);
  }
}