You are here

function ultimate_cron_cleanup_log in Ultimate Cron 6

Same name and namespace in other branches
  1. 8 ultimate_cron.module \ultimate_cron_cleanup_log()
  2. 7 ultimate_cron.module \ultimate_cron_cleanup_log()

Clean up log entries.

2 string references to 'ultimate_cron_cleanup_log'
ultimate_cron_settings_form in ./ultimate_cron.admin.inc
Settings form.
ultimate_cron_uninstall in ./ultimate_cron.install
Implementation of hook_uninstall().

File

./ultimate_cron.module, line 754
@todo Add filter on overview page. @todo Add log view (with graph). @todo Make proper markup for overview page. @todo Refactor drush stuff, too many intimate relations with Background Process @todo Refactor Cron % offset stuff. Too mixed up and…

Code

function ultimate_cron_cleanup_log() {
  do {
    $result = db_query_range("SELECT lid FROM {ultimate_cron_log} WHERE start_stamp < %d", time() - variable_get('ultimate_cron_cleanup_log', ULTIMATE_CRON_CLEANUP_LOG), 0, 1000);
    $lids = array();
    while ($row = db_fetch_object($result)) {
      $lids[] = $row->lid;
    }
    if (!empty($lids)) {
      db_query("DELETE FROM {ultimate_cron_log} WHERE lid IN (" . db_placeholders($lids) . ")", $lids);
    }
  } while (!empty($lids));
}