Drupal investigation

SessionHandlerInterface.php 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * SessionHandlerInterface for PHP < 5.4.
  12. *
  13. * The order in which these methods are invoked by PHP are:
  14. * 1. open [session_start]
  15. * 2. read
  16. * 3. gc [optional depending on probability settings: gc_probability / gc_divisor]
  17. * 4. destroy [optional when session_regenerate_id(true) is used]
  18. * 5. write [session_write_close] or destroy [session_destroy]
  19. * 6. close
  20. *
  21. * Extensive documentation can be found at php.net, see links:
  22. *
  23. * @see http://php.net/sessionhandlerinterface
  24. * @see http://php.net/session.customhandler
  25. * @see http://php.net/session-set-save-handler
  26. *
  27. * @author Drak <drak@zikula.org>
  28. * @author Tobias Schultze <http://tobion.de>
  29. */
  30. interface SessionHandlerInterface
  31. {
  32. /**
  33. * Re-initializes existing session, or creates a new one.
  34. *
  35. * @see http://php.net/sessionhandlerinterface.open
  36. *
  37. * @param string $savePath Save path
  38. * @param string $sessionName Session name, see http://php.net/function.session-name.php
  39. *
  40. * @return bool true on success, false on failure
  41. */
  42. public function open($savePath, $sessionName);
  43. /**
  44. * Closes the current session.
  45. *
  46. * @see http://php.net/sessionhandlerinterface.close
  47. *
  48. * @return bool true on success, false on failure
  49. */
  50. public function close();
  51. /**
  52. * Reads the session data.
  53. *
  54. * @see http://php.net/sessionhandlerinterface.read
  55. *
  56. * @param string $sessionId Session ID, see http://php.net/function.session-id
  57. *
  58. * @return string Same session data as passed in write() or empty string when non-existent or on failure
  59. */
  60. public function read($sessionId);
  61. /**
  62. * Writes the session data to the storage.
  63. *
  64. * Care, the session ID passed to write() can be different from the one previously
  65. * received in read() when the session ID changed due to session_regenerate_id().
  66. *
  67. * @see http://php.net/sessionhandlerinterface.write
  68. *
  69. * @param string $sessionId Session ID , see http://php.net/function.session-id
  70. * @param string $data Serialized session data to save
  71. *
  72. * @return bool true on success, false on failure
  73. */
  74. public function write($sessionId, $data);
  75. /**
  76. * Destroys a session.
  77. *
  78. * @see http://php.net/sessionhandlerinterface.destroy
  79. *
  80. * @param string $sessionId Session ID, see http://php.net/function.session-id
  81. *
  82. * @return bool true on success, false on failure
  83. */
  84. public function destroy($sessionId);
  85. /**
  86. * Cleans up expired sessions (garbage collection).
  87. *
  88. * @see http://php.net/sessionhandlerinterface.gc
  89. *
  90. * @param string|int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed
  91. *
  92. * @return bool true on success, false on failure
  93. */
  94. public function gc($maxlifetime);
  95. }