session_api.install

Install file for Session API.

Functions

Namesort descending Description
session_api_schema Implements hook_schema().
session_api_update_6100 Remove cleanup variables.
session_api_update_7101 Implements hook_update_N().
session_api_update_7102 Implements hook_update_N().

File

session_api.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * Install file for Session API.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function session_api_schema() {
  10. $schema['session_api'] = array(
  11. 'description' => 'Map Session API IDs to the {sessions} sid field.',
  12. 'fields' => array(
  13. 'sid' => array(
  14. 'type' => 'serial',
  15. 'not null' => TRUE,
  16. ),
  17. 'session_id' => array(
  18. 'type' => 'varchar',
  19. 'length' => 128,
  20. 'not null' => TRUE,
  21. ),
  22. 'timestamp' => array(
  23. 'type' => 'int',
  24. 'not null' => TRUE,
  25. 'default' => 0,
  26. ),
  27. ),
  28. 'primary key' => array('sid'),
  29. 'unique keys' => array(
  30. 'session_id' => array('session_id'),
  31. ),
  32. 'indexes' => array(
  33. 'timestamp' => array('timestamp'),
  34. ),
  35. );
  36. return $schema;
  37. }
  38. /**
  39. * Remove cleanup variables.
  40. */
  41. function session_api_update_6100() {
  42. $ret = array();
  43. $ret[] = update_sql("DELETE FROM {variable} WHERE name LIKE 'session_api_run_cron_%'");
  44. return $ret;
  45. }
  46. /**
  47. * Implements hook_update_N().
  48. *
  49. * Adds timestamp field.
  50. */
  51. function session_api_update_7101() {
  52. db_add_field('session_api', 'timestamp', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
  53. db_add_index('session_api', 'timestamp', array('timestamp'));
  54. return t('Added a timestamp field and index to the session_api table.');
  55. }
  56. /**
  57. * Implements hook_update_N().
  58. *
  59. * Lengthens the session_id field to match core {sessions}.sid field.
  60. */
  61. function session_api_update_7102() {
  62. db_change_field('session_api', 'session_id', 'session_id', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE));
  63. }