Index: browscap.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/browscap/Attic/browscap.install,v
retrieving revision 1.1.2.1.2.1
diff -u -p -r1.1.2.1.2.1 browscap.install
--- browscap.install	29 May 2008 20:00:43 -0000	1.1.2.1.2.1
+++ browscap.install	10 Aug 2009 21:04:02 -0000
@@ -51,6 +51,7 @@ function browscap_uninstall() {
   variable_del('browscap_monitor');
   variable_del('browscap_imported');
   variable_del('browscap_version');
+  variable_del('browscap_interval');
 } // browscap_uninstall
 
 /**
Index: browscap.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/browscap/browscap.module,v
retrieving revision 1.6.2.3.2.4
diff -u -p -r1.6.2.3.2.4 browscap.module
--- browscap.module	13 Aug 2008 02:49:43 -0000	1.6.2.3.2.4
+++ browscap.module	10 Aug 2009 21:04:03 -0000
@@ -106,9 +106,14 @@ function browscap_exit() {
  * Implementation of hook_cron().
  */
 function browscap_cron() {
-  // Has it been a week since the last (attempt to) import?
+  // How often should module import (in days)?
+  $import_interval = variable_get('browscap_interval', 7);
+  if (!$import_interval) {
+    return;
+  }
+  // Has it been long enough since the last (attempt to) import?
   $last_imported = variable_get('browscap_imported', 0);
-  if (($last_imported + 60*60*24*7) < time()) {
+  if (($last_imported + 60*60*24*$import_interval) < time()) {
     _browscap_import();
     variable_set('browscap_imported', time());
   }
@@ -121,6 +126,7 @@ function browscap_cron() {
 /**
  * Callback for settings form
  * Turn monitoring on or off
+ * Set update interval
  *
  * @return array
  */
@@ -136,9 +142,29 @@ function browscap_settings() {
     '#default_value' => variable_get('browscap_monitor', FALSE),
     '#description' => t('Monitor all user agents visiting the site.')
   );
+  $form['browscap_interval'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Import interval'),
+    '#default_value' => variable_get('browscap_interval', 7),
+    '#description' => t('Update the browscap data this often. Enter 0 to disable updating.'),
+    '#field_suffix' => t('days'),
+    '#size' => 4,
+  );
   return system_settings_form($form);
 }
 
+/**
+ * Validate settings form
+ * Ensure browscap_interval is a non-negatove number
+ */
+function browscap_settings_validate($form, $form_state) {
+  $interval = $form_state['values']['browscap_interval'];
+  if (!is_numeric($interval) || $interval < 0) {
+    form_set_error('browscap_interval',
+                   t('Please enter a non-negative number.'));
+  }
+}
+
 function browscap_refresh() {
   _browscap_import(FALSE);
   drupal_goto('admin/settings/browscap');
