From bf3259b73c61a73501cc325cb7622bdc4b81c408 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 4 Jul 2016 07:13:18 +0200 Subject: [PATCH] benchs: prevent too much records from the same user --- web/yaamp/core/backend/bench.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/yaamp/core/backend/bench.php b/web/yaamp/core/backend/bench.php index 79af578..8de46f7 100644 --- a/web/yaamp/core/backend/bench.php +++ b/web/yaamp/core/backend/bench.php @@ -12,8 +12,17 @@ function BenchUpdateChips() foreach ($benchs as $bench) { if (empty($bench->vendorid) || empty($bench->device)) continue; - debuglog("bench: {$bench->device}..."); + $dups = getdbocount('db_benchmarks', "vendorid=:vid AND client=:client AND os=:os AND driver=:drv AND throughput=:thr AND userid=:uid", + array(':vid'=>$bench->vendorid, ':client'=>$bench->client, ':os'=>$bench->os, ':drv'=>$bench->driver,':thr'=>$bench->throughput,':uid'=>$bench->userid) + ); + if ($dups > 10) { + debuglog("bench: {$bench->device} ignored ($dups records already present)"); + $bench->delete(); + continue; + } + $chip = getChipName($bench->attributes); + debuglog("bench: {$bench->device} ($chip)..."); if (!empty($chip) && $chip != '-') { $bench->chip = $chip; $bench->save();