You are here

function apachesolr_update_6004 in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 6 apachesolr.install \apachesolr_update_6004()

Subsume MLT functionality..

File

./apachesolr.install, line 239
Install, update and uninstall functions for the apachesolr module.

Code

function apachesolr_update_6004() {
  $ret = array();
  if (db_table_exists("{apachesolr_mlt}")) {
    require_once drupal_get_path('module', 'apachesolr') . '/apachesolr.admin.inc';
    $result = db_query('SELECT id, data FROM {apachesolr_mlt} ORDER BY id ASC');
    while ($row = db_fetch_array($result)) {
      $delta = sprintf('mlt-%03d', $row['id']);
      apachesolr_mlt_save_block(unserialize($row['data']), $delta);
      $ret[] = update_sql("UPDATE {blocks} SET module = 'apachesolr', delta = '" . $delta . "' WHERE module = 'apachesolr_mlt' AND delta ='" . $row['id'] . "'");
    }
    $ret[] = update_sql("DROP TABLE {apachesolr_mlt}");
  }
  $ret[] = update_sql("DELETE FROM {system} WHERE name = 'apachesolr_mlt'");
  return $ret;
}