function poll_cron in Drupal 6
Same name and namespace in other branches
- 4 modules/poll.module \poll_cron()
- 5 modules/poll/poll.module \poll_cron()
- 7 modules/poll/poll.module \poll_cron()
Implementation of hook_cron().
Closes polls that have exceeded their allowed runtime.
File
- modules/
poll/ poll.module, line 156 - Enables your site to capture votes on different topics in the form of multiple choice questions.
Code
function poll_cron() {
$result = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < ' . time() . ' AND p.active = 1 AND p.runtime != 0');
while ($poll = db_fetch_object($result)) {
db_query("UPDATE {poll} SET active = 0 WHERE nid = %d", $poll->nid);
}
}