1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 14:58:08 +00:00

Rename table to "auditlist"

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-07-05 16:28:36 +02:00
parent 82476138c1
commit 2fb4256f84
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
4 changed files with 9 additions and 10 deletions

View File

@ -1,4 +1,4 @@
CREATE TABLE audit
CREATE TABLE auditlist
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
domain TEXT UNIQUE NOT NULL,

View File

@ -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() {

View File

@ -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

View File

@ -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
}