browscap.install 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the Browscap module.
  5. */
  6. /**
  7. * Implements hook_install().
  8. */
  9. function browscap_schema() {
  10. $schema['browscap'] = array(
  11. 'fields' => array(
  12. 'useragent' => array(
  13. 'type' => 'varchar',
  14. 'length' => 255,
  15. 'not null' => TRUE,
  16. 'default' => '',
  17. ),
  18. 'data' => array(
  19. 'type' => 'blob',
  20. 'size' => 'big',
  21. ),
  22. ),
  23. 'primary key' => array('useragent'),
  24. );
  25. $schema['cache_browscap'] = drupal_get_schema_unprocessed('system', 'cache');
  26. return $schema;
  27. }
  28. /**
  29. * Implements hook_install().
  30. */
  31. function browscap_install() {
  32. // Update the browscap information
  33. _browscap_import();
  34. // Record when the browscap information was updated
  35. variable_set('browscap_imported', REQUEST_TIME);
  36. }
  37. /**
  38. * Implements hook_uninstall().
  39. */
  40. function browscap_uninstall() {
  41. variable_del('browscap_imported');
  42. variable_del('browscap_version');
  43. variable_del('browscap_enable_automatic_updates');
  44. variable_del('browscap_automatic_updates_timer');
  45. }