This commit is contained in:
Mario Fetka 2016-02-04 22:19:15 +01:00
parent 5e82ace808
commit 8395d0ed52

View File

@ -129,7 +129,7 @@ class DBEngine {
MAX(stattable.badheaders) AS badheaders, MAX(stattable.badheaders) AS badheaders,
MAX(stattable.pending) AS pending MAX(stattable.pending) AS pending
FROM ( FROM (
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
COUNT(msgs.content) AS spam, COUNT(msgs.content) AS spam,
0 AS banned, 0 AS banned,
0 AS viruses, 0 AS viruses,
@ -138,9 +138,9 @@ class DBEngine {
FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE msgs.content='S' AND NOT (msgs.quar_type = '') WHERE msgs.content='S' AND NOT (msgs.quar_type = '')
AND msgrcpt.rs IN ('','v') AND msgrcpt.rs IN ('','v')
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION UNION
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam, 0 AS spam,
COUNT(msgs.content) AS banned, COUNT(msgs.content) AS banned,
0 AS viruses, 0 AS viruses,
@ -149,9 +149,9 @@ class DBEngine {
FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE msgs.content='B' AND NOT (msgs.quar_type = '') WHERE msgs.content='B' AND NOT (msgs.quar_type = '')
AND msgrcpt.rs IN ('','v') AND msgrcpt.rs IN ('','v')
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION UNION
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam, 0 AS spam,
0 AS banned, 0 AS banned,
COUNT(msgs.content) AS viruses, COUNT(msgs.content) AS viruses,
@ -160,9 +160,9 @@ class DBEngine {
FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE msgs.content='V' AND NOT (msgs.quar_type = '') WHERE msgs.content='V' AND NOT (msgs.quar_type = '')
AND msgrcpt.rs IN ('','v') AND msgrcpt.rs IN ('','v')
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION UNION
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam, 0 AS spam,
0 AS banned, 0 AS banned,
0 AS viruses, 0 AS viruses,
@ -171,9 +171,9 @@ class DBEngine {
FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE msgs.content='H' AND NOT (msgs.quar_type = '') WHERE msgs.content='H' AND NOT (msgs.quar_type = '')
AND msgrcpt.rs IN ('','v') AND msgrcpt.rs IN ('','v')
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION UNION
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam, 0 AS spam,
0 AS banned, 0 AS banned,
0 AS viruses, 0 AS viruses,
@ -181,7 +181,7 @@ class DBEngine {
COUNT(msgs.content) AS pending COUNT(msgs.content) AS pending
FROM msgs JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id FROM msgs JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE msgrcpt.rs='p' AND NOT (msgs.quar_type = '') WHERE msgrcpt.rs='p' AND NOT (msgs.quar_type = '')
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
) AS stattable ) AS stattable
GROUP BY date GROUP BY date
ORDER BY date"; ORDER BY date";
@ -249,7 +249,7 @@ class DBEngine {
MAX(stattable.badheaders) AS badheaders, MAX(stattable.badheaders) AS badheaders,
MAX(stattable.pending) AS pending MAX(stattable.pending) AS pending
FROM ( FROM (
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
COUNT(msgs.content) AS spam, COUNT(msgs.content) AS spam,
0 AS banned, 0 AS banned,
0 AS viruses, 0 AS viruses,
@ -259,9 +259,9 @@ class DBEngine {
$join_type maddr AS recip ON msgrcpt.rid=recip.id $join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE msgs.content='S' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v') WHERE msgs.content='S' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v')
AND $recipEmailClause AND $recipEmailClause
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION UNION
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam, 0 AS spam,
COUNT(msgs.content) AS banned, COUNT(msgs.content) AS banned,
0 AS viruses, 0 AS viruses,
@ -271,9 +271,9 @@ class DBEngine {
$join_type maddr AS recip ON msgrcpt.rid=recip.id $join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE msgs.content='B' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v') WHERE msgs.content='B' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v')
AND $recipEmailClause AND $recipEmailClause
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION UNION
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam, 0 AS spam,
0 AS banned, 0 AS banned,
COUNT(msgs.content) AS viruses, COUNT(msgs.content) AS viruses,
@ -283,9 +283,9 @@ class DBEngine {
$join_type maddr AS recip ON msgrcpt.rid=recip.id $join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE msgs.content='V' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v') WHERE msgs.content='V' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v')
AND $recipEmailClause AND $recipEmailClause
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION UNION
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam, 0 AS spam,
0 AS banned, 0 AS banned,
0 AS viruses, 0 AS viruses,
@ -295,9 +295,9 @@ class DBEngine {
$join_type maddr AS recip ON msgrcpt.rid=recip.id $join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE msgs.content='H' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v') WHERE msgs.content='H' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v')
AND $recipEmailClause AND $recipEmailClause
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION UNION
SELECT CAST(time_iso AS DATE) AS date, SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam, 0 AS spam,
0 AS banned, 0 AS banned,
0 AS viruses, 0 AS viruses,
@ -307,7 +307,7 @@ class DBEngine {
$join_type maddr AS recip ON msgrcpt.rid=recip.id $join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE msgrcpt.rs='p' AND NOT (msgs.quar_type = '') WHERE msgrcpt.rs='p' AND NOT (msgs.quar_type = '')
AND $recipEmailClause AND $recipEmailClause
GROUP BY CAST(time_iso AS DATE) GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
) AS stattable ) AS stattable
GROUP BY date GROUP BY date
ORDER BY date"; ORDER BY date";