You are here

function browscap_cron in Browscap 6

Same name and namespace in other branches
  1. 8.3 browscap.module \browscap_cron()
  2. 8 browscap.module \browscap_cron()
  3. 5 browscap.module \browscap_cron()
  4. 6.2 browscap.module \browscap_cron()
  5. 7.2 browscap.module \browscap_cron()
  6. 7 browscap.module \browscap_cron()

Implementation of hook_cron().

File

./browscap.module, line 114
Replacement for PHP's get_browser() function.

Code

function browscap_cron() {
  if (variable_get('browscap_enable_automatic_updates', TRUE) == TRUE) {

    // Check the current update timer
    $automatic_update_timer = variable_get('browscap_automatic_updates_timer', 604800);

    // Check when the last update occurred
    $last_imported = variable_get('browscap_imported', time());

    // Update the browscap data if the amount of time specified by the update
    // timer has passed
    if ($last_imported + $automatic_update_timer < time()) {

      // Update the browscap information
      _browscap_import();

      // Record when the browscap information was updated
      variable_set('browscap_imported', time());
    }
  }
}