You are here

function finder_update_7201 in Finder 7.2

Collect and store Finder 1.x finders.

File

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

Code

function finder_update_7201() {
  $finder_result = db_query("SELECT * FROM {finder} ORDER BY finder_id");
  $finders = array();
  foreach ($finder_result as $finder) {
    if (!empty($finder->settings)) {
      $finder->settings = unserialize($finder->settings);
    }
    $element_result = db_query("SELECT * FROM {finder_element} WHERE finder_id = :id ORDER BY weight", array(
      ':id' => $finder->finder_id,
    ));
    foreach ($element_result as $element) {
      if (!empty($element->settings)) {
        $element->settings = unserialize($element->settings);
      }
      $finder->elements[] = $element;
    }
    $finders[$finder->finder_id] = $finder;
  }
  variable_set('finder_old_finders', $finders);
  return 'Collect and store Finder 1.x finders.';
}