You are here

function finder_update_6101 in Finder 7

Same name and namespace in other branches
  1. 6 finder.install \finder_update_6101()

Implements hook_update_N().

Copies match method setting into each of the elements.

See also

hook_update_N()

File

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

Code

function finder_update_6101() {

  // Update finder's settings where possible to avoid problems in this update.
  $finders = finder_load_multiple(NULL, array(), TRUE);
  foreach ($finders as $finder) {
    $changed = FALSE;
    if (isset($finder->settings['advanced']['match'])) {
      foreach ($finder->elements as $key => $element) {
        if (!isset($element->settings['advanced']['match'])) {
          $element->settings['advanced']['match'] = $finder->settings['advanced']['match'];
          $finder->elements[$key] = $element;
          $changed = TRUE;
        }
      }

      // No need to remove the setting from the finder.
    }
    if ($changed) {
      finder_save($finder);
    }
  }
  return t('Moved match method setting into each element.');
}