From 2fb4256f84b1de7b264c5bf62849c5b7c58399bd Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 5 Jul 2019 16:28:36 +0200 Subject: [PATCH] Rename table to "auditlist" Signed-off-by: DL6ER --- advanced/Scripts/database_migration/gravity/1_to_2.sql | 2 +- advanced/Scripts/webpage.sh | 4 ++-- advanced/Templates/gravity.db.sql | 5 ++--- gravity.sh | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/advanced/Scripts/database_migration/gravity/1_to_2.sql b/advanced/Scripts/database_migration/gravity/1_to_2.sql index 4e560df5..ba051e25 100644 --- a/advanced/Scripts/database_migration/gravity/1_to_2.sql +++ b/advanced/Scripts/database_migration/gravity/1_to_2.sql @@ -1,4 +1,4 @@ -CREATE TABLE audit +CREATE TABLE auditlist ( id INTEGER PRIMARY KEY AUTOINCREMENT, domain TEXT UNIQUE NOT NULL, diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3996f7d0..91d35d98 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -554,12 +554,12 @@ addAudit() # filled with its default value (date_added = current timestamp) domains="${domains},('${domain}')" done - sqlite3 "${gravityDBfile}" "INSERT INTO \"audit\" (domain) VALUES ${domains};" + sqlite3 "${gravityDBfile}" "INSERT INTO \"auditlist\" (domain) VALUES ${domains};" } clearAudit() { - sqlite3 "${gravityDBfile}" "DELETE FROM \"audit\";" + sqlite3 "${gravityDBfile}" "DELETE FROM \"auditlist\";" } SetPrivacyLevel() { diff --git a/advanced/Templates/gravity.db.sql b/advanced/Templates/gravity.db.sql index eef9ac80..78999e7c 100644 --- a/advanced/Templates/gravity.db.sql +++ b/advanced/Templates/gravity.db.sql @@ -81,12 +81,11 @@ CREATE TABLE gravity domain TEXT PRIMARY KEY ); -CREATE TABLE audit +CREATE TABLE auditlist ( id INTEGER PRIMARY KEY AUTOINCREMENT, domain TEXT UNIQUE NOT NULL, - date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), - comment TEXT + date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)) ); CREATE TABLE info diff --git a/gravity.sh b/gravity.sh index 724238fa..09c66c4f 100755 --- a/gravity.sh +++ b/gravity.sh @@ -30,7 +30,7 @@ whitelistFile="${piholeDir}/whitelist.txt" blacklistFile="${piholeDir}/blacklist.txt" regexFile="${piholeDir}/regex.list" adListFile="${piholeDir}/adlists.list" -auditFile="${piholeDir}/audit.list" +auditFile="${piholeDir}/auditlog.list" localList="${piholeDir}/local.list" VPNList="/etc/openvpn/ipp.txt" @@ -119,12 +119,12 @@ database_table_from_file() { declare -i rowid rowid=1 # Read file line by line - if [[ "${table}" == "audit" ]]; then + if [[ "${table}" == "auditlist" ]]; then grep -v '^ *#' < "${source}" | while IFS= read -r domain do # Only add non-empty lines if [[ ! -z "${domain}" ]]; then - # Audit table format + # Auditlist table format echo "${rowid},\"${domain}\",${timestamp}" >> "${tmpFile}" rowid+=1 fi @@ -198,7 +198,7 @@ migrate_to_database() { if [ -e "${auditFile}" ]; then # Store audit domains in database echo -e " ${INFO} Migrating content of ${auditFile} into new database" - database_table_from_file "audit" "${auditFile}" + database_table_from_file "auditlist" "${auditFile}" fi }