Session.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * Table Definition for session
  18. *
  19. * @package GNUsocial
  20. * @author Evan Prodromou
  21. * @author Brion Vibber
  22. * @author Mikael Nordfeldth
  23. * @author Sorokin Alexei
  24. * @author Diogo Cordeiro <diogo@fc.up.pt>
  25. * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
  26. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  27. */
  28. defined('GNUSOCIAL') || die();
  29. /**
  30. * Superclass representing a saved session as it exists in the database.
  31. *
  32. * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
  33. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  34. */
  35. class Session extends Managed_DataObject
  36. {
  37. ###START_AUTOCODE
  38. /* the code below is auto generated do not remove the above tag */
  39. public $__table = 'session'; // table name
  40. public $id; // varchar(32) primary_key not_null
  41. public $session_data; // text()
  42. public $created; // datetime()
  43. public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
  44. /* the code above is auto generated do not remove the tag below */
  45. ###END_AUTOCODE
  46. /**
  47. * Returns an array describing how the session is stored in the database.
  48. *
  49. * @return array
  50. */
  51. public static function schemaDef()
  52. {
  53. return [
  54. 'fields' => [
  55. 'id' => ['type' => 'varchar', 'length' => 128, 'not null' => true, 'description' => 'session ID'],
  56. 'session_data' => ['type' => 'text', 'description' => 'session data'],
  57. 'created' => ['type' => 'datetime', 'description' => 'date this record was created'],
  58. 'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
  59. ],
  60. 'primary key' => ['id'],
  61. 'indexes' => [
  62. 'session_modified_idx' => ['modified'],
  63. ],
  64. ];
  65. }
  66. /**
  67. * New code should NOT call this function.
  68. * Dummy function for backwards compatibility with older plugins like Qvitter.
  69. * Stuff to do before the request teardown.
  70. *
  71. * @return void
  72. */
  73. public static function cleanup()
  74. {
  75. session_write_close();
  76. }
  77. }