function recommender_cron in Recommender API 7.3
Same name and namespace in other branches
- 6.3 recommender.module \recommender_cron()
- 6.2 recommender.module \recommender_cron()
- 7.6 recommender.module \recommender_cron()
- 7.4 recommender.module \recommender_cron()
- 7.5 recommender.module \recommender_cron()
File
- ./
recommender.module, line 186 - Providing generic recommender system algorithms.
Code
function recommender_cron() {
// if cron is null, then never run cron for the app.
// else if recommender never get executed (execution_id=null), then run it.
// otherwise, run only when last command (c.created) is before current time minus cron.
$rows = db_query("SELECT a.name FROM {recommender_app} a LEFT OUTER JOIN {async_command} c ON a.execution_id = c.id \n \t\tWHERE cron IS NOT NULL AND (a.execution_id IS NULL OR c.created + a.cron < :current)", array(
':current' => time(),
));
foreach ($rows as $row) {
recommender_create_command($row->name);
}
}