From 399c293b776e8c6299cadcdf91eeebf343acb57d Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Sat, 7 Jan 2012 18:20:16 -0430 Subject: [PATCH] Extracting the CakeSessionHandlerInterface into its own file --- lib/Cake/Model/Datasource/CakeSession.php | 60 +--------------- .../Model/Datasource/Session/CacheSession.php | 1 + .../Session/CakeSessionHandlerInterface.php | 70 +++++++++++++++++++ .../Datasource/Session/DatabaseSession.php | 3 + 4 files changed, 75 insertions(+), 59 deletions(-) create mode 100644 lib/Cake/Model/Datasource/Session/CakeSessionHandlerInterface.php diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index b6ef75f70..34b5fc5bf 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -682,63 +682,5 @@ class CakeSession { } } - -/** - * Interface for Session handlers. Custom session handler classes should implement - * this interface as it allows CakeSession know how to map methods to session_set_save_handler() - * - * @package Cake.Model.Datasource - */ -interface CakeSessionHandlerInterface { -/** - * Method called on open of a session. - * - * @return boolean Success - */ - public function open(); - -/** - * Method called on close of a session. - * - * @return boolean Success - */ - public function close(); - -/** - * Method used to read from a session. - * - * @param mixed $id The key of the value to read - * @return mixed The value of the key or false if it does not exist - */ - public function read($id); - -/** - * Helper function called on write for sessions. - * - * @param integer $id ID that uniquely identifies session in database - * @param mixed $data The value of the data to be saved. - * @return boolean True for successful write, false otherwise. - */ - public function write($id, $data); - -/** - * Method called on the destruction of a session. - * - * @param integer $id ID that uniquely identifies session in database - * @return boolean True for successful delete, false otherwise. - */ - public function destroy($id); - -/** - * Run the Garbage collection on the session storage. This method should vacuum all - * expired or dead sessions. - * - * @param integer $expires Timestamp (defaults to current time) - * @return boolean Success - */ - public function gc($expires = null); -} - - // Initialize the session -CakeSession::init(); +CakeSession::init(); \ No newline at end of file diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index 665f4e30c..fc758d838 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -18,6 +18,7 @@ */ App::uses('Cache', 'Cache'); +App::uses('CakeSessionHandlerInterface', 'Model/Datasource/Session'); /** * CacheSession provides method for saving sessions into a Cache engine. Used with CakeSession diff --git a/lib/Cake/Model/Datasource/Session/CakeSessionHandlerInterface.php b/lib/Cake/Model/Datasource/Session/CakeSessionHandlerInterface.php new file mode 100644 index 000000000..5e62e1053 --- /dev/null +++ b/lib/Cake/Model/Datasource/Session/CakeSessionHandlerInterface.php @@ -0,0 +1,70 @@ +