mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-23 07:18:07 +00:00
Query only those columns we actually use when showing domains on the CLI. Show date of last modification instead of addition date for domains.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
d46ff1d2d7
commit
0bc112ce52
@ -170,7 +170,7 @@ Displaylist() {
|
|||||||
local list listname count num_pipes domain enabled status nicedate
|
local list listname count num_pipes domain enabled status nicedate
|
||||||
|
|
||||||
listname="${listType}"
|
listname="${listType}"
|
||||||
data="$(sqlite3 "${gravityDBfile}" "SELECT * FROM ${listType};" 2> /dev/null)"
|
data="$(sqlite3 "${gravityDBfile}" "SELECT domain,enabled,date_modified FROM ${listType};" 2> /dev/null)"
|
||||||
|
|
||||||
if [[ -z $data ]]; then
|
if [[ -z $data ]]; then
|
||||||
echo -e "Not showing empty ${listname}"
|
echo -e "Not showing empty ${listname}"
|
||||||
@ -186,9 +186,9 @@ Displaylist() {
|
|||||||
num_pipes="$(grep -c "^" <<< "$(grep -o "|" <<< "${line}")")"
|
num_pipes="$(grep -c "^" <<< "$(grep -o "|" <<< "${line}")")"
|
||||||
|
|
||||||
# Extract domain and enabled status based on the obtained number of pipe characters
|
# Extract domain and enabled status based on the obtained number of pipe characters
|
||||||
domain="$(cut -d'|' -f"-$((num_pipes-3))" <<< "${line}")"
|
domain="$(cut -d'|' -f"-$((num_pipes-1))" <<< "${line}")"
|
||||||
enabled="$(cut -d'|' -f"$((num_pipes-2))" <<< "${line}")"
|
enabled="$(cut -d'|' -f"$((num_pipes))" <<< "${line}")"
|
||||||
dateadded="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
|
datemod="$(cut -d'|' -f"$((num_pipes+1))" <<< "${line}")"
|
||||||
|
|
||||||
# Translate boolean status into human readable string
|
# Translate boolean status into human readable string
|
||||||
if [[ "${enabled}" -eq 1 ]]; then
|
if [[ "${enabled}" -eq 1 ]]; then
|
||||||
@ -198,9 +198,9 @@ Displaylist() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Get nice representation of numerical date stored in database
|
# Get nice representation of numerical date stored in database
|
||||||
nicedate=$(date --rfc-2822 -d "@${dateadded}")
|
nicedate=$(date --rfc-2822 -d "@${datemod}")
|
||||||
|
|
||||||
echo " ${count}: ${domain} (${status}, added ${nicedate})"
|
echo " ${count}: ${domain} (${status}, last modified ${nicedate})"
|
||||||
count=$((count+1))
|
count=$((count+1))
|
||||||
done <<< "${data}"
|
done <<< "${data}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user