mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Merge pull request #1743 from yubiuser/fix/database_new_status_types
Don't count new status types as blocked queries in long-term data
This commit is contained in:
+4
-3
@@ -202,7 +202,8 @@ if (isset($_GET['topDomains']) && $auth)
|
||||
{
|
||||
$limit = " AND timestamp <= :until";
|
||||
}
|
||||
$stmt = $db->prepare('SELECT domain,count(domain) FROM queries WHERE (STATUS == 2 OR STATUS == 3)'.$limit.' GROUP by domain order by count(domain) desc limit 20');
|
||||
// Select top permitted domains only
|
||||
$stmt = $db->prepare('SELECT domain,count(domain) FROM queries WHERE status IN (2,3,12,13,14)'.$limit.' GROUP by domain order by count(domain) desc limit 20');
|
||||
$stmt->bindValue(":from", intval($_GET['from']), SQLITE3_INTEGER);
|
||||
$stmt->bindValue(":until", intval($_GET['until']), SQLITE3_INTEGER);
|
||||
$results = $stmt->execute();
|
||||
@@ -252,7 +253,7 @@ if (isset($_GET['topAds']) && $auth)
|
||||
{
|
||||
$limit = " AND timestamp <= :until";
|
||||
}
|
||||
$stmt = $db->prepare('SELECT domain,count(domain) FROM queries WHERE (STATUS == 1 OR STATUS > 3)'.$limit.' GROUP by domain order by count(domain) desc limit 10');
|
||||
$stmt = $db->prepare('SELECT domain,count(domain) FROM queries WHERE status IN (1,4,5,6,7,8,9,10,11)'.$limit.' GROUP by domain order by count(domain) desc limit 10');
|
||||
$stmt->bindValue(":from", intval($_GET['from']), SQLITE3_INTEGER);
|
||||
$stmt->bindValue(":until", intval($_GET['until']), SQLITE3_INTEGER);
|
||||
$results = $stmt->execute();
|
||||
@@ -384,7 +385,7 @@ if (isset($_GET['getGraphData']) && $auth)
|
||||
$data = array_merge($data, $result);
|
||||
|
||||
// Count blocked queries in intervals
|
||||
$stmt = $db->prepare('SELECT (timestamp/:interval)*:interval interval, COUNT(*) FROM queries WHERE (status == 1 OR status > 3)'.$limit.' GROUP by interval ORDER by interval');
|
||||
$stmt = $db->prepare('SELECT (timestamp/:interval)*:interval interval, COUNT(*) FROM queries WHERE status IN (1,4,5,6,7,8,9,10,11)'.$limit.' GROUP by interval ORDER by interval');
|
||||
$stmt->bindValue(":from", $from, SQLITE3_INTEGER);
|
||||
$stmt->bindValue(":until", $until, SQLITE3_INTEGER);
|
||||
$stmt->bindValue(":interval", $interval, SQLITE3_INTEGER);
|
||||
|
||||
@@ -146,7 +146,7 @@ var reloadCallback = function () {
|
||||
var data = tableApi.rows().data();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
statistics[0]++; // TOTAL query
|
||||
if (data[i][4] === 1 || (data[i][4] > 4 && data[i][4] !== 10)) {
|
||||
if (data[i][4] === 1 || (data[i][4] > 4 && ![10, 12, 13, 14].includes(data[i][4]))) {
|
||||
statistics[2]++; // EXACT blocked
|
||||
} else if (data[i][4] === 3) {
|
||||
statistics[1]++; // CACHE query
|
||||
|
||||
Reference in New Issue
Block a user