Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions includes/tripal_elasticsearch.search_forms.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function table_search_interface_building_form($form, &$form_state) {

//get the dbtable mapping
$sql = "SELECT DISTINCT table_name FROM {tripal_elasticsearch_indices} WHERE index_name = :index_name ";
$dbtable = db_query($sql, [':index_name' => $form_state['values']['index_name']])->fetchCol('table_name');
$dbtable = db_query($sql, [':index_name' => $form_state['values']['index_name']])->fetchCol();
$table_name = $dbtable[0];

if (!$table_name) {
Expand All @@ -91,7 +91,7 @@ function table_search_interface_building_form($form, &$form_state) {
'#value' => $table_name,
];
$sql = "SELECT DISTINCT index_name FROM {tripal_elasticsearch}";
$result = db_query($sql)->fetchCol('index_name');
$result = db_query($sql)->fetchCol();
$blocks = drupal_map_assoc($result);
$block_exists = in_array($index_name, $blocks);
}
Expand Down Expand Up @@ -309,7 +309,7 @@ function table_search_interface_building_form_submit($form, &$form_state) {
$table_name = $form_state['values']['table_name'];
// Delete record if it already exists in database table 'tripal_elasticsearch' and 'tripal_elasticsearch_links.
$sql = "SELECT index_name FROM {tripal_elasticsearch} WHERE index_name = :index_name";
$result = db_query($sql, [':index_name' => $index_name])->fetchCol('index_name');
$result = db_query($sql, [':index_name' => $index_name])->fetchCol();
if (!empty($result)) {
try {
db_delete('tripal_elasticsearch')
Expand Down Expand Up @@ -394,4 +394,4 @@ function tripal_elasticsearch_form_table_search_interface_building_form_alter(
}
}
}
}
}
6 changes: 3 additions & 3 deletions tripal_elasticsearch.module
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ function tripal_elasticsearch_block_info() {

// Define blocks for table search forms.
$sql = "SELECT index_name FROM {tripal_elasticsearch}";
$index_names = db_query($sql)->fetchCol('index_name');
$index_names = db_query($sql)->fetchCol();
if (!empty($index_names)) {
foreach ($index_names as $index_name) {
$blocks['tes_' . $index_name] = [
Expand Down Expand Up @@ -521,7 +521,7 @@ function tripal_elasticsearch_generate_block($delta) {
// Use index name obtained from block name and query the database.
$sql = "SELECT DISTINCT index_name FROM {tripal_elasticsearch} WHERE index_name = :index_name";
$result = db_query($sql,
[':index_name' => $index_name])->fetchCol('index_name');
[':index_name' => $index_name])->fetchCol();

// If query result is not empty, display the block.
if (!empty($result)) {
Expand Down Expand Up @@ -1151,6 +1151,6 @@ function tripal_elasticsearch_bundle_delete_orphans(TripalBundle $bundle, array
}
} catch (\Exception $e) {
watchdog('tripal_elasticsearch',
"Connecting to ES failed. " . $exception->getMessage(), WATCHDOG_ERROR);
"Connecting to ES failed. " . $e->getMessage(), WATCHDOG_ERROR);
}
}