Example #1
0
 /**
 	Initialize the session storage handler.
 
 	Along with the parameters defined by weeSession::construct, another
 	parameter "table" identify which table should be used to store sessions.
 
 	@param $aParams A list of parameters to configure the session class.
 	@see weeSession::__construct
 */
 public function __construct($aParams = array())
 {
     // We are required to include this class now in case it is needed
     // when this object gets destroyed at the end of the script.
     // Autoload does not work if the script is terminating, resulting in a fatal error.
     class_exists('DatabaseException');
     session_set_save_handler(array($this, 'storageOpen'), array($this, 'storageClose'), array($this, 'storageRead'), array($this, 'storageWrite'), array($this, 'storageDestroy'), array($this, 'storageGarbageCollector'));
     empty($aParams['db']) || $aParams['db'] instanceof weeDatabase or burn('InvalidArgumentException', _WT('The optional "db" parameter must be an instance of weeDatabase.'));
     isset($aParams['table']) or burn('InvalidArgumentException', _WT('The required "table" parameter is missing.'));
     if (!empty($aParams['db'])) {
         $this->setDb($aParams['db']);
     }
     parent::__construct($aParams);
 }