You are here

function ultimate_cron_cleanup_log in Ultimate Cron 8

Same name and namespace in other branches
  1. 6 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
Implements hook_uninstall().

File

./ultimate_cron.module, line 789
@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 < :start", 0, 1000, array(
      ':start' => time() - variable_get('ultimate_cron_cleanup_log', ULTIMATE_CRON_CLEANUP_LOG),
    ));
    $lids = array();
    while ($row = $result
      ->fetchObject()) {
      $lids[] = $row->lid;
    }
    if (!empty($lids)) {
      db_query("DELETE FROM {ultimate_cron_log} WHERE lid IN (:lids)", array(
        ':lids' => $lids,
      ));
    }
  } while (!empty($lids));
}