You are here

function apachesolr_update_5004 in Apache Solr Search 5.2

Subsume MLT functionality..

File

./apachesolr.install, line 251
Install and related hooks for apachesolr_search.

Code

function apachesolr_update_5004() {
  $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;
}