You are here

function finder_update_6102 in Finder 6

Implementation of hook_update_N().

Removal of intersect functionality.

See also

hook_update_N()

File

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

Code

function finder_update_6102() {
  module_load_include('module', 'finder', 'finder');

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

    // 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 array(
    array(
      'success' => TRUE,
      'query' => t('Removal of intersect functionality.'),
    ),
  );
}