@@ -154,26 +154,19 @@ def restart_pihole(docker):
154154 sqliteConnection = sqlite3 .connect (gravity_db_location )
155155 cursor = sqliteConnection .cursor ()
156156 print ('[i] Successfully Connected to Gravity database' )
157- total_domains = cursor .execute (
158- " SELECT * FROM domainlist WHERE type = 0 AND comment LIKE '%qjz9zk%' " )
159- print ( "[i] There are a total of {} domains in your whitelist which are added by my script" . format (
160- len ( total_domains . fetchall ()) ))
157+ total_domains = cursor .execute (" SELECT * FROM domainlist WHERE type = 0 AND comment LIKE '%qjz9zk%' " )
158+
159+ totalDomains = len ( total_domains . fetchall ())
160+ print ( "[i] There are a total of {} domains in your whitelist which are added by my script" . format ( totalDomains ))
161161 print ('[i] Removing domains in the Gravity database' )
162- cursor .execute (
163- " DELETE FROM domainlist WHERE type = 0 AND comment LIKE '%qjz9zk%' " )
162+ cursor .execute (" DELETE FROM domainlist WHERE type = 0 AND comment LIKE '%qjz9zk%' " )
164163
165164 sqliteConnection .commit ()
166165
167- # total_changes is returning 2x the actual value. ¯\_(ツ)_/¯
168- # if I made a mistake, please create a PR
169- numberOfDomains = sqliteConnection .total_changes
170- if numberOfDomains > 1 :
171- numberOfDomains = numberOfDomains // 2
172- print ("[i] {} domains are removed" .format (numberOfDomains ))
173- remaining_domains = cursor .execute (
174- " SELECT * FROM domainlist WHERE type = 0 OR type = 2 " )
175- print ("[i] There are a total of {} domains remaining in your whitelist" .format (
176- len (remaining_domains .fetchall ())))
166+ # we only removed domains we added so use total_domains
167+ print ("[i] {} domains are removed" .format (totalDomains ))
168+ remaining_domains = cursor .execute (" SELECT * FROM domainlist WHERE type = 0 OR type = 2 " )
169+ print ("[i] There are a total of {} domains remaining in your exact whitelist" .format (len (remaining_domains .fetchall ())))
177170
178171 cursor .close ()
179172
0 commit comments