You are here

function services_client_error_cron in Services Client 7.2

Implements hook_cron().

File

services_client_error/services_client_error.module, line 109
Services Client error handling, re-try and reporting.

Code

function services_client_error_cron() {
  $timestamp = time() - variable_get('services_client_error_remove_period', 7) * 24 * 60 * 60;
  $eids = db_query_range("SELECT eid FROM {services_client_error} WHERE created < :time", 0, 50, array(
    ':time' => $timestamp,
  ))
    ->fetchCol();
  if (!empty($eids)) {

    // Delete log history
    db_delete('services_client_error_log')
      ->condition('eid', $eids)
      ->execute();

    // Delete error.
    db_delete('services_client_error')
      ->condition('eid', $eids)
      ->execute();
  }
}