You are here

function webform_protected_downloads_cron in Webform Protected Downloads 7

Same name and namespace in other branches
  1. 6 webform_protected_downloads.module \webform_protected_downloads_cron()

Implementation of hook_cron().

File

./webform_protected_downloads.module, line 310
This file contains hook declarations and functions for the Webform Protected Downloads module.

Code

function webform_protected_downloads_cron() {

  // delete expired hash codes, note the missing alias for the first table,
  // this is necessary to support sqlite
  db_query("DELETE\n            FROM      {wpd_access_hashes}\n            WHERE     (expires < :expires AND expires != 0)\n            OR        EXISTS (SELECT 1 FROM {webform_submissions} s\n                                       LEFT JOIN {wpd_node_configuration} n USING (nid)\n                                       WHERE (s.sid = {wpd_access_hashes}.sid AND n.access_type = :access_type AND {wpd_access_hashes}.used != 0))", array(
    ':expires' => time(),
    ':access_type' => WEBFORM_PROTECTED_DOWNLOADS_ACCESS_TYPE_SINGLE,
  ));
}