browscap.install 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the Browscap module.
  5. */
  6. /**
  7. * Implements hook_schema().
  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. }
  46. /**
  47. * Drop the unused Browscap 1.x statistics table.
  48. */
  49. function browscap_update_7200() {
  50. db_drop_table('browscap_statistics');
  51. }