You are here

function webform_clear_cron in Webform Clear 7.2

Implements hook_cron().

1 call to webform_clear_cron()
WebformClearSubmissionTestCase::webformSubmissionExecute in ./webform_clear.test
Execute the submission test.

File

./webform_clear.module, line 154
Removes Webform submissions from the database after they have been emailed.

Code

function webform_clear_cron() {
  $submissions = db_query("SELECT w.submitted, w.sid, w.nid, wc.clear_time FROM {webform_submissions} w INNER JOIN {webform_clear} wc ON wc.nid = w.nid");
  foreach ($submissions as $submission) {
    if ($submission->clear_time == WEBFORM_CLEAR_DO_NOT_DELETE) {
      continue;
    }
    $delete_on = $submission->submitted + $submission->clear_time;
    $time = _webform_clear_current_time();
    if ($time > $delete_on) {
      _webform_clear_delete($submission->nid, $submission->sid);
    }
  }
}