apachesolr_search.install in Apache Solr Search 6
Same filename and directory in other branches
Install and related hooks for apachesolr_search.
File
apachesolr_search.installView source
<?php
/**
* @file
* Install and related hooks for apachesolr_search.
*/
/**
* Implementation of hook_uninstall().
* Update to namespace tracking.
*/
function apachesolr_search_uninstall() {
variable_del('apachesolr_search_default_previous');
variable_del('apachesolr_search_spellcheck');
variable_del('apachesolr_search_taxonomy_links');
variable_del('apachesolr_search_taxonomy_previous');
variable_del('apachesolr_set_nodeapi_messages');
$stored = variable_get('apachesolr_index_last', array());
unset($stored['apachesolr_search']);
variable_set('apachesolr_index_last', $stored);
// Remove blocks.
db_query('DELETE FROM {blocks} WHERE module = "apachesolr_search"');
}
/**
* Update to namespace tracking.
*/
function apachesolr_search_update_6000() {
$change = variable_get('apachesolr_search_last_change', 0);
$nid = variable_get('apachesolr_search_last_nid', 0);
if ($change || $nid) {
$stored = variable_get('apachesolr_index_last', array());
$stored['apachesolr_search'] = array(
'last_change' => $change,
'last_nid' => $nid,
);
variable_set('apachesolr_index_last', $stored);
}
variable_del('apachesolr_search_last_change');
variable_del('apachesolr_search_last_nid');
return array();
}
/**
* Update to block deltas.
*/
function apachesolr_search_update_6001() {
$ret = array();
if ($fields = apachesolr_cck_fields()) {
foreach ($fields as $name => $field) {
$index_key = substr(apachesolr_index_key($field), 0, 32);
$new_delta = $field['field_name'];
$ret[] = update_sql("UPDATE {blocks} SET delta = '" . $new_delta . "' WHERE module = 'apachesolr_search' AND delta = '" . $index_key . "'");
$ret[] = update_sql("UPDATE {blocks_roles} SET delta = '" . $new_delta . "' WHERE module = 'apachesolr_search' AND delta = '" . $index_key . "'");
}
}
return $ret;
}
/**
* Update mis-named variables.
*/
function apachesolr_search_update_6002() {
$ret = array();
$date_settings = variable_get('apacehsolr_search_date_boost', '');
$comment_settings = variable_get('apacehsolr_search_comment_boost', '');
if ($date_settings) {
variable_set('apachesolr_search_date_boost', $date_settings);
}
if ($comment_settings) {
variable_set('apachesolr_search_comment_boost', $comment_settings);
}
variable_del('apacehsolr_search_date_boost');
variable_del('apacehsolr_search_comment_boost');
return $ret;
}
/**
* Enable facet missing for books.
*/
function apachesolr_search_update_6003() {
$ret = array();
$facet_missing = variable_get('apachesolr_facet_missing', array());
$facet_missing['apachesolr_search']['is_book_bid'] = 1;
variable_set('apachesolr_facet_missing', $facet_missing);
return $ret;
}
Functions
Name | Description |
---|---|
apachesolr_search_uninstall | Implementation of hook_uninstall(). Update to namespace tracking. |
apachesolr_search_update_6000 | Update to namespace tracking. |
apachesolr_search_update_6001 | Update to block deltas. |
apachesolr_search_update_6002 | Update mis-named variables. |
apachesolr_search_update_6003 | Enable facet missing for books. |