From dc41325a8ad7a06f20cc26ca53a570ac3bfdf128 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Fri, 3 Apr 2015 19:06:16 +0000 Subject: [PATCH] Improve indentation, use base64 value from database bypass writing the value to a variable first. --- resources/install/scripts/ivr_menu.lua | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index 6d185707d7..c121d33585 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -198,23 +198,20 @@ sql = [[SELECT * FROM v_recordings WHERE domain_uuid = ']] .. domain_uuid ..[[' AND recording_filename = ']].. ivr_menu_greet_long.. [[' ]]; - --if (debug["sql"]) then + if (debug["sql"]) then freeswitch.consoleLog("notice", "[ivr_menu] SQL: " .. sql .. "\n"); - --end + end status = dbh:query(sql, function(row) --add functions dofile(scripts_dir.."/resources/functions/base64.lua"); - --get the base64 - recording_base64 = row["recording_base64"]; - --add the path to filename ivr_menu_greet_long = recordings_dir.."/"..ivr_menu_greet_long; --save the recording to the file system - if (string.len(recording_base64) > 32) then + if (string.len(row["recording_base64"]) > 32) then local file = io.open(ivr_menu_greet_long, "w"); - file:write(base64.decode(recording_base64)); + file:write(base64.decode(row["recording_base64"])); file:close(); end end); @@ -229,16 +226,14 @@ status = dbh:query(sql, function(row) --add functions dofile(scripts_dir.."/resources/functions/base64.lua"); - --get the base64 - recording_base64 = row["recording_base64"]; --add the path to filename ivr_menu_greet_short = recordings_dir.."/"..ivr_menu_greet_short; --save the recording to the file system - if (string.len(recording_base64) > 32) then + if (string.len(row["recording_base64"]) > 32) then local file = io.open(ivr_menu_greet_short, "w"); - file:write(base64.decode(recording_base64)); + file:write(base64.decode(row["recording_base64"])); file:close(); end end);