1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
--- lib/DBEngine.class.php.orig 2010-11-24 11:32:33.000000000 +0100
+++ lib/DBEngine.class.php 2010-11-24 11:32:41.000000000 +0100
@@ -132,7 +132,7 @@
MAX(stattable.badheaders) AS badheaders,
MAX(stattable.pending) AS pending
FROM (
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
COUNT(content) AS spam,
0 AS banned,
0 AS viruses,
@@ -141,9 +141,9 @@
FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE content='S' AND NOT (msgs.quar_type = '')
AND msgrcpt.rs IN ('','v')
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam,
COUNT(content) AS banned,
0 AS viruses,
@@ -152,9 +152,9 @@
FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE content='B' AND NOT (msgs.quar_type = '')
AND msgrcpt.rs IN ('','v')
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam,
0 AS banned,
COUNT(content) AS viruses,
@@ -163,9 +163,9 @@
FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE content='V' AND NOT (msgs.quar_type = '')
AND msgrcpt.rs IN ('','v')
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam,
0 AS banned,
0 AS viruses,
@@ -174,9 +174,9 @@
FROM msgs INNER JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
WHERE content='H' AND NOT (msgs.quar_type = '')
AND msgrcpt.rs IN ('','v')
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam,
0 AS banned,
0 AS viruses,
@@ -184,7 +184,7 @@
COUNT(content) AS pending
FROM msgs JOIN msgrcpt ON msgs.mail_id=msgrcpt.mail_id
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
GROUP BY date
ORDER BY date";
@@ -253,7 +253,7 @@
MAX(stattable.badheaders) AS badheaders,
MAX(stattable.pending) AS pending
FROM (
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
COUNT(content) AS spam,
0 AS banned,
0 AS viruses,
@@ -263,9 +263,9 @@
$join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE content='S' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v')
AND $recipEmailClause
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam,
COUNT(content) AS banned,
0 AS viruses,
@@ -275,9 +275,9 @@
$join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE content='B' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v')
AND $recipEmailClause
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam,
0 AS banned,
COUNT(content) AS viruses,
@@ -287,9 +287,9 @@
$join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE content='V' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v')
AND $recipEmailClause
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam,
0 AS banned,
0 AS viruses,
@@ -299,9 +299,9 @@
$join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE content='H' AND NOT (msgs.quar_type = '') AND msgrcpt.rs IN ('','v')
AND $recipEmailClause
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
UNION
- SELECT CAST(time_iso AS DATE) AS date,
+ SELECT CAST(FROM_UNIXTIME(time_num) AS DATE) AS date,
0 AS spam,
0 AS banned,
0 AS viruses,
@@ -311,7 +311,7 @@
$join_type maddr AS recip ON msgrcpt.rid=recip.id
WHERE msgrcpt.rs='p' AND NOT (msgs.quar_type = '')
AND $recipEmailClause
- GROUP BY CAST(time_iso AS DATE)
+ GROUP BY CAST(FROM_UNIXTIME(time_num) AS DATE)
) AS stattable
GROUP BY date
ORDER BY date";
|