function activity_cron in Activity 6
Same name and namespace in other branches
- 5.4 activity.module \activity_cron()
- 6.2 activity.module \activity_cron()
Implementation of hook_cron().
File
- ./
activity.module, line 448 - activity.module
Code
function activity_cron() {
// users set an interval on the module settings page
$interval = variable_get('activity_purge', 0);
if ($interval > 0) {
$time = time() - $interval;
if (module_exists('activityhistory')) {
db_query('DELETE FROM {activity_history} WHERE aid IN (SELECT aid FROM {activity} WHERE created < %d)', $time);
}
db_query('DELETE FROM {activity_targets} WHERE aid IN (SELECT aid FROM {activity} WHERE created < %d)', $time);
db_query('DELETE FROM {activity} WHERE created < %d', $time);
}
}