API verb summary returning incorrect information

Problem with Beta 5.0:
The API verb "summary" (/admin/api.php?summary) is incorrectly reporting status as "enabled" in the returned JSON document

{"domains_being_blocked":"92,265","dns_queries_today":"137","ads_blocked_today":"0","ads_percentage_today":"0.0","unique_domains":"18","queries_forwarded":"67","queries_cached":"70","clients_ever_seen":"1","unique_clients":"1","dns_queries_all_types":"137","reply_NODATA":"3","reply_NXDOMAIN":"0","reply_CNAME":"0","reply_IP":"3","privacy_level":"0","status":"enabled","gravity_last_updated":{"file_exists":true,"absolute":1587599942,"relative":{"days":0,"hours":1,"minutes":15}}}

Debug Token:
[Replace this text with the debug token provided from running pihole -d (or running the debug script through the web interface]

How does this compare to the information shown following this command line entry:

echo ">stats >quit" | nc localhost 4711

That is also returning enabled:

$ echo ">stats >quit" | nc localhost 4711
domains_being_blocked 92265
dns_queries_today 381
ads_blocked_today 109
ads_percentage_today 28.608923
unique_domains 286
queries_forwarded 193
queries_cached 79
clients_ever_seen 3
unique_clients 3
dns_queries_all_types 381
reply_NODATA 3
reply_NXDOMAIN 5
reply_CNAME 80
reply_IP 158
privacy_level 0
status enabled

Thanks for reporting this bug! It has no direct influcence anywhere on the dashboard as the callback api.php?status is used instead. This one is reporting the correct status.

The bug will be fixed by

The underlying issue was that we decided whether blocking is enabled or not by counting the blocked domains in Pi-hole v4.x. However, with Pi-hole v5.0, the number of blocked domains does not change when you enable or disable blocking to speed up the entire process. Instead, we check immediately before a database lookup whether we can skip this as the user doesn't want any domains to be blocked at all.

1 Like

This PR has been merged.