function antispam_set_counter in AntiSpam 6
Same name and namespace in other branches
- 7 antispam.module \antispam_set_counter()
Set today's counter value for the specified counter type
1 call to antispam_set_counter()
- antispam_increase_counter in ./
antispam.module - Increase today's counter value for the specified counter type by 1
File
- ./
antispam.module, line 336
Code
function antispam_set_counter($counter_type, $count) {
// for today
switch ($counter_type) {
case ANTISPAM_COUNT_ALL:
return;
case ANTISPAM_COUNT_SPAM_DETECTED:
$field = 'spam_detected';
break;
case ANTISPAM_COUNT_HAM_DETECTED:
$field = 'ham_detected';
break;
case ANTISPAM_COUNT_FALSE_NEGATIVE:
$field = 'false_negative';
break;
case ANTISPAM_COUNT_FALSE_POSITIVE:
$field = 'false_positive';
break;
default:
return;
}
db_query("UPDATE {antispam_counter} SET %s = %d WHERE date = '%s'", $field, $count, date('Y-m-d 00:00:00'));
if (!db_affected_rows()) {
$provider = antispam_get_service_provider();
db_query("INSERT INTO {antispam_counter} (date, provider, %s) VALUES ('%s', %d, %d)", $field, date('Y-m-d 00:00:00'), $provider, $count);
}
}