From ca20fe20af5a724f5bdbf4f620bdcf3223a3def5 Mon Sep 17 00:00:00 2001 From: dsenalik Date: Tue, 26 Jul 2022 14:43:49 -0500 Subject: [PATCH 1/3] Issue 277 fix non-integer parameter to fetchCol --- tripal_elasticsearch.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tripal_elasticsearch.module b/tripal_elasticsearch.module index 1c6aa4a..f7d8d17 100644 --- a/tripal_elasticsearch.module +++ b/tripal_elasticsearch.module @@ -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(0); if (!empty($index_names)) { foreach ($index_names as $index_name) { $blocks['tes_' . $index_name] = [ From 5f1b06dbff31a225274a7776ef94807514629b40 Mon Sep 17 00:00:00 2001 From: dsenalik Date: Tue, 26 Jul 2022 14:50:39 -0500 Subject: [PATCH 2/3] Issue 277 fix all non-integer parameters to fetchCol --- includes/tripal_elasticsearch.search_forms.form.inc | 8 ++++---- tripal_elasticsearch.module | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/tripal_elasticsearch.search_forms.form.inc b/includes/tripal_elasticsearch.search_forms.form.inc index 3a3224c..90385a2 100644 --- a/includes/tripal_elasticsearch.search_forms.form.inc +++ b/includes/tripal_elasticsearch.search_forms.form.inc @@ -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) { @@ -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); } @@ -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') @@ -394,4 +394,4 @@ function tripal_elasticsearch_form_table_search_interface_building_form_alter( } } } -} \ No newline at end of file +} diff --git a/tripal_elasticsearch.module b/tripal_elasticsearch.module index f7d8d17..8ff8db8 100644 --- a/tripal_elasticsearch.module +++ b/tripal_elasticsearch.module @@ -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(0); + $index_names = db_query($sql)->fetchCol(); if (!empty($index_names)) { foreach ($index_names as $index_name) { $blocks['tes_' . $index_name] = [ @@ -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)) { From e783e2b5c0cf9c476b90f590a1b075e7fc3f864f Mon Sep 17 00:00:00 2001 From: dsenalik Date: Wed, 21 Sep 2022 15:03:52 -0500 Subject: [PATCH 3/3] Issue 277 fix for second error --- tripal_elasticsearch.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tripal_elasticsearch.module b/tripal_elasticsearch.module index 8ff8db8..4d7fcd3 100644 --- a/tripal_elasticsearch.module +++ b/tripal_elasticsearch.module @@ -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); } }