[pve-devel] [PATCH pmg-api] fix #2622: include all spem levels

Dominik Csapak d.csapak at proxmox.com
Tue Mar 3 09:34:56 CET 2020


oops, sent to the wrong list, meant for pmg-devel at pve.proxmox.com

On 3/3/20 9:33 AM, Dominik Csapak wrote:
> by using 'LIMIT 10' for the spamlevels, we only got the first
> 10 spamlevels back from the database (whatever they were)
> 
> this is only ok if there are only <= 10 different spamlevels in the database
> but not if there are more
> 
> the call site of this uses the combined spam count of this sub
> for calculating the 'rest' (meaning the mails with spam level 0)
> 
> but this is obviously wrong if not all spamlevels are counted
> so simply return all available levels
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>   src/PMG/Statistic.pm | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PMG/Statistic.pm b/src/PMG/Statistic.pm
> index b00fed4..6d27930 100755
> --- a/src/PMG/Statistic.pm
> +++ b/src/PMG/Statistic.pm
> @@ -431,7 +431,7 @@ sub total_spam_stat {
>   
>       my $sth = $rdb->{dbh}->prepare("SELECT spamlevel, COUNT(spamlevel) AS count FROM CStatistic " .
>   				   "WHERE virusinfo IS NULL and time >= ? AND time < ? AND ptime > 0 AND spamlevel > 0 " .
> -				   "GROUP BY spamlevel ORDER BY spamlevel LIMIT 10");
> +				   "GROUP BY spamlevel ORDER BY spamlevel");
>       $sth->execute($from, $to);
>   
>       my $res = $sth->fetchall_arrayref({});
> 





More information about the pve-devel mailing list