You are here

function browscap_cron in Browscap 7.2

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. 6 browscap.module \browscap_cron()
  6. 7 browscap.module \browscap_cron()

Implements hook_cron().

File

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

Code

function browscap_cron() {
  if (variable_get('browscap_enable_automatic_updates', FALSE)) {

    // 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', 0);

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

      // Update the browscap information.
      _browscap_import();
    }
  }
}