From bd0215524ba0191b5364a596e769027a22be88fd Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 26 Apr 2019 17:36:00 +0200 Subject: [PATCH] Add vw_adlists view which returns only enabled adlists Signed-off-by: DL6ER --- advanced/Templates/gravity.db.sql | 6 +++++- gravity.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/advanced/Templates/gravity.db.sql b/advanced/Templates/gravity.db.sql index cd62c94e..ebe97955 100644 --- a/advanced/Templates/gravity.db.sql +++ b/advanced/Templates/gravity.db.sql @@ -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; diff --git a/gravity.sh b/gravity.sh index 1d94424f..a0652ced 100755 --- a/gravity.sh +++ b/gravity.sh @@ -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 <<< "$(