package.xml 0000664 0001750 0001750 00000053612 12654071112 011305 0 ustar jan jan
* close - (callback) See session_set_save_handler(). * destroy - (callback) See session_set_save_handler(). * gc - (callback) See session_set_save_handler(). * open - (callback) See session_set_save_handler(). * read - (callback) See session_set_save_handler(). * write - (callback) See session_set_save_handler(). ** * @throws InvalidArgumentException */ public function __construct(array $params = array()) { foreach (array('open', 'close', 'read', 'write', 'destroy', 'gc') as $val) { if (!isset($params[$val])) { throw new InvalidArgumentException('Missing parameter: ' . $val); } } parent::__construct($params); } /** */ public function open($save_path = null, $session_name = null) { return call_user_func($this->_params['open'], $save_path, $session_name); } /** */ public function close() { return call_user_func($this->_params['close']); } /** */ public function read($id) { return call_user_func($this->_params['read'], $id); } /** */ public function write($id, $session_data) { return call_user_func($this->_params['write'], $id, $session_data); } /** */ public function destroy($id) { return call_user_func($this->_params['destroy'], $id); } /** */ public function gc($maxlifetime = 300) { return call_user_func($this->_params['gc'], $maxlifetime); } /** * Get a list of the valid session identifiers. * * @throws Horde_SessionHandler_Exception */ public function getSessionIDs() { throw new Horde_SessionHandler_Exception('Driver does not support listing session IDs.'); } } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler/Storage/File.php 0000664 0001750 0001750 00000007613 12654071111 023421 0 ustar jan jan * @category Horde * @copyright 2010-2016 Horde LLC * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package SessionHandler */ class Horde_SessionHandler_Storage_File extends Horde_SessionHandler_Storage { /* File prefix. */ const PREFIX = 'horde_sh_'; /** * File stream. * * @var resource */ protected $_fp; /** * Constructor. * * @param array $params Parameters: *
* path - (string) [REQUIRED] The path to save the files. ** * @throws InvalidArgumentException */ public function __construct(array $params = array()) { if (!isset($params['path'])) { throw new InvalidArgumentException('Missing path parameter.'); } $params['path'] = rtrim($params['path'], '/'); parent::__construct($params); } /** */ public function open($save_path = null, $session_name = null) { return true; } /** * Open the file stream connection. * * @param string $id The session ID. */ protected function _open($id) { if (!empty($this->_fp)) { return; } $filename = $this->_params['path'] . '/' . self::PREFIX . $id; $this->_fp = fopen($filename, 'c+'); if ($this->_fp) { flock($this->_fp, LOCK_EX); } } /** */ public function close() { if (!empty($this->_fp)) { flock($this->_fp, LOCK_UN); fclose($this->_fp); unset($this->_fp); } return true; } /** */ public function read($id) { $this->_open($id); if (!$this->_fp) { return false; } $data = ''; rewind($this->_fp); while (!feof($this->_fp)) { $data .= fread($this->_fp, 16384); } return $data; } /** */ public function write($id, $session_data) { $this->_open($id); if (!$this->_fp) { return false; } fseek($this->_fp, 0); ftruncate($this->_fp, 0); fwrite($this->_fp, $session_data); return true; } /** */ public function destroy($id) { $this->close(); $filename = $this->_params['path'] . '/' . self::PREFIX . $id; return @unlink($filename); } /** */ public function gc($maxlifetime = 300) { try { $di = new DirectoryIterator($this->_params['path']); } catch (UnexpectedValueException $e) { return false; } $expire_time = time() - $maxlifetime; foreach ($di as $val) { if ($val->isFile() && (strpos($val->getFilename(), self::PREFIX) === 0) && ($val->getMTime() < $expire_time)) { @unlink($val->getPathname()); } } return true; } /** */ public function getSessionIDs() { $ids = array(); try { $di = new DirectoryIterator($this->_params['path']); foreach ($di as $val) { if ($val->isFile() && (strpos($val->getFilename(), self::PREFIX) === 0)) { $ids[] = substr($val->getFilename(), strlen(self::PREFIX)); } } } catch (UnexpectedValueException $e) {} return $ids; } } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler/Storage/Hashtable.php 0000664 0001750 0001750 00000012750 12654071111 024433 0 ustar jan jan * @category Horde * @copyright 2013-2016 Horde LLC * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package SessionHandler * @since 2.2.0 */ class Horde_SessionHandler_Storage_Hashtable extends Horde_SessionHandler_Storage { /** * HashTable object. * * @var Horde_HashTable */ protected $_hash; /** * Current session ID. * * @var string */ protected $_id; /** * The ID used for session tracking. * * @var string */ protected $_trackID = 'horde_sessions_track_ht'; /** * Constructor. * * @param array $params Parameters: *
* - hashtable: (Horde_HashTable) [REQUIRED] A Horde_HashTable object. * - track: (boolean) Track active sessions? **/ public function __construct(array $params = array()) { if (empty($params['hashtable'])) { throw new InvalidArgumentException('Missing hashtable parameter.'); } if (!$params['hashtable']->locking) { throw new InvalidArgumentException('HashTable object must support locking.'); } $this->_hash = $params['hashtable']; unset($params['hashtable']); parent::__construct($params); if (!empty($this->_params['track']) && (!rand(0, 999))) { register_shutdown_function(array($this, 'trackGC')); } } /** */ public function open($save_path = null, $session_name = null) { } /** */ public function close() { if (isset($this->_id)) { $this->_hash->unlock($this->_id); } } /** */ public function read($id) { if (!$this->readonly) { $this->_hash->lock($id); } if (($result = $this->_hash->get($id)) === false) { if (!$this->readonly) { $this->_hash->unlock($id); } $result = ''; } elseif (!$this->readonly) { $this->_id = $id; } return $result; } /** */ public function write($id, $session_data) { $base = array_filter(array( 'timeout' => ini_get('session.gc_maxlifetime') )); if (!empty($this->_params['track'])) { // Do a replace - the only time it should fail is if we are // writing a session for the first time. If that is the case, // update the session tracker. $res = $this->_hash->set($id, $session_data, array_merge($base, array( 'replace' => true, ))); $track = !$res; } else { $res = $track = false; } if (!$res && !$this->_hash->set($id, $session_data, $base)) { return false; } if ($track) { $this->_hash->lock($this->_trackID); $ids = $this->_getTrackIds(); $ids[$id] = 1; $this->_hash->set($this->_trackID, json_encode($ids)); $this->_hash->unlock($this->_trackID); } return true; } /** */ public function destroy($id) { $res = $this->_hash->delete($id); $this->_hash->unlock($id); if ($res === false) { return false; } if (!empty($this->_params['track'])) { $this->_hash->lock($this->_trackID); if ($ids = $this->_getTrackIds()) { unset($ids[$id]); $this->_hash->set($this->_trackID, json_encode($ids)); } $this->_hash->unlock($this->_trackID); } return true; } /** */ public function gc($maxlifetime = 300) { return true; } /** */ public function getSessionIDs() { if (empty($this->_params['track'])) { throw new Horde_SessionHandler_Exception('Memcache session tracking not enabled.'); } $this->trackGC(); return array_keys($this->_getTrackIds()); } /** * Do garbage collection for session tracking information. */ public function trackGC() { try { $this->_hash->lock($this->_trackID); if ($ids = $this->_getTrackIds()) { $alter = false; foreach (array_keys($ids) as $key) { if (!$this->_hash->exists($key)) { unset($ids[$key]); $alter = true; } } if ($alter) { $this->_hash->set($this->_trackID, json_encode($ids)); } } $this->_hash->unlock($this->_trackID); } catch (Horde_HashTable_Exception $e) { } } /** * Get the tracking IDs. * * @return array Tracking IDs. */ protected function _getTrackIds() { if ((($ids = $this->_hash->get($this->_trackID)) === false) || !($ids = json_decode($ids, true))) { $ids = array(); } return $ids; } } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler/Storage/Memcache.php 0000664 0001750 0001750 00000013204 12654071111 024235 0 ustar jan jan * @author Michael Slusarz
* 'memcache' - (Horde_Memcache) [REQUIRED] A memcache object. * 'track' - (boolean) Track active sessions? * 'track_lifetime' - (integer) The number of seconds after which tracked * sessions will be treated as expired. ** * @throws InvalidArgumentException */ public function __construct(array $params = array()) { if (empty($params['memcache'])) { throw new InvalidArgumentException('Missing memcache argument.'); } $this->_memcache = $params['memcache']; unset($params['memcache']); parent::__construct($params); if (empty($this->_params['track_lifetime'])) { $this->_params['track_lifetime'] = ini_get('session.gc_maxlifetime'); } if (!empty($this->_params['track']) && (substr(time(), -3) === '000')) { register_shutdown_function(array($this, 'trackGC')); } } /** */ public function open($save_path = null, $session_name = null) { return true; } /** */ public function close() { if (isset($this->_id)) { $this->_memcache->unlock($this->_id); } return true; } /** */ public function read($id) { if (!$this->readonly) { $this->_memcache->lock($id); } $result = $this->_memcache->get($id); if ($result === false) { if (!$this->readonly) { $this->_memcache->unlock($id); } $result = ''; } elseif (!$this->readonly) { $this->_id = $id; } return $result; } /** */ public function write($id, $session_data) { if (!empty($this->_params['track'])) { // Do a replace - the only time it should fail is if we are // writing a session for the first time. If that is the case, // update the session tracker. $res = $this->_memcache->replace($id, $session_data); $track = !$res; } else { $res = $track = false; } if (!$res && !$this->_memcache->set($id, $session_data)) { return false; } if ($track) { $this->_memcache->lock($this->_trackID); $ids = $this->_memcache->get($this->_trackID); if ($ids === false) { $ids = array(); } $ids[$id] = time(); $this->_memcache->set($this->_trackID, $ids); $this->_memcache->unlock($this->_trackID); } return true; } /** */ public function destroy($id) { $result = $this->_memcache->delete($id); $this->_memcache->unlock($id); if ($result === false) { return false; } if (!empty($this->_params['track'])) { $this->_memcache->lock($this->_trackID); $ids = $this->_memcache->get($this->_trackID); if ($ids !== false) { unset($ids[$id]); $this->_memcache->set($this->_trackID, $ids); } $this->_memcache->unlock($this->_trackID); } return true; } /** */ public function gc($maxlifetime = 300) { // Memcache does its own garbage collection. return true; } /** */ public function getSessionIDs() { if (empty($this->_params['track'])) { throw new Horde_SessionHandler_Exception('Memcache session tracking not enabled.'); } $this->trackGC(); $ids = $this->_memcache->get($this->_trackID); return ($ids === false) ? array() : array_keys($ids); } /** * Do garbage collection for session tracking information. */ public function trackGC() { $this->_memcache->lock($this->_trackID); $ids = $this->_memcache->get($this->_trackID); if (empty($ids)) { $this->_memcache->unlock($this->_trackID); return; } $tstamp = time() - $this->_params['track_lifetime']; $alter = false; foreach ($ids as $key => $val) { if ($tstamp > $val) { unset($ids[$key]); $alter = true; } } if ($alter) { $this->_memcache->set($this->_trackID, $ids); } $this->_memcache->unlock($this->_trackID); } } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler/Storage/Mongo.php 0000664 0001750 0001750 00000015347 12654071111 023624 0 ustar jan jan * @category Horde * @copyright 2013-2016 Horde LLC * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package SessionHandler */ class Horde_SessionHandler_Storage_Mongo extends Horde_SessionHandler_Storage implements Horde_Mongo_Collection_Index { /* Field names. */ const DATA = 'data'; const LOCK = 'lock'; const MODIFIED = 'ts'; const SID = 'sid'; /** * MongoCollection object for the storage table. * * @var MongoCollection */ protected $_db; /** * Is the session locked. * * @var boolean */ protected $_locked = false; /** * Indices list. * * @var array */ protected $_indices = array( 'index_ts' => array( self::MODIFIED => 1 ) ); /** * Constructor. * * @param array $params Parameters: *
* collection: (string) The collection to store data in. * mongo_db: (Horde_Mongo_Client) [REQUIRED] The Mongo client object. **/ public function __construct(array $params = array()) { if (!isset($params['mongo_db'])) { throw new InvalidArgumentException('Missing mongo_db parameter.'); } parent::__construct(array_merge(array( 'collection' => 'horde_sessionhandler' ), $params)); $this->_db = $this->_params['mongo_db']->selectCollection(null, $this->_params['collection']); } /** */ public function open($save_path = null, $session_name = null) { return true; } /** */ public function close() { if ($this->_locked) { try { $this->_db->update(array( self::SID => $this->_locked ), array( '$unset' => array(self::LOCK => '') )); } catch (MongoException $e) {} $this->_locked = false; } return true; } /** */ public function read($id) { /* Check for session existence. Unfortunately needed because * we need findAndModify() for its atomicity for locking, but this * atomicity means we can't tell the difference between a * non-existent session and a locked session. */ $exists = $this->_db->count(array( self::SID => $id )); $exist_check = false; $i = 0; /* Set a maximum unlocking time, to prevent runaway PHP processes. */ $max = ini_get('max_execution_time') * 10; while (true) { $data = array( self::LOCK => time(), self::SID => $id ); /* This call will either create the session if it doesn't exist, * or will update the current session and lock it if not already * locked. If a session exists, and is locked, $res will contain * an empty set and we need to sleep and wait for lock to be * removed. */ $res = $this->_db->findAndModify(array( self::SID => $id, self::LOCK => array( '$exists' => $exist_check ) ), array($data), array( self::DATA => true ), array( 'update' => array( '$set' => $data ), 'upsert' => !$exists )); if (!$exists || isset($res[self::DATA])) { break; } /* After a second, check the timestamp to determine if this is * a stale session. This can prevent long waits on a busted PHP * process. */ if ($i == 10) { $res = $this->_db->findOne(array( self::SID => $id ), array( self::LOCK => true )); $max = isset($res[self::LOCK]) ? ((time() - $res[self::LOCK]) * 10) : $i; } if (++$i >= $max) { $exist_check = true; } else { /* Sleep for 0.1 second before trying again. */ usleep(100000); } } $this->_locked = $id; return isset($res[self::DATA]) ? $res[self::DATA]->bin : ''; } /** */ public function write($id, $session_data) { /* Update/insert session data. */ try { $this->_db->update(array( self::SID => $id ), array( self::DATA => new MongoBinData($session_data, MongoBinData::BYTE_ARRAY), self::MODIFIED => time(), self::SID => $id ), array( 'upsert' => true )); $this->_locked = false; } catch (MongoException $e) { return false; } return true; } /** */ public function destroy($id) { try { $this->_db->remove(array( self::SID => $id )); return true; } catch (MongoException $e) {} return false; } /** */ public function gc($maxlifetime = 300) { try { $this->_db->remove(array( self::MODIFIED => array( '$lt' => (time() - $maxlifetime) ) )); return true; } catch (MongoException $e) {} return false; } /** */ public function getSessionIDs() { $ids = array(); try { $cursor = $this->_db->find(array( self::MODIFIED => array( '$gte' => (time() - ini_get('session.gc_maxlifetime')) ) ), array(self::SID)); foreach ($cursor as $val) { $ids[] = $val[self::SID]; } } catch (MongoException $e) {} return $ids; } /* Horde_Mongo_Collection_Index methods. */ /** */ public function checkMongoIndices() { return $this->_params['mongo_db']->checkIndices($this->_db, $this->_indices); } /** */ public function createMongoIndices() { $this->_params['mongo_db']->createIndices($this->_db, $this->_indices); } } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler/Storage/Sql.php 0000664 0001750 0001750 00000013434 12654071111 023277 0 ustar jan jan * CREATE TABLE horde_sessionhandler ( * VARCHAR(32) NOT NULL, * session_lastmodified INT NOT NULL, * session_data LONGBLOB, * -- Or, on some DBMS systems: * -- session_data IMAGE, * * PRIMARY KEY (session_id) * ); * * CREATE INDEX session_lastmodified_idx ON horde_sessionhandler (session_lastmodified); * * * Copyright 2002-2016 Horde LLC (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.horde.org/licenses/lgpl21. * * @author Mike Cochrane
* 'db' - (Horde_Db_Adapter) [REQUIRED] The DB instance. * 'table' - (string) The name of the sessions table. * DEFAULT: 'horde_sessionhandler' ** * @throws InvalidArgumentException */ public function __construct(array $params = array()) { if (!isset($params['db'])) { throw new InvalidArgumentException('Missing db parameter.'); } $this->_db = $params['db']; unset($params['db']); parent::__construct(array_merge(array( 'table' => 'horde_sessionhandler' ), $params)); } /** */ public function open($save_path = null, $session_name = null) { return true; } /** */ public function close() { /* Close any open transactions. */ if ($this->_db->transactionStarted()) { try { $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { return false; } } return true; } /** */ public function read($id) { /* Begin a transaction. */ // TODO: Rowlocking in Mysql if (!$this->_db->transactionStarted()) { $this->_db->beginDbTransaction(); } /* Build query. */ $query = sprintf('SELECT session_data FROM %s WHERE session_id = ?', $this->_params['table']); $values = array($id); /* Execute the query. */ try { $columns = $this->_db->columns($this->_params['table']); return $columns['session_data']->binaryToString( $this->_db->selectValue($query, $values)); } catch (Horde_Db_Exception $e) { return ''; } } /** */ public function write($id, $session_data) { if (!$this->_db->isActive()) { $this->_db->reconnect(); $this->_db->beginDbTransaction(); } /* Check if session exists. */ try { $exists = $this->_db->selectValue( sprintf('SELECT 1 FROM %s WHERE session_id = ?', $this->_params['table']), array($id)); } catch (Horde_Db_Exception $e) { return false; } /* Update or insert session data. */ $values = array( 'session_data' => new Horde_Db_Value_Binary($session_data), 'session_lastmodified' => time() ); try { if ($exists) { $this->_db->updateBlob( $this->_params['table'], $values, array('session_id = ?', array($id)) ); } else { $this->_db->insertBlob( $this->_params['table'], array_merge(array('session_id' => $id), $values) ); } $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { try { $this->_db->rollbackDbTransaction(); } catch (Horde_Db_Exception $e) { } return false; } return true; } /** */ public function destroy($id) { /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_id = ?', $this->_params['table']); $values = array($id); /* Execute the query. */ try { $this->_db->delete($query, $values); $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { return false; } return true; } /** */ public function gc($maxlifetime = 300) { /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_lastmodified < ?', $this->_params['table']); $values = array(time() - $maxlifetime); /* Execute the query. */ try { $this->_db->delete($query, $values); } catch (Horde_Db_Exception $e) { return false; } return true; } /** */ public function getSessionIDs() { $this->open(); /* Build the SQL query. */ $query = sprintf('SELECT session_id FROM %s' . ' WHERE session_lastmodified >= ?', $this->_params['table']); $values = array(time() - ini_get('session.gc_maxlifetime')); /* Execute the query. */ try { return $this->_db->selectValues($query, $values); } catch (Horde_Db_Exception $e) { return array(); } } } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler/Storage/Stack.php 0000664 0001750 0001750 00000007064 12654071111 023607 0 ustar jan jan * @category Horde * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package SessionHandler */ class Horde_SessionHandler_Storage_Stack extends Horde_SessionHandler_Storage { /** * Stack of storage objects. * * @var array */ protected $_stack = array(); /** * Constructor. * * @param array $params Parameters: *
* stack - (array) [REQUIRED] A list of storage objects to loop * through, in order of priority. The last entry is considered * the "master" server. ** * @throws InvalidArgumentException */ public function __construct(array $params = array()) { if (!isset($params['stack'])) { throw new InvalidArgumentException('Missing stack parameter.'); } $this->_stack = $params['stack']; unset($params['stack']); parent::__construct($params); } /** */ public function open($save_path = null, $session_name = null) { foreach ($this->_stack as $val) { if (!$val->open($save_path, $session_name)) { return false; } } return true; } /** */ public function close() { foreach ($this->_stack as $val) { if (!$val->close()) { return false; } } return true; } /** */ public function read($id) { foreach ($this->_stack as $val) { $result = $val->read($id); if ($result === false) { break; } } return $result; } /** */ public function write($id, $session_data) { /* Do writes in *reverse* order - it is OK if a write to one of the * non-master backends fails. */ $master = true; foreach (array_reverse($this->_stack) as $val) { $result = $val->write($id, $session_data); if ($result === false) { if ($master) { return false; } /* Attempt to invalidate cache if write failed. */ $val->destroy($id); } $master = false; } return true; } /** */ public function destroy($id) { /* Only report success from master. */ $master = $success = true; foreach (array_reverse($this->_stack) as $val) { $result = $val->destroy($id); if ($master && ($result === false)) { $success = false; } $master = false; } return $success; } /** */ public function gc($maxlifetime = 300) { /* Only report GC results from master. */ foreach ($this->_stack as $val) { $result = $val->gc($maxlifetime); } return $result; } /** */ public function getSessionIDs() { /* Grab session ID list from the master. */ $ob = end($this->_stack); return $ob->getSessionIDs(); } } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler/Exception.php 0000664 0001750 0001750 00000000676 12654071111 023076 0 ustar jan jan * @category Horde * @package SessionHandler */ class Horde_SessionHandler_Exception extends Horde_Exception_Wrapped { } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler/Storage.php 0000664 0001750 0001750 00000006643 12654071111 022544 0 ustar jan jan * @category Horde * @copyright 2002-2016 Horde LLC * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package SessionHandler */ abstract class Horde_SessionHandler_Storage { /** * Access session read-only? * * @var boolean */ public $readonly = false; /** * Hash containing connection parameters. * * @var array */ protected $_params = array(); /** * Constructor. * * @param array $params Configuration parameters. */ public function __construct(array $params = array()) { $this->_params = array_merge($this->_params, $params); } /** * Storage objects do not support serialization. */ public function __sleep() { throw new LogicException('SessionHandler storage objects do not support serialization.'); } /** * Set the logger object. * * @deprecated */ public function setLogger(Horde_Log_Logger $log) { } /** * Open the backend. * * @param string $save_path The path to the session object. * @param string $session_name The name of the session. * * @throws Horde_SessionHandler_Exception */ abstract public function open($save_path = null, $session_name = null); /** * Close the backend. * * @throws Horde_SessionHandler_Exception */ abstract public function close(); /** * Read the data for a particular session identifier from the backend. * * @param string $id The session identifier. * * @return string The session data. */ abstract public function read($id); /** * Write session data to the backend. * * @param string $id The session identifier. * @param string $session_data The session data. * * @return boolean True on success, false otherwise. */ abstract public function write($id, $session_data); /** * Destroy the data for a particular session identifier in the backend. * This method should only be called internally by PHP via * session_set_save_handler(). * * @param string $id The session identifier. * * @return boolean True on success, false otherwise. */ abstract public function destroy($id); /** * Garbage collect stale sessions from the backend. * This method should only be called internally by PHP via * session_set_save_handler(). * * @param integer $maxlifetime The maximum age of a session. * * @return boolean True on success, false otherwise. */ abstract public function gc($maxlifetime = 300); /** * Get a list of the valid session identifiers. * * @return array A list of valid session identifiers. * @throws Horde_SessionHandler_Exception */ abstract public function getSessionIDs(); } Horde_SessionHandler-2.2.7/lib/Horde/SessionHandler.php 0000664 0001750 0001750 00000020432 12654071111 021130 0 ustar jan jan * @category Horde * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package SessionHandler */ class Horde_SessionHandler { /** * If true, indicates the session data has changed. * * @var boolean */ public $changed = false; /** * Has a connection been made to the backend? * * @var boolean */ protected $_connected = false; /** * A logger instance. * * @var Horde_Log_Logger */ protected $_logger; /** * Configuration parameters. * * @var array */ protected $_params = array(); /** * Initial session data signature. * * @var string */ protected $_sig; /** * The storage object. * * @var Horde_SessionHandler_Storage */ protected $_storage; /** * Constructor. * * @param Horde_SessionHandler_Storage $storage The storage object. * @param array $params Configuration parameters: *
* - logger: (Horde_Log_Logger) A logger instance. * DEFAULT: No logging * - no_md5: (boolean) If true, does not do MD5 signatures of the * session to determine if the session has changed (calling * code is responsible for marking $changed as true when the * session data has changed). * DEFAULT: false * - noset: (boolean) If true, don't set the save handler. * DEFAULT: false * - parse: (callback) A callback function that parses session * information into an array. Is passed the raw session data * as the only argument; expects either false or an array of * session data as a return. * DEFAULT: No **/ public function __construct(Horde_SessionHandler_Storage $storage, array $params = array()) { $params = array_merge($this->_params, $params); $this->_logger = isset($params['logger']) ? $params['logger'] : new Horde_Support_Stub(); unset($params['logger']); $this->_params = $params; $this->_storage = $storage; if (empty($this->_params['noset'])) { ini_set('session.save_handler', 'user'); session_set_save_handler( array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc') ); } } /** * Destructor. */ public function __destruct() { /* This is necessary as of PHP 5.0.5 because objects are not available * when the write() handler is called at the end of a session * access. */ session_write_close(); } /** * Open the backend. * * @param string $save_path The path to the session object. * @param string $session_name The name of the session. * * @return boolean True on success, false otherwise. */ public function open($save_path = null, $session_name = null) { if (!$this->_connected) { try { $this->_storage->open($save_path, $session_name); } catch (Horde_SessionHandler_Exception $e) { $this->_logger->log($e, 'ERR'); return false; } $this->_connected = true; } return true; } /** * Close the backend. * * @return boolean True on success, false otherwise. */ public function close() { try { $this->_storage->close(); } catch (Horde_SessionHandler_Exception $e) { $this->_logger->log($e, 'ERR'); } $this->_connected = false; return true; } /** * Read the data for a particular session identifier from the backend. * This method should only be called internally by PHP via * session_set_save_handler(). * * @param string $id The session identifier. * * @return string The session data. */ public function read($id) { if (($result = $this->_storage->read($id)) == '') { $this->_logger->log('Error retrieving session data (' . $id . ')', 'DEBUG'); } else { $this->_logger->log('Read session data (' . $id . ')', 'DEBUG'); } if (empty($this->_params['no_md5'])) { $this->_sig = md5($result); } return $result; } /** * Write session data to the backend. * This method should only be called internally by PHP via * session_set_save_handler(). * * @param string $id The session identifier. * @param string $session_data The session data. * * @return boolean True on success, false otherwise. */ public function write($id, $session_data) { if ($this->changed || (empty($this->_params['no_md5']) && ($this->_sig != md5($session_data)))) { if (!$this->_storage->write($id, $session_data)) { $this->_logger->log('Failed to write session data (' . $id . ')', 'DEBUG'); return false; } $this->_logger->log('Wrote session data (' . $id . ')', 'DEBUG'); } return true; } /** * Destroy the data for a particular session identifier in the backend. * This method should only be called internally by PHP via * session_set_save_handler(). * * @param string $id The session identifier. * * @return boolean True on success, false otherwise. */ public function destroy($id) { if ($this->_storage->destroy($id)) { $this->_logger->log('Session data destroyed (' . $id . ')', 'DEBUG'); return true; } $this->_logger->log('Failed to destroy session data (' . $id . ')', 'DEBUG'); return false; } /** * Garbage collect stale sessions from the backend. * This method should only be called internally by PHP via * session_set_save_handler(). * * @param integer $maxlifetime The maximum age of a session. * * @return boolean True on success, false otherwise. */ public function gc($maxlifetime = 300) { return $this->_storage->gc($maxlifetime); } /** * Get a list of the valid session identifiers. * * @return array A list of valid session identifiers. * @throws Horde_SessionHandler_Exception */ public function getSessionIDs() { return $this->_storage->getSessionIDs(); } /** * Returns a list of authenticated users and data about their session. * * @return array For authenticated users, the sessionid as a key and the * session information as value. If no parsing function * was provided, will always return an empty array. * @throws Horde_SessionHandler_Exception */ public function getSessionsInfo() { $info = array(); if (empty($this->_params['parse']) || !is_callable($this->_params['parse'])) { return $info; } /* Explicitly do garbage collection call here to make sure session * data is correct. */ $this->gc(ini_get('session.gc_maxlifetime')); $sessions = $this->getSessionIDs(); $this->_storage->readonly = true; foreach ($sessions as $id) { try { $data = $this->read($id); $this->close(); } catch (Horde_SessionHandler_Exception $e) { continue; } $data = call_user_func($this->_params['parse'], $data); if ($data !== false) { $info[$id] = $data; } } $this->_storage->readonly = false; return $info; } } Horde_SessionHandler-2.2.7/migration/Horde/SessionHandler/1_horde_sessionhandler_base_tables.php 0000664 0001750 0001750 00000001362 12654071111 031322 0 ustar jan jan tables())) { $t = $this->createTable('horde_sessionhandler', array('autoincrementKey' => false)); $t->column('session_id', 'string', array('limit' => 32, 'null' => false)); $t->column('session_lastmodified', 'integer', array('null' => false)); $t->column('session_data', 'binary'); $t->primaryKey(array('session_id')); $t->end(); $this->addIndex('horde_sessionhandler', array('session_lastmodified')); } } public function down() { $this->dropTable('horde_sessionhandler'); } } ././@LongLink 0 0 0 144 0 003735 L Horde_SessionHandler-2.2.7/migration/Horde/SessionHandler/2_horde_sessionhandler_fix_blob_length.php Horde_SessionHandler-2.2.7/migration/Horde/SessionHandler/2_horde_sessionhandler_fix_blob_length.php0000664 0001750 0001750 00000000355 12654071111 032205 0 ustar jan jan changeColumn('horde_sessionhandler', 'session_data', 'binary'); } public function down() { } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/Sql/Pdo/MysqlTest.php 0000664 0001750 0001750 00000002211 12654071112 026167 0 ustar jan jan * @category Horde * @package SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_Sql_Pdo_MysqlTest extends Horde_SessionHandler_Storage_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('pdo') || !in_array('mysql', PDO::getAvailableDrivers())) { self::$reason = 'No mysql extension or no mysql PDO driver'; return; } $config = self::getConfig('SESSIONHANDLER_SQL_PDO_MYSQL_TEST_CONFIG', dirname(__FILE__) . '/../../..'); if ($config && !empty($config['sessionhandler']['sql']['pdo_mysql'])) { self::$db = new Horde_Db_Adapter_Pdo_Mysql($config['sessionhandler']['sql']['pdo_mysql']); parent::setUpBeforeClass(); } else { self::$reason = 'No pdo_mysql configuration'; } } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/Sql/Pdo/PgsqlTest.php 0000664 0001750 0001750 00000002211 12654071112 026150 0 ustar jan jan * @category Horde * @package SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_Sql_Pdo_PgsqlTest extends Horde_SessionHandler_Storage_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('pdo') || !in_array('pgsql', PDO::getAvailableDrivers())) { self::$reason = 'No pgsql extension or no pgsql PDO driver'; return; } $config = self::getConfig('SESSIONHANDLER_SQL_PDO_PGSQL_TEST_CONFIG', dirname(__FILE__) . '/../../..'); if ($config && !empty($config['sessionhandler']['sql']['pdo_pgsql'])) { self::$db = new Horde_Db_Adapter_Pdo_Pgsql($config['sessionhandler']['sql']['pdo_pgsql']); parent::setUpBeforeClass(); } else { self::$reason = 'No pdo_pgsql configuration'; } } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/Sql/Pdo/SqliteTest.php 0000664 0001750 0001750 00000001371 12654071112 026331 0 ustar jan jan * @category Horde * @package SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_Sql_Pdo_SqliteTest extends Horde_SessionHandler_Storage_Sql_Base { public static function setUpBeforeClass() { $factory_db = new Horde_Test_Factory_Db(); try { self::$db = $factory_db->create(); parent::setUpBeforeClass(); } catch (Horde_Test_Exception $e) { self::$reason = 'Sqlite not available'; } } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/Sql/Base.php 0000664 0001750 0001750 00000004703 12654071112 024362 0 ustar jan jan * @category Horde * @package Horde_SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_Sql_Base extends Horde_SessionHandler_Storage_Base { protected static $db; protected static $migrator; protected static $reason; public function testWrite() { $this->_write(); } /** * @depends testWrite */ public function testRead() { $this->_read(); } /** * @depends testWrite */ public function testReopen() { $this->_reopen(); } /** * @depends testWrite */ public function testList() { $this->_list(); } /** * @depends testList */ public function testDestroy() { $this->_destroy(); } /** * @depends testDestroy */ public function testGc() { $this->_gc(); } public static function setUpBeforeClass() { parent::setUpBeforeClass(); $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli()); //self::$db->setLogger($logger); $dir = dirname(__FILE__) . '/../../../../../migration/Horde/SessionHandler'; if (!is_dir($dir)) { error_reporting(E_ALL & ~E_DEPRECATED); $dir = PEAR_Config::singleton() ->get('data_dir', null, 'pear.horde.org') . '/Horde_SessionHandler/migration'; error_reporting(E_ALL | E_STRICT); } self::$migrator = new Horde_Db_Migration_Migrator( self::$db, null,//$logger, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_sh_schema_info')); self::$migrator->up(); self::$handler = new Horde_SessionHandler_Storage_Sql(array('db' => self::$db)); } public static function tearDownAfterClass() { if (self::$migrator) { self::$migrator->down(); } if (self::$db) { self::$db->disconnect(); } self::$db = self::$migrator = null; parent::tearDownAfterClass(); } public function setUp() { if (!self::$db) { $this->markTestSkipped(self::$reason); } } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/Sql/MysqliTest.php 0000664 0001750 0001750 00000002033 12654071112 025620 0 ustar jan jan * @category Horde * @package SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_Sql_MysqliTest extends Horde_SessionHandler_Storage_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('mysqli')) { self::$reason = 'No mysqli extension'; return; } $config = self::getConfig('SESSIONHANDLER_SQL_MYSQLI_TEST_CONFIG', dirname(__FILE__) . '/../..'); if (!$config || empty($config['sessionhandler']['sql']['mysqli'])) { self::$reason = 'No mysqli configuration'; return; } self::$db = new Horde_Db_Adapter_Mysqli($config['sessionhandler']['sql']['mysqli']); parent::setUpBeforeClass(); } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/Sql/MysqlTest.php 0000664 0001750 0001750 00000002023 12654071112 025446 0 ustar jan jan * @category Horde * @package SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_Sql_MysqlTest extends Horde_SessionHandler_Storage_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('mysql')) { self::$reason = 'No mysql extension'; return; } $config = self::getConfig('SESSIONHANDLER_SQL_MYSQL_TEST_CONFIG', dirname(__FILE__) . '/../..'); if (!$config || empty($config['sessionhandler']['sql']['mysql'])) { self::$reason = 'No mysql configuration'; return; } self::$db = new Horde_Db_Adapter_Mysql($config['sessionhandler']['sql']['mysql']); parent::setUpBeforeClass(); } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/Sql/Oci8Test.php 0000664 0001750 0001750 00000002757 12654071112 025161 0 ustar jan jan * @category Horde * @package SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_Sql_Oci8Test extends Horde_SessionHandler_Storage_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('oci8')) { self::$reason = 'No oci8 extension'; return; } $config = self::getConfig('SESSIONHANDLER_SQL_OCI8_TEST_CONFIG', dirname(__FILE__) . '/../..'); if (!$config || empty($config['sessionhandler']['sql']['oci8'])) { self::$reason = 'No oci8 configuration'; return; } self::$db = new Horde_Db_Adapter_Oci8($config['sessionhandler']['sql']['oci8']); parent::setUpBeforeClass(); } public function testLargeWrite() { $this->assertTrue(self::$handler->open(self::$dir, 'sessiondata')); $this->assertSame('', self::$handler->read('largedata')); // Write twice to test both INSERT and UPDATE. $this->assertTrue(self::$handler->write('largedata', str_repeat('x', 4001))); $this->assertTrue(self::$handler->write('largedata', str_repeat('x', 4001))); $this->assertTrue(self::$handler->destroy('largedata')); } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/Base.php 0000664 0001750 0001750 00000005162 12654071112 023623 0 ustar jan jan * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @category Horde * @package Horde_SessionHandler * @subpackage UnitTests */ class Horde_SessionHandler_Storage_Base extends Horde_Test_Case { protected static $handler; protected static $dir; protected function _write() { $this->assertTrue(self::$handler->open(self::$dir, 'sessionname')); $this->assertSame('', self::$handler->read('sessionid')); $this->assertTrue(self::$handler->write('sessionid', 'sessiondata')); } protected function _read() { $this->assertEquals('sessiondata', self::$handler->read('sessionid')); } protected function _reopen() { $this->assertTrue(self::$handler->close()); $this->assertTrue(self::$handler->open(self::$dir, 'sessionname')); $this->assertEquals('sessiondata', self::$handler->read('sessionid')); $this->assertTrue(self::$handler->close()); } protected function _list() { $this->assertTrue(self::$handler->close()); $this->assertTrue(self::$handler->open(self::$dir, 'sessionname')); self::$handler->read('sessionid2'); $this->assertTrue(self::$handler->write('sessionid2', 'sessiondata2')); /* List while session is active. */ $ids = self::$handler->getSessionIDs(); sort($ids); $this->assertEquals(array('sessionid', 'sessionid2'), $ids); $this->assertTrue(self::$handler->close()); /* List while session is inactive. */ $this->assertTrue(self::$handler->open(self::$dir, 'sessionname')); $ids = self::$handler->getSessionIDs(); sort($ids); $this->assertEquals(array('sessionid', 'sessionid2'), $ids); $this->assertTrue(self::$handler->close()); } protected function _destroy() { $this->assertTrue(self::$handler->open(self::$dir, 'sessionname')); self::$handler->read('sessionid2'); $this->assertTrue(self::$handler->destroy('sessionid2')); $this->assertEquals(array('sessionid'), self::$handler->getSessionIDs()); } protected function _gc() { $this->assertTrue(self::$handler->open(self::$dir, 'sessionname')); $this->assertTrue(self::$handler->gc(-1)); $this->assertEquals(array(), self::$handler->getSessionIDs()); } public static function setUpBeforeClass() { self::$dir = Horde_Util::createTempDir(); } public static function tearDownAfterClass() { self::$handler = null; } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/BuiltinTest.php 0000664 0001750 0001750 00000006572 12654071112 025225 0 ustar jan jan * @category Horde * @package Horde_SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_BuiltinTest extends Horde_SessionHandler_Storage_Base { public function testWrite() { session_name('sessionname'); session_id('sessionid'); @session_start(); $this->assertEmpty($_SESSION); $_SESSION['sessiondata'] = 'foo'; session_write_close(); } /** * @depends testWrite */ public function testRead() { $this->assertEquals('sessiondata|s:3:"foo";', self::$handler->read('sessionid')); } /** * @depends testWrite */ public function testReopen() { session_write_close(); session_name('sessionname'); session_id('sessionid'); @session_start(); $this->assertEquals('foo', $_SESSION['sessiondata']); session_write_close(); } /** * @depends testWrite */ public function testList() { session_write_close(); session_name('sessionname'); session_id('sessionid2'); @session_start(); $_SESSION['sessiondata2'] = 'foo'; /* List while session is active. */ $ids = self::$handler->getSessionIDs(); sort($ids); $this->assertEquals(array('sessionid', 'sessionid2'), $ids); session_write_close(); /* List while session is inactive. */ $ids = self::$handler->getSessionIDs(); sort($ids); $this->assertEquals(array('sessionid', 'sessionid2'), $ids); } /** * @depends testList */ public function testDestroy() { session_name('sessionname'); session_id('sessionid2'); @session_start(); session_destroy(); $this->assertEquals(array('sessionid'), self::$handler->getSessionIDs()); } /** * @depends testDestroy */ public function testGc() { $this->probability = ini_get('session.gc_probability'); $this->divisor = ini_get('session.gc_divisor'); $this->maxlifetime = ini_get('session.gc_maxlifetime'); ini_set('session.gc_probability', 100); ini_set('session.gc_divisor', 1); ini_set('session.gc_maxlifetime', -1); session_name('sessionname'); @session_start(); $this->assertEquals(array(), self::$handler->getSessionIDs()); } public static function setUpBeforeClass() { parent::setUpBeforeClass(); ini_set('session.save_path', self::$dir); self::$handler = new Horde_SessionHandler_Storage_Builtin(array('path' => self::$dir)); } public function tearDown() { if (isset($this->probability)) { ini_set('session.gc_probability', $this->probability); ini_set('session.gc_divisor', $this->divisor); ini_set('session.gc_maxlifetime', $this->maxlifetime); } } public static function tearDownAfterClass() { parent::tearDownAfterClass(); unset($_SESSION); session_destroy(); session_name(ini_get('session.name')); } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/ExternalTest.php 0000664 0001750 0001750 00000005245 12654071112 025375 0 ustar jan jan * @category Horde * @package Horde_SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_ExternalTest extends Horde_SessionHandler_Storage_Base { public function testWrite() { $this->_write(); } /** * @depends testWrite */ public function testRead() { $this->_read(); } /** * @depends testWrite */ public function testReopen() { $this->_reopen(); } /** * The external driver doesn't support listing, so test for existing * sessions manually. * * @depends testWrite */ public function testList() { self::$handler->close(); self::$handler->open(self::$dir, 'sessionname'); self::$handler->read('sessionid2'); self::$handler->write('sessionid2', 'sessiondata2'); /* List while session is active. */ $this->assertNotEmpty(self::$handler->read('sessionid')); $this->assertNotEmpty(self::$handler->read('sessionid2')); self::$handler->close(); /* List while session is inactive. */ self::$handler->open(self::$dir, 'sessionname'); $this->assertNotEmpty(self::$handler->read('sessionid')); $this->assertNotEmpty(self::$handler->read('sessionid2')); self::$handler->close(); } /** * @depends testList */ public function testDestroy() { self::$handler->open(self::$dir, 'sessionname'); self::$handler->read('sessionid2'); self::$handler->destroy('sessionid2'); $this->assertSame('', self::$handler->read('sessionid2')); } /** * @depends testDestroy */ public function testGc() { self::$handler->open(self::$dir, 'sessionname'); self::$handler->gc(-1); $this->assertSame('', self::$handler->read('sessionid')); } public static function setUpBeforeClass() { parent::setUpBeforeClass(); $external = new Horde_SessionHandler_Storage_File(array('path' => self::$dir)); self::$handler = new Horde_SessionHandler_Storage_External( array('open' => array($external, 'open'), 'close' => array($external, 'close'), 'read' => array($external, 'read'), 'write' => array($external, 'write'), 'destroy' => array($external, 'destroy'), 'gc' => array($external, 'gc'))); } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/FileTest.php 0000664 0001750 0001750 00000002340 12654071112 024463 0 ustar jan jan * @category Horde * @package Horde_SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_FileTest extends Horde_SessionHandler_Storage_Base { public function testWrite() { $this->_write(); } /** * @depends testWrite */ public function testRead() { $this->_read(); } /** * @depends testWrite */ public function testReopen() { $this->_reopen(); } /** * @depends testWrite */ public function testList() { $this->_list(); } /** * @depends testList */ public function testDestroy() { $this->_destroy(); } /** * @depends testDestroy */ public function testGc() { $this->_gc(); } public static function setUpBeforeClass() { parent::setUpBeforeClass(); self::$handler = new Horde_SessionHandler_Storage_File(array('path' => self::$dir)); } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/MemcacheTest.php 0000664 0001750 0001750 00000003611 12654071112 025310 0 ustar jan jan * @category Horde * @package Horde_SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_MemcacheTest extends Horde_SessionHandler_Storage_Base { protected static $reason; public function testWrite() { $this->_write(); } /** * @depends testWrite */ public function testRead() { $this->_read(); } /** * @depends testWrite */ public function testReopen() { $this->_reopen(); } /** * @depends testWrite */ public function testList() { $this->_list(); } /** * @depends testList */ public function testDestroy() { $this->_destroy(); } public static function setUpBeforeClass() { if (!extension_loaded('memcache')) { self::$reason = 'No memcache extension.'; return; } $config = self::getConfig('SESSIONHANDLER_MEMCACHE_TEST_CONFIG', dirname(__FILE__) . '/..'); if (!$config || empty($config['sessionhandler']['memcache'])) { self::$reason = 'No memcache configuration.'; return; } $memcache = new Horde_Memcache($config['sessionhandler']['memcache']); $memcache->delete('sessionid'); $memcache->delete('sessionid2'); self::$handler = new Horde_SessionHandler_Storage_Memcache( array('memcache' => $memcache, 'track' => true)); parent::setUpBeforeClass(); } public function setUp() { if (!self::$handler) { $this->markTestSkipped(self::$reason); } } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/Storage/StackTest.php 0000664 0001750 0001750 00000003310 12654071112 024647 0 ustar jan jan * @category Horde * @package Horde_SessionHandler * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_SessionHandler_Storage_StackTest extends Horde_SessionHandler_Storage_Base { public static $reason; public function testWrite() { $this->_write(); } /** * @depends testWrite */ public function testRead() { $this->_read(); } /** * @depends testWrite */ public function testReopen() { $this->_reopen(); } /** * @depends testWrite */ public function testList() { $this->_list(); } /** * @depends testList */ public function testDestroy() { $this->_destroy(); } /** * @depends testDestroy */ public function testGc() { $this->_gc(); } public static function setUpBeforeClass() { parent::setUpBeforeClass(); $storage1 = new Horde_SessionHandler_Storage_File(array( 'path' => self::$dir )); $storage2 = new Horde_SessionHandler_Storage_File(array( 'path' => Horde_Util::createTempDir() )); self::$handler = new Horde_SessionHandler_Storage_Stack(array( 'stack' => array( $storage1, $storage2 ) )); } public function setUp() { if (!self::$handler) { $this->markTestSkipped(self::$reason); } } } Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/AllTests.php 0000664 0001750 0001750 00000000132 12654071112 023070 0 ustar jan jan run(); Horde_SessionHandler-2.2.7/test/Horde/SessionHandler/bootstrap.php 0000664 0001750 0001750 00000000143 12654071112 023354 0 ustar jan jan