Add vw_adlists view which returns only enabled adlists

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-04-26 17:36:00 +02:00
parent 53e3ff2b24
commit bd0215524b
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
2 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,10 @@ CREATE VIEW vw_whitelist AS SELECT DISTINCT a.domain
FROM whitelist a
WHERE a.enabled == 1;
CREATE VIEW vw_regex AS SELECT DISTINCT a.filter
CREATE VIEW vw_regex AS SELECT DISTINCT a.domain
FROM regex a
WHERE a.enabled == 1;
CREATE VIEW vw_adlists AS SELECT DISTINCT a.address
FROM adlists a
WHERE a.enabled == 1;

View File

@ -238,7 +238,7 @@ gravity_GetBlocklistUrls() {
# Retrieve source URLs from gravity database
# We source only enabled adlists, sqlite3 stores boolean values as 0 (false) or 1 (true)
mapfile -t sources <<< "$(sqlite3 "${gravityDBfile}" "SELECT address FROM adlists WHERE enabled = 1;" 2> /dev/null)"
mapfile -t sources <<< "$(sqlite3 "${gravityDBfile}" "SELECT address FROM vw_adlists;" 2> /dev/null)"
# Parse source domains from $sources
mapfile -t sourceDomains <<< "$(