mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Rely on default value (database provided) for date_added when adding a new domain
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
8524aecfed
commit
3fe43ce1d9
@ -133,15 +133,12 @@ AddDomain() {
|
|||||||
|
|
||||||
# Domain not found in the table, add it!
|
# Domain not found in the table, add it!
|
||||||
if [[ "${verbose}" == true ]]; then
|
if [[ "${verbose}" == true ]]; then
|
||||||
echo -e " ${INFO} Adding ${1} to ${listname}..."
|
echo -e " ${INFO} Adding ${1} to the ${listname}..."
|
||||||
fi
|
fi
|
||||||
reload=true
|
reload=true
|
||||||
# Add it to the list we want to add it to
|
# Insert only the domain here. The enabled and date_added fields will be filled
|
||||||
local timestamp
|
# with their default values (enabled = true, date_added = current timestamp)
|
||||||
timestamp="$(date --utc +'%s')"
|
sqlite3 "${gravityDBfile}" "INSERT INTO ${list} (domain) VALUES (\"${domain}\");"
|
||||||
# Insert only domain and date_added here. The enabled fields will be filled
|
|
||||||
# with its default value is true.
|
|
||||||
sqlite3 "${gravityDBfile}" "INSERT INTO ${list} (domain,date_added) VALUES (\"${domain}\",${timestamp});"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveDomain() {
|
RemoveDomain() {
|
||||||
@ -162,12 +159,10 @@ RemoveDomain() {
|
|||||||
|
|
||||||
# Domain found in the table, remove it!
|
# Domain found in the table, remove it!
|
||||||
if [[ "${verbose}" == true ]]; then
|
if [[ "${verbose}" == true ]]; then
|
||||||
echo -e " ${INFO} Removing ${1} from ${listname}..."
|
echo -e " ${INFO} Removing ${1} from the ${listname}..."
|
||||||
fi
|
fi
|
||||||
reload=true
|
reload=true
|
||||||
# Remove it from the current list
|
# Remove it from the current list
|
||||||
local timestamp
|
|
||||||
timestamp="$(date --utc +'%s')"
|
|
||||||
sqlite3 "${gravityDBfile}" "DELETE FROM ${list} WHERE domain = \"${domain}\";"
|
sqlite3 "${gravityDBfile}" "DELETE FROM ${list} WHERE domain = \"${domain}\";"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +190,6 @@ Displaylist() {
|
|||||||
enabled="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
|
enabled="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
|
||||||
dateadded="$(cut -d'|' -f"$((num_pipes))" <<< "${line}")"
|
dateadded="$(cut -d'|' -f"$((num_pipes))" <<< "${line}")"
|
||||||
|
|
||||||
echo "${dateadded}"
|
|
||||||
# Translate boolean status into human readable string
|
# Translate boolean status into human readable string
|
||||||
if [[ "${enabled}" -eq 1 ]]; then
|
if [[ "${enabled}" -eq 1 ]]; then
|
||||||
status="enabled"
|
status="enabled"
|
||||||
|
Loading…
Reference in New Issue
Block a user