Overview

Packages

  • SessionHandler

Classes

  • Horde_SessionHandler
  • Horde_SessionHandler_Exception
  • Horde_SessionHandler_Storage
  • Horde_SessionHandler_Storage_Builtin
  • Horde_SessionHandler_Storage_External
  • Horde_SessionHandler_Storage_File
  • Horde_SessionHandler_Storage_Memcache
  • Horde_SessionHandler_Storage_Sql
  • Horde_SessionHandler_Storage_Stack
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * SessionHandler storage implementation for an external save handler defined
 4:  * via configuration parameters.
 5:  *
 6:  * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
 7:  *
 8:  * See the enclosed file COPYING for license information (LGPL). If you
 9:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
10:  *
11:  * @author   Michael Slusarz <slusarz@horde.org>
12:  * @category Horde
13:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
14:  * @package  SessionHandler
15:  */
16: class Horde_SessionHandler_Storage_External extends Horde_SessionHandler_Storage
17: {
18:     /**
19:      * Constructor.
20:      *
21:      * @param array $params  Required parameters:
22:      * <pre>
23:      * close - (callback) See session_set_save_handler().
24:      * destroy - (callback) See session_set_save_handler().
25:      * gc - (callback) See session_set_save_handler().
26:      * open - (callback) See session_set_save_handler().
27:      * read - (callback) See session_set_save_handler().
28:      * write - (callback) See session_set_save_handler().
29:      * </pre>
30:      *
31:      * @throws InvalidArgumentException
32:      */
33:     public function __construct(array $params = array())
34:     {
35:         foreach (array('open', 'close', 'read', 'write', 'destroy', 'gc') as $val) {
36:             if (!isset($params[$val])) {
37:                 throw new InvalidArgumentException('Missing parameter: ' . $val);
38:             }
39:         }
40: 
41:         parent::__construct($params);
42:     }
43: 
44:     /**
45:      */
46:     public function open($save_path = null, $session_name = null)
47:     {
48:         call_user_func($this->_params['open'], $save_path, $session_name);
49:     }
50: 
51:     /**
52:      */
53:     public function close()
54:     {
55:         call_user_func($this->_params['close']);
56:     }
57: 
58:     /**
59:      */
60:     public function read($id)
61:     {
62:         return call_user_func($this->_params['read'], $id);
63:     }
64: 
65:     /**
66:      */
67:     public function write($id, $session_data)
68:     {
69:         return call_user_func($this->_params['write'], $id, $session_data);
70:     }
71: 
72:     /**
73:      */
74:     public function destroy($id)
75:     {
76:         return call_user_func($this->_params['destroy'], $id);
77:     }
78: 
79:     /**
80:      */
81:     public function gc($maxlifetime = 300)
82:     {
83:         return call_user_func($this->_params['gc'], $maxlifetime);
84:     }
85: 
86:     /**
87:      * Get a list of the valid session identifiers.
88:      *
89:      * @throws Horde_SessionHandler_Exception
90:      */
91:     public function getSessionIDs()
92:     {
93:         throw new Horde_SessionHandler_Exception('Driver does not support listing session IDs.');
94:     }
95: 
96: }
97: 
API documentation generated by ApiGen