You are here

function apachesolr_search_update_6302 in Apache Solr Search 6.3

This function cleans up the old apachesolr tables. There is no magic upgrade pat. The old facet and MLT blocks will be gone

File

./apachesolr_search.install, line 197
Install and related hooks for apachesolr_search.

Code

function apachesolr_search_update_6302() {
  $ret = array();

  // Check if we are upgrading from Apache Solr 1.x to 3.x
  $old_variable_exists = db_result(db_query("SELECT 1 FROM {variable} WHERE name='apachesolr_search_excluded_types'"));
  if ($old_variable_exists) {

    // Delete all old more like this and other blocks
    $ret[] = update_sql("DELETE FROM {blocks} WHERE 'module' = 'apachesolr_search'");

    // Delete old variables
    variable_del('apachesolr_search_changed_boost');
    variable_del('apachesolr_search_comment_boost');
    variable_del('apachesolr_search_date_boost');
    variable_del('apachesolr_search_default_previous');
    variable_del('apachesolr_search_excluded_types');
    variable_del('apachesolr_search_make_default');
    variable_del('apachesolr_search_mlt_blocks');
    variable_del('apachesolr_search_promote_boost');
    variable_del('apachesolr_search_query_fields');
    variable_del('apachesolr_search_spellcheck');
    variable_del('apachesolr_search_sticky_boost');
    variable_del('apachesolr_search_taxonomy_links');
    variable_del('apachesolr_search_taxonomy_previous');
    variable_del('apachesolr_search_type_boosts');

    // Create tables.
    drupal_install_schema('apachesolr_search');
    apachesolr_search_enable();
  }
  return $ret;
}