You are here

function uc_cart_cron in Ubercart 5

Same name and namespace in other branches
  1. 8.4 uc_cart/uc_cart.module \uc_cart_cron()
  2. 6.2 uc_cart/uc_cart.module \uc_cart_cron()
  3. 7.3 uc_cart/uc_cart.module \uc_cart_cron()

Implementation of hook_cron().

File

uc_cart/uc_cart.module, line 196

Code

function uc_cart_cron() {

  // Empty anonymous carts.
  $time = strtotime(variable_get('uc_cart_anon_duration', '4') . ' ' . variable_get('uc_cart_anon_unit', 'hours') . ' ago');
  db_query("DELETE FROM {uc_cart_products} WHERE changed <= %d AND " . "CHAR_LENGTH(cart_id) > 8", $time);

  // Empty authenticated carts.
  $time = strtotime(variable_get('uc_cart_auth_duration', '1') . ' ' . variable_get('uc_cart_auth_unit', 'years') . ' ago');
  db_query("DELETE FROM {uc_cart_products} WHERE changed <= %d AND " . "CHAR_LENGTH(cart_id) <= 8", $time);
}