function _spam_update_statistics in Spam 6
Increment internal counters.
9 calls to _spam_update_statistics()
- spam_content_filter in ./
spam.module - API call to determine the likeliness that a given piece of content is spam, returning a rating from 1% likelihood to 99% likelihood. It is unlikely that you want to call this function directly.
- spam_content_insert in ./
spam.module - This function is called when new content is first posted to your website.
- spam_content_update in ./
spam.module - This function is called when content on your website is updated.
- spam_mark_as_not_spam in ./
spam.module - Invoke appropriate actions for marking content as not spam. TODO: Integrate with the Actions module, making actions fully configurable.
- spam_mark_as_spam in ./
spam.module - Invoke appropriate actions for marking content as spam. TODO: Integrate with the Actions module, making actions fully configurable.
File
- ./
spam.module, line 419 - Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.
Code
function _spam_update_statistics($name, $op = '+', $inc = 1) {
spam_log(LOG_DEBUG, 'spam_update_statistics', t('@name = @name @op @inc', array(
'@name' => $name,
'@op' => $op,
'@inc' => $inc,
)));
if ($op != '+' && $op != '-') {
watchdog('spam', 'Invalid operator(@op), ignored.', array(
'@op' => $op,
));
return;
}
db_query("UPDATE {spam_statistics} SET count = count %s %d, timestamp = %d WHERE name = '%s'", $op, $inc, time(), $name);
if (!db_affected_rows()) {
if ($op == '-') {
$inc *= -1;
}
db_query("INSERT INTO {spam_statistics} (name, count, timestamp) VALUES('%s', %d, %d)", $name, $inc, time());
}
}