From 70d1655a41aedd99768e469e3fed8636324d3b30 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 18 Apr 2018 21:14:55 +0200 Subject: lib/mysql-functions: save queries as *.txt --- lib/mysql-functions | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/mysql-functions b/lib/mysql-functions index 66b1512..0e4b952 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -30,6 +30,7 @@ mysql_run_query() { local query_stderr local file_name_extra + local file file_name_extra='' if [ "x$1" = 'xunimportant' ]; then @@ -62,13 +63,13 @@ mysql_run_query() { printf '\001ACTION failed to execute a mysql query - can you have a look at "%s"?.\001\n' \ "${query_stdin##*/}" \ | irc_say - cp \ + for file in \ "${query_stdin}" \ "${query_stdout}" \ - "${query_stderr}" \ - "${webserver_directory}/mysql-queries/" - find "${webserver_directory}/mysql-queries/" -type f \ - -exec chmod go+r {} \; + "${query_stderr}"; do + cp "${file}" "${webserver_directory}/mysql-queries/${file}.txt" + chmod go+r "${webserver_directory}/mysql-queries/${file}.txt" + done fi if [ -z "${file_name_extra}" ]; then echo 'A mysql query failed.' > \ -- cgit v1.2.3-70-g09d2