You are here

function location_update_6303 in Location 7.3

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

Drupal 6 location 3.x update, part 3.

File

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

Code

function location_update_6303() {
  if (!variable_get('location_update_5304_done', FALSE)) {

    // Do the same updates as 5304.
    // Delete unused variables.
    variable_del('location_configured_countries');
    variable_del('location_garbagecollect');

    // Update province code for Italy/Forlì-Cesena.
    db_update('location')
      ->fields(array(
      'province' => 'FC',
    ))
      ->condition('country', 'it')
      ->condition('province', 'FO')
      ->execute();

    // Update province code for Italy/Pesaro e Urbino.
    db_update('location')
      ->fields(array(
      'province' => 'PU',
    ))
      ->condition('country', 'it')
      ->condition('province', 'PS')
      ->execute();

    // Do one final garbage collection by hand.
    $query = db_select('location_instance', 'li')
      ->addField('li', 'lid');
    db_delete('location')
      ->condition('lid', $query, 'NOT IN')
      ->execute();

    // Garbage collect {location_phone} by hand.
    if (db_table_exists('location_phone')) {
      $query = db_select('location', 'l')
        ->addField('l', 'lid');
      db_delete('location_phone')
        ->condition('lid', $query, 'NOT IN')
        ->execute();
    }

    // Garbage collect {location_fax} by hand.
    if (db_table_exists('location_fax')) {
      $query = db_select('location', 'l')
        ->addField('l', 'lid');
      db_delete('location_fax')
        ->condition('lid', $query, 'NOT IN')
        ->execute();
    }
    variable_del('location_update_5304_done');
  }
}