You are here

function finder_update_7100 in Finder 7

Implements hook_update_N().

Drupal 6 to 7 updates.

See also

hook_update_N()

File

./finder.install, line 250
Finder module install file.

Code

function finder_update_7100() {

  // Update finder's settings where possible to avoid problems in this update.
  $finders = finder_load_multiple(NULL, array(), TRUE);
  foreach ($finders as $finder) {

    // Some settings names got changed.
    $finder->settings['form']['suffix']['format'] = $finder->settings['form']['suffix_format'];
    unset($finder->settings['form']['suffix_format']);
    $finder->settings['form']['suffix']['value'] = $finder->settings['form']['suffix'];
    unset($finder->settings['form']['suffix']);
    $finder->settings['form']['prefix']['format'] = $finder->settings['form']['prefix_format'];
    unset($finder->settings['form']['prefix_format']);
    $finder->settings['form']['prefix']['value'] = $finder->settings['form']['prefix'];
    unset($finder->settings['form']['prefix']);
    $finder->settings['advanced']['ajax'] = $finder->settings['advanced']['ahah'];
    unset($finder->settings['advanced']['ahah']);
    $finder->settings['advanced']['ajax_effect'] = $finder->settings['advanced']['ahah_effect'];
    unset($finder->settings['advanced']['ahah_effect']);
    $finder->settings['advanced']['ajax_remote'] = $finder->settings['advanced']['ahah_remote'];
    unset($finder->settings['advanced']['ahah_remote']);

    // Removal of intersect method.
    if ($finder->settings['advanced']['element_combination'] == 2) {
      $finder->settings['advanced']['element_combination'] = 0;
    }
    foreach ($finder->elements as $key => $element) {
      if ($element->settings['advanced']['field_combination'] == 2) {
        $element->settings['advanced']['field_combination'] = 1;
      }
      if ($element->settings['advanced']['value_combination'] == 2) {
        $element->settings['advanced']['value_combination'] = 1;
      }
      $finder->elements[$key] = $element;
    }
    finder_save($finder);
  }
  return t('Drupal 6 to 7 updates.');
}