From 6ab357c44b82d3bb4e4042c6b76e95eef102e6b6 Mon Sep 17 00:00:00 2001 From: Jonathan Cormier Date: Thu, 28 Mar 2024 13:54:21 -0400 Subject: [PATCH] functions: Fix tx isolation detection Fixes: #550 --- assets/runtime/functions | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index 5ef3c8e7..f64e199e 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -261,15 +261,13 @@ redmine_check_mysql_database_tx_isolation() { --user "${DB_USER}" --default-character-set "${DB_ENCODING}" \ --skip-column-names \ --silent " - isolation_lvl=$( MYSQL_PWD="${DB_PASS}" $mysql_cmd \ + if ! isolation_lvl=$( MYSQL_PWD="${DB_PASS}" $mysql_cmd \ --execute="SELECT @@GLOBAL.tx_isolation;" ) - - if [[ $? -ne 0 ]]; then + then # try the new name of the variable, mysql 8+ - isolation_lvl=$( MYSQL_PWD="${DB_PASS}" $mysql_cmd \ + if ! isolation_lvl=$( MYSQL_PWD="${DB_PASS}" $mysql_cmd \ --execute="SELECT @@GLOBAL.transaction_isolation;" ) - - if [[ $? -ne 0 ]]; then + then echo echo "ERROR: Failed to check transaction isolation level" >&2 return 1