isession.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Lukas Reschke <lukas@statuscode.ch>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  8. * @author Thomas Tanghus <thomas@tanghus.net>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. /**
  26. * Public interface of ownCloud for apps to use.
  27. * Session interface
  28. *
  29. */
  30. // use OCP namespace for all classes that are considered public.
  31. // This means that they should be used by apps instead of the internal ownCloud classes
  32. namespace OCP;
  33. /**
  34. * Interface ISession
  35. *
  36. * wrap PHP's internal session handling into the ISession interface
  37. * @since 6.0.0
  38. */
  39. interface ISession {
  40. /**
  41. * Set a value in the session
  42. *
  43. * @param string $key
  44. * @param mixed $value
  45. * @since 6.0.0
  46. */
  47. public function set($key, $value);
  48. /**
  49. * Get a value from the session
  50. *
  51. * @param string $key
  52. * @return mixed should return null if $key does not exist
  53. * @since 6.0.0
  54. */
  55. public function get($key);
  56. /**
  57. * Check if a named key exists in the session
  58. *
  59. * @param string $key
  60. * @return bool
  61. * @since 6.0.0
  62. */
  63. public function exists($key);
  64. /**
  65. * Remove a $key/$value pair from the session
  66. *
  67. * @param string $key
  68. * @since 6.0.0
  69. */
  70. public function remove($key);
  71. /**
  72. * Reset and recreate the session
  73. * @since 6.0.0
  74. */
  75. public function clear();
  76. /**
  77. * Close the session and release the lock
  78. * @since 7.0.0
  79. */
  80. public function close();
  81. /**
  82. * Wrapper around session_regenerate_id
  83. *
  84. * @param bool $deleteOldSession Whether to delete the old associated session file or not.
  85. * @return void
  86. * @since 9.0.0
  87. */
  88. public function regenerateId($deleteOldSession = true);
  89. }