mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Rename table to "auditlist"
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
82476138c1
commit
2fb4256f84
4 changed files with 9 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
|||
CREATE TABLE audit
|
||||
CREATE TABLE auditlist
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
domain TEXT UNIQUE NOT NULL,
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue