mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +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
1 changed files with 6 additions and 6 deletions
|
@ -170,7 +170,7 @@ Displaylist() {
|
|||
local list listname count num_pipes domain enabled status nicedate
|
||||
|
||||
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
|
||||
echo -e "Not showing empty ${listname}"
|
||||
|
@ -186,9 +186,9 @@ Displaylist() {
|
|||
num_pipes="$(grep -c "^" <<< "$(grep -o "|" <<< "${line}")")"
|
||||
|
||||
# Extract domain and enabled status based on the obtained number of pipe characters
|
||||
domain="$(cut -d'|' -f"-$((num_pipes-3))" <<< "${line}")"
|
||||
enabled="$(cut -d'|' -f"$((num_pipes-2))" <<< "${line}")"
|
||||
dateadded="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
|
||||
domain="$(cut -d'|' -f"-$((num_pipes-1))" <<< "${line}")"
|
||||
enabled="$(cut -d'|' -f"$((num_pipes))" <<< "${line}")"
|
||||
datemod="$(cut -d'|' -f"$((num_pipes+1))" <<< "${line}")"
|
||||
|
||||
# Translate boolean status into human readable string
|
||||
if [[ "${enabled}" -eq 1 ]]; then
|
||||
|
@ -198,9 +198,9 @@ Displaylist() {
|
|||
fi
|
||||
|
||||
# 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))
|
||||
done <<< "${data}"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue