mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Remove sqlitekey variable as the first column of the regex table is now called domain as well
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
3dcb9722d3
commit
e04dc9d2bb
1 changed files with 4 additions and 7 deletions
|
@ -23,7 +23,6 @@ domList=()
|
||||||
|
|
||||||
listType=""
|
listType=""
|
||||||
listname=""
|
listname=""
|
||||||
sqlitekey=""
|
|
||||||
|
|
||||||
colfile="/opt/pihole/COL_TABLE"
|
colfile="/opt/pihole/COL_TABLE"
|
||||||
source ${colfile}
|
source ${colfile}
|
||||||
|
@ -92,11 +91,9 @@ ProcessDomainList() {
|
||||||
if [[ "${listType}" == "regex" ]]; then
|
if [[ "${listType}" == "regex" ]]; then
|
||||||
# Regex filter list
|
# Regex filter list
|
||||||
listname="regex filters"
|
listname="regex filters"
|
||||||
sqlitekey="filter"
|
|
||||||
else
|
else
|
||||||
# Whitelist / Blacklist
|
# Whitelist / Blacklist
|
||||||
listname="${listType}"
|
listname="${listType}"
|
||||||
sqlitekey="domain"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for dom in "${domList[@]}"; do
|
for dom in "${domList[@]}"; do
|
||||||
|
@ -125,7 +122,7 @@ AddDomain() {
|
||||||
list="$2"
|
list="$2"
|
||||||
|
|
||||||
# Is the domain in the list we want to add it to?
|
# Is the domain in the list we want to add it to?
|
||||||
num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE ${sqlitekey} = \"${domain}\";")"
|
num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = \"${domain}\";")"
|
||||||
|
|
||||||
if [[ "${num}" -ne 0 ]]; then
|
if [[ "${num}" -ne 0 ]]; then
|
||||||
if [[ "${verbose}" == true ]]; then
|
if [[ "${verbose}" == true ]]; then
|
||||||
|
@ -144,7 +141,7 @@ AddDomain() {
|
||||||
timestamp="$(date --utc +'%s')"
|
timestamp="$(date --utc +'%s')"
|
||||||
# Insert only domain and date_added here. The enabled fields will be filled
|
# Insert only domain and date_added here. The enabled fields will be filled
|
||||||
# with its default value is true.
|
# with its default value is true.
|
||||||
sqlite3 "${gravityDBfile}" "INSERT INTO ${list} (${sqlitekey},date_added) VALUES (\"${domain}\",${timestamp});"
|
sqlite3 "${gravityDBfile}" "INSERT INTO ${list} (domain,date_added) VALUES (\"${domain}\",${timestamp});"
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveDomain() {
|
RemoveDomain() {
|
||||||
|
@ -154,7 +151,7 @@ RemoveDomain() {
|
||||||
list="$2"
|
list="$2"
|
||||||
|
|
||||||
# Is the domain in the list we want to remove it from?
|
# Is the domain in the list we want to remove it from?
|
||||||
num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE ${sqlitekey} = \"${domain}\";")"
|
num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = \"${domain}\";")"
|
||||||
|
|
||||||
if [[ "${num}" -eq 0 ]]; then
|
if [[ "${num}" -eq 0 ]]; then
|
||||||
if [[ "${verbose}" == true ]]; then
|
if [[ "${verbose}" == true ]]; then
|
||||||
|
@ -171,7 +168,7 @@ RemoveDomain() {
|
||||||
# Remove it from the current list
|
# Remove it from the current list
|
||||||
local timestamp
|
local timestamp
|
||||||
timestamp="$(date --utc +'%s')"
|
timestamp="$(date --utc +'%s')"
|
||||||
sqlite3 "${gravityDBfile}" "DELETE FROM ${list} WHERE ${sqlitekey} = \"${domain}\";"
|
sqlite3 "${gravityDBfile}" "DELETE FROM ${list} WHERE domain = \"${domain}\";"
|
||||||
}
|
}
|
||||||
|
|
||||||
Displaylist() {
|
Displaylist() {
|
||||||
|
|
Loading…
Reference in a new issue