function quotes_cron in Quotes 5
Same name and namespace in other branches
- 6 quotes.module \quotes_cron()
- 7 quotes.module \quotes_cron()
Implementation of hook_cron().
File
- ./
quotes.module, line 991
Code
function quotes_cron() {
$result = db_query("SELECT qb.* FROM {quotes_blocks} qb INNER JOIN {blocks} b ON b.module = 'quotes' WHERE b.status = 1 AND qb.cron_interval > 0 AND (qb.vid = 0 OR (qb.cron_last + (qb.cron_step * qb.cron_interval)) < %d)", time());
for ($updated = FALSE; $block = db_fetch_array($result); $updated = TRUE) {
$quotes = quotes_get_quote($block, TRUE, 1);
db_query('UPDATE {quotes_blocks} SET vid = %d, cron_last = %d WHERE bid = %d', $quotes[0], time(), $block['bid']);
}
if ($updated) {
cache_clear_all();
}
}