mirror of
https://github.com/atlanticbiomedical/portal-legacy.git
synced 2025-07-02 01:47:28 -04:00
initial commit
This commit is contained in:
281
lib/symfony/storage/sfMySQLSessionStorage.class.php
Executable file
281
lib/symfony/storage/sfMySQLSessionStorage.class.php
Executable file
@ -0,0 +1,281 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* (c) 2004-2006 Sean Kerr.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides support for session storage using a MySQL brand database.
|
||||
*
|
||||
* <b>Required parameters:</b>
|
||||
*
|
||||
* # <b>db_table</b> - [none] - The database table in which session data will be
|
||||
* stored.
|
||||
*
|
||||
* <b>Optional parameters:</b>
|
||||
*
|
||||
* # <b>db_id_col</b> - [sess_id] - The database column in which the
|
||||
* session id will be stored.
|
||||
* # <b>db_data_col</b> - [sess_data] - The database column in which the
|
||||
* session data will be stored.
|
||||
* # <b>db_time_col</b> - [sess_time] - The database column in which the
|
||||
* session timestamp will be stored.
|
||||
* # <b>session_name</b> - [symfony] - The name of the session.
|
||||
*
|
||||
* @package symfony
|
||||
* @subpackage storage
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* @author Sean Kerr <skerr@mojavi.org>
|
||||
* @version SVN: $Id: sfMySQLSessionStorage.class.php 4238 2007-06-18 12:14:36Z fabien $
|
||||
*/
|
||||
class sfMySQLSessionStorage extends sfSessionStorage
|
||||
{
|
||||
protected
|
||||
$resource = null;
|
||||
|
||||
/**
|
||||
* Initializes this Storage instance.
|
||||
*
|
||||
* @param sfContext A sfContext instance
|
||||
* @param array An associative array of initialization parameters
|
||||
*
|
||||
* @return boolean true, if initialization completes successfully, otherwise false
|
||||
*
|
||||
* @throws <b>sfInitializationException</b> If an error occurs while initializing this Storage
|
||||
*/
|
||||
public function initialize($context, $parameters = null)
|
||||
{
|
||||
// disable auto_start
|
||||
$parameters['auto_start'] = false;
|
||||
|
||||
// initialize the parent
|
||||
parent::initialize($context, $parameters);
|
||||
|
||||
if (!$this->getParameterHolder()->has('db_table'))
|
||||
{
|
||||
// missing required 'db_table' parameter
|
||||
$error = 'Factory configuration file is missing required "db_table" parameter for the Storage category';
|
||||
|
||||
throw new sfInitializationException($error);
|
||||
}
|
||||
|
||||
// use this object as the session handler
|
||||
session_set_save_handler(array($this, 'sessionOpen'),
|
||||
array($this, 'sessionClose'),
|
||||
array($this, 'sessionRead'),
|
||||
array($this, 'sessionWrite'),
|
||||
array($this, 'sessionDestroy'),
|
||||
array($this, 'sessionGC'));
|
||||
|
||||
// start our session
|
||||
session_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes a session.
|
||||
*
|
||||
* @return boolean true, if the session was closed, otherwise false
|
||||
*/
|
||||
public function sessionClose()
|
||||
{
|
||||
// do nothing
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a session.
|
||||
*
|
||||
* @param string A session ID
|
||||
*
|
||||
* @return boolean true, if the session was destroyed, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If the session cannot be destroyed.
|
||||
*/
|
||||
public function sessionDestroy($id)
|
||||
{
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
|
||||
// cleanup the session id, just in case
|
||||
$id = mysql_real_escape_string($id, $this->resource);
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'DELETE FROM '.$db_table.' WHERE '.$db_id_col.' = \''.$id.'\'';
|
||||
|
||||
if (@mysql_query($sql, $this->resource))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// failed to destroy session
|
||||
$error = 'MySQLSessionStorage cannot destroy session id "%s"';
|
||||
$error = sprintf($error, $id);
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up old sessions.
|
||||
*
|
||||
* @param int The lifetime of a session
|
||||
*
|
||||
* @return boolean true, if old sessions have been cleaned, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If any old sessions cannot be cleaned
|
||||
*/
|
||||
public function sessionGC($lifetime)
|
||||
{
|
||||
// determine deletable session time
|
||||
$time = time() - $lifetime;
|
||||
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'DELETE FROM '.$db_table.' '.
|
||||
'WHERE '.$db_time_col.' < '.$time;
|
||||
|
||||
if (@mysql_query($sql, $this->resource))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// failed to cleanup old sessions
|
||||
$error = 'MySQLSessionStorage cannot delete old sessions';
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a session.
|
||||
*
|
||||
* @param string
|
||||
* @param string
|
||||
*
|
||||
* @return boolean true, if the session was opened, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If a connection with the database does not exist or cannot be created
|
||||
*/
|
||||
public function sessionOpen($path, $name)
|
||||
{
|
||||
// what database are we using?
|
||||
$database = $this->getParameterHolder()->get('database', 'default');
|
||||
|
||||
// get the database resource
|
||||
$this->resource = $this->getContext()
|
||||
->getDatabaseManager()
|
||||
->getDatabase($database)
|
||||
->getResource();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a session.
|
||||
*
|
||||
* @param string A session ID
|
||||
*
|
||||
* @return boolean true, if the session was read, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If the session cannot be read
|
||||
*/
|
||||
public function sessionRead($id)
|
||||
{
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_data_col = $this->getParameterHolder()->get('db_data_col', 'sess_data');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
// cleanup the session id, just in case
|
||||
$id = mysql_real_escape_string($id, $this->resource);
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'SELECT '.$db_data_col.' ' .
|
||||
'FROM '.$db_table.' ' .
|
||||
'WHERE '.$db_id_col.' = \''.$id.'\'';
|
||||
|
||||
$result = @mysql_query($sql, $this->resource);
|
||||
|
||||
if ($result != false && @mysql_num_rows($result) == 1)
|
||||
{
|
||||
// found the session
|
||||
$data = mysql_fetch_row($result);
|
||||
|
||||
return $data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
// session does not exist, create it
|
||||
$sql = 'INSERT INTO '.$db_table.' ('.$db_id_col.', ' .
|
||||
$db_data_col.', '.$db_time_col.') VALUES (' .
|
||||
'\''.$id.'\', \'\', '.time().')';
|
||||
|
||||
if (@mysql_query($sql, $this->resource))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// can't create record
|
||||
$error = 'MySQLSessionStorage cannot create new record for id "%s"';
|
||||
$error = sprintf($error, $id);
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes session data.
|
||||
*
|
||||
* @param string A session ID
|
||||
* @param string A serialized chunk of session data
|
||||
*
|
||||
* @return boolean true, if the session was written, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If the session data cannot be written
|
||||
*/
|
||||
public function sessionWrite($id, &$data)
|
||||
{
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_data_col = $this->getParameterHolder()->get('db_data_col', 'sess_data');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
// cleanup the session id and data, just in case
|
||||
$id = mysql_real_escape_string($id, $this->resource);
|
||||
$data = mysql_real_escape_string($data, $this->resource);
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'UPDATE '.$db_table.' ' .
|
||||
'SET '.$db_data_col.' = \''.$data.'\', ' .
|
||||
$db_time_col.' = '.time().' ' .
|
||||
'WHERE '.$db_id_col.' = \''.$id.'\'';
|
||||
|
||||
if (@mysql_query($sql, $this->resource))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// failed to write session data
|
||||
$error = 'MySQLSessionStorage cannot write session data for id "%s"';
|
||||
$error = sprintf($error, $id);
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the shutdown procedure.
|
||||
*
|
||||
*/
|
||||
public function shutdown()
|
||||
{
|
||||
}
|
||||
}
|
280
lib/symfony/storage/sfPDOSessionStorage.class.php
Executable file
280
lib/symfony/storage/sfPDOSessionStorage.class.php
Executable file
@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004, 2005 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* (c) 2004, 2005 Sean Kerr.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides support for session storage using a PDO database abstraction layer.
|
||||
*
|
||||
* <b>Required parameters:</b>
|
||||
*
|
||||
* # <b>db_table</b> - [none] - The database table in which session data will be stored.
|
||||
*
|
||||
* <b>Optional parameters:</b>
|
||||
*
|
||||
* # <b>database</b> - [default] - The database connection to use (see databases.yml).
|
||||
* # <b>db_id_col</b> - [sess_id] - The database column in which the session id will be stored.
|
||||
* # <b>db_data_col</b> - [sess_data] - The database column in which the session data will be stored.
|
||||
* # <b>db_time_col</b> - [sess_time] - The database column in which the session timestamp will be stored.
|
||||
* # <b>session_name</b> - [symfony] - The name of the session.
|
||||
*
|
||||
* @package symfony
|
||||
* @subpackage storage
|
||||
* @author Mathew Toth <developer@poetryleague.com>
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* @author Sean Kerr <skerr@mojavi.org>
|
||||
* @version SVN: $Id: sfPDOSessionStorage.class.php 3329 2007-01-23 08:29:34Z fabien $
|
||||
*/
|
||||
class sfPDOSessionStorage extends sfSessionStorage
|
||||
{
|
||||
/**
|
||||
* PDO connection
|
||||
* @var Connection
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Initializes this Storage instance.
|
||||
*
|
||||
* @param sfContext A sfContext instance
|
||||
* @param array An associative array of initialization parameters
|
||||
*
|
||||
* @return boolean true, if initialization completes successfully, otherwise false
|
||||
*
|
||||
* @throws <b>InitializationException</b> If an error occurs while initializing this Storage
|
||||
*/
|
||||
public function initialize($context, $parameters = null)
|
||||
{
|
||||
// disable auto_start
|
||||
$parameters['auto_start'] = false;
|
||||
|
||||
// initialize the parent
|
||||
parent::initialize($context, $parameters);
|
||||
|
||||
if (!$this->getParameterHolder()->has('db_table'))
|
||||
{
|
||||
// missing required 'db_table' parameter
|
||||
$error = 'Factory configuration file is missing required "db_table" parameter for the Storage category';
|
||||
|
||||
throw new sfInitializationException($error);
|
||||
}
|
||||
|
||||
// use this object as the session handler
|
||||
session_set_save_handler(array($this, 'sessionOpen'),
|
||||
array($this, 'sessionClose'),
|
||||
array($this, 'sessionRead'),
|
||||
array($this, 'sessionWrite'),
|
||||
array($this, 'sessionDestroy'),
|
||||
array($this, 'sessionGC'));
|
||||
|
||||
// start our session
|
||||
session_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes a session.
|
||||
*
|
||||
* @return boolean true, if the session was closed, otherwise false
|
||||
*/
|
||||
public function sessionClose()
|
||||
{
|
||||
// do nothing
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a session.
|
||||
*
|
||||
* @param string A session ID
|
||||
*
|
||||
* @return boolean true, if the session was destroyed, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If the session cannot be destroyed
|
||||
*/
|
||||
public function sessionDestroy($id)
|
||||
{
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'DELETE FROM '.$db_table.' WHERE '.$db_id_col.'= ?';
|
||||
|
||||
try
|
||||
{
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->bindParam(1, $id, PDO::PARAM_STR); // setString(1, $id);
|
||||
$stmt->execute();
|
||||
}
|
||||
catch (PDOException $e)
|
||||
{
|
||||
$error = sprintf('PDOException was thrown when trying to manipulate session data. Message: %s', $e->getMessage());
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up old sessions.
|
||||
*
|
||||
* @param int The lifetime of a session
|
||||
*
|
||||
* @return boolean true, if old sessions have been cleaned, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If any old sessions cannot be cleaned
|
||||
*/
|
||||
public function sessionGC($lifetime)
|
||||
{
|
||||
// determine deletable session time
|
||||
$time = time() - $lifetime;
|
||||
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'DELETE FROM '.$db_table.' WHERE '.$db_time_col.' < '.$time;
|
||||
|
||||
try
|
||||
{
|
||||
$this->db->query($sql);
|
||||
return true;
|
||||
}
|
||||
catch (PDOException $e)
|
||||
{
|
||||
$error = sprintf('PDOException was thrown when trying to manipulate session data. Message: %s', $e->getMessage());
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a session.
|
||||
*
|
||||
* @param string
|
||||
* @param string
|
||||
*
|
||||
* @return boolean true, if the session was opened, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If a connection with the database does not exist or cannot be created
|
||||
*/
|
||||
public function sessionOpen($path, $name)
|
||||
{
|
||||
// what database are we using?
|
||||
$database = $this->getParameterHolder()->get('database', 'default');
|
||||
|
||||
$this->db = $this->getContext()->getDatabaseConnection($database);
|
||||
if ($this->db == null || !$this->db instanceof PDO)
|
||||
{
|
||||
$error = 'PDO dabatase connection doesn\'t exist. Unable to open session.';
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a session.
|
||||
*
|
||||
* @param string A session ID
|
||||
*
|
||||
* @return boolean true, if the session was read, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If the session cannot be read
|
||||
*/
|
||||
public function sessionRead($id)
|
||||
{
|
||||
// get table/columns
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_data_col = $this->getParameterHolder()->get('db_data_col', 'sess_data');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
try
|
||||
{
|
||||
$sql = 'SELECT '.$db_data_col.' FROM '.$db_table.' WHERE '.$db_id_col.'=?';
|
||||
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->bindParam(1, $id, PDO::PARAM_STR, 255);
|
||||
|
||||
$stmt->execute();
|
||||
if ($data = $stmt->fetchColumn())
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
// session does not exist, create it
|
||||
$sql = 'INSERT INTO '.$db_table.'('.$db_id_col.', '.$db_data_col.', '.$db_time_col.') VALUES (?, ?, ?)';
|
||||
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->bindParam(1, $id, PDO::PARAM_STR); // setString(1, $id);
|
||||
$stmt->bindValue(2, '', PDO::PARAM_STR); // setString(2, '');
|
||||
$stmt->bindValue(3, time(), PDO::PARAM_INT); // setInt(3, time());
|
||||
$stmt->execute();
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
catch (PDOException $e)
|
||||
{
|
||||
$error = sprintf('PDOException was thrown when trying to manipulate session data. Message: %s', $e->getMessage());
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes session data.
|
||||
*
|
||||
* @param string A session ID
|
||||
* @param string A serialized chunk of session data
|
||||
*
|
||||
* @return boolean true, if the session was written, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If the session data cannot be written
|
||||
*/
|
||||
public function sessionWrite($id, $data)
|
||||
{
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_data_col = $this->getParameterHolder()->get('db_data_col', 'sess_data');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
$sql = 'UPDATE '.$db_table.' SET '.$db_data_col.' = ?, '.$db_time_col.' = '.time().' WHERE '.$db_id_col.'= ?';
|
||||
|
||||
try
|
||||
{
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->bindParam(1, $data, PDO::PARAM_STR); // setString(1, $data);
|
||||
$stmt->bindParam(2, $id, PDO::PARAM_STR); // setString(2, $id);
|
||||
$stmt->execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
catch (PDOException $e)
|
||||
{
|
||||
$error = sprintf('PDOException was thrown when trying to manipulate session data. Message: %s', $e->getMessage());
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the shutdown procedure.
|
||||
*
|
||||
*/
|
||||
public function shutdown()
|
||||
{
|
||||
}
|
||||
}
|
280
lib/symfony/storage/sfPostgreSQLSessionStorage.class.php
Executable file
280
lib/symfony/storage/sfPostgreSQLSessionStorage.class.php
Executable file
@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* (c) 2004-2006 Sean Kerr.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides support for session storage using a PostgreSQL brand database.
|
||||
*
|
||||
* <b>Required parameters:</b>
|
||||
*
|
||||
* # <b>db_table</b> - [none] - The database table in which session data will be stored.
|
||||
*
|
||||
* <b>Optional parameters:</b>
|
||||
*
|
||||
* # <b>db_id_col</b> - [sess_id] - The database column in which the
|
||||
* session id will be stored.
|
||||
* # <b>db_data_col</b> - [sess_data] - The database column in which the
|
||||
* session data will be stored.
|
||||
* # <b>db_time_col</b> - [sess_time] - The database column in which the
|
||||
* session timestamp will be stored.
|
||||
* # <b>session_name</b> - [symfony] - The name of the session.
|
||||
*
|
||||
* @package symfony
|
||||
* @subpackage storage
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* @author Sean Kerr <skerr@mojavi.org>
|
||||
* @version SVN: $Id: sfPostgreSQLSessionStorage.class.php 4891 2007-08-23 15:49:41Z fabien $
|
||||
*/
|
||||
class sfPostgreSQLSessionStorage extends sfSessionStorage
|
||||
{
|
||||
protected
|
||||
$resource = null;
|
||||
|
||||
/**
|
||||
* Initializes this Storage instance.
|
||||
*
|
||||
* @param sfContext A sfContext instance
|
||||
* @param array An associative array of initialization parameters
|
||||
*
|
||||
* @return boolean true, if initialization completes successfully, otherwise false
|
||||
*
|
||||
* @throws <b>sfInitializationException</b> If an error occurs while initializing this Storage
|
||||
*/
|
||||
public function initialize($context, $parameters = null)
|
||||
{
|
||||
// disable auto_start
|
||||
$parameters['auto_start'] = false;
|
||||
|
||||
// initialize the parent
|
||||
parent::initialize($context, $parameters);
|
||||
|
||||
if (!$this->getParameterHolder()->has('db_table'))
|
||||
{
|
||||
// missing required 'db_table' parameter
|
||||
$error = 'Factory configuration file is missing required "db_table" parameter for the Storage category';
|
||||
|
||||
throw new sfInitializationException($error);
|
||||
}
|
||||
|
||||
// use this object as the session handler
|
||||
session_set_save_handler(array($this, 'sessionOpen'),
|
||||
array($this, 'sessionClose'),
|
||||
array($this, 'sessionRead'),
|
||||
array($this, 'sessionWrite'),
|
||||
array($this, 'sessionDestroy'),
|
||||
array($this, 'sessionGC'));
|
||||
|
||||
// start our session
|
||||
session_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes a session.
|
||||
*
|
||||
* @return boolean true, if the session was closed, otherwise false
|
||||
*/
|
||||
public function sessionClose()
|
||||
{
|
||||
// do nothing
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a session.
|
||||
*
|
||||
* @param string A session ID
|
||||
*
|
||||
* @return boolean true, if the session was destroyed, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If the session cannot be destroyed
|
||||
*/
|
||||
public function sessionDestroy($id)
|
||||
{
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
|
||||
// cleanup the session id, just in case
|
||||
$id = addslashes($id);
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'DELETE FROM '.$db_table.' WHERE '.$db_id_col.' = \''.$id.'\'';
|
||||
|
||||
if (@pg_query($this->resource, $sql))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// failed to destroy session
|
||||
$error = 'PostgreSQLSessionStorage cannot destroy session id "%s"';
|
||||
$error = sprintf($error, $id);
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up old sessions.
|
||||
*
|
||||
* @param int The lifetime of a session
|
||||
*
|
||||
* @return boolean true, if old sessions have been cleaned, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If any old sessions cannot be cleaned
|
||||
*/
|
||||
public function sessionGC($lifetime)
|
||||
{
|
||||
// determine deletable session time
|
||||
$time = time() - $lifetime;
|
||||
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'DELETE FROM '.$db_table.' WHERE '.$db_time_col.' < '.$time;
|
||||
|
||||
if (@pg_query($this->resource, $sql))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// failed to cleanup old sessions
|
||||
$error = 'PostgreSQLSessionStorage cannot delete old sessions';
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a session.
|
||||
*
|
||||
* @param string
|
||||
* @param string
|
||||
*
|
||||
* @return boolean true, if the session was opened, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If a connection with the database does
|
||||
* not exist or cannot be created
|
||||
*/
|
||||
public function sessionOpen($path, $name)
|
||||
{
|
||||
// what database are we using?
|
||||
$database = $this->getParameterHolder()->get('database', 'default');
|
||||
|
||||
// get the database resource
|
||||
$this->resource = $this->getContext()
|
||||
->getDatabaseManager()
|
||||
->getDatabase($database)
|
||||
->getResource();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a session.
|
||||
*
|
||||
* @param string A session ID
|
||||
*
|
||||
* @return boolean true, if the session was read, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If the session cannot be read
|
||||
*/
|
||||
public function sessionRead($id)
|
||||
{
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_data_col = $this->getParameterHolder()->get('db_data_col', 'sess_data');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
// cleanup the session id, just in case
|
||||
$id = addslashes($id);
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'SELECT '.$db_data_col.' ' .
|
||||
'FROM '.$db_table.' ' .
|
||||
'WHERE '.$db_id_col.' = \''.$id.'\'';
|
||||
|
||||
$result = @pg_query($this->resource, $sql);
|
||||
|
||||
if ($result != false && @pg_num_rows($result) == 1)
|
||||
{
|
||||
// found the session
|
||||
$data = pg_fetch_row($result);
|
||||
|
||||
return $data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
// session does not exist, create it
|
||||
$sql = 'INSERT INTO '.$db_table.' ('.$db_id_col.', ' .
|
||||
$db_data_col.', '.$db_time_col.') VALUES (' .
|
||||
'\''.$id.'\', \'\', '.time().')';
|
||||
|
||||
if (@pg_query($this->resource, $sql))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// can't create record
|
||||
$error = 'PostgreSQLSessionStorage cannot create new record for id "%s"';
|
||||
$error = sprintf($error, $id);
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes session data.
|
||||
*
|
||||
* @param string A session ID
|
||||
* @param string A serialized chunk of session data
|
||||
*
|
||||
* @return boolean true, if the session was written, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>sfDatabaseException</b> If the session data cannot be written
|
||||
*/
|
||||
public function sessionWrite($id, &$data)
|
||||
{
|
||||
// get table/column
|
||||
$db_table = $this->getParameterHolder()->get('db_table');
|
||||
$db_data_col = $this->getParameterHolder()->get('db_data_col', 'sess_data');
|
||||
$db_id_col = $this->getParameterHolder()->get('db_id_col', 'sess_id');
|
||||
$db_time_col = $this->getParameterHolder()->get('db_time_col', 'sess_time');
|
||||
|
||||
// cleanup the session id and data, just in case
|
||||
$id = addslashes($id);
|
||||
$data = addslashes($data);
|
||||
|
||||
// delete the record associated with this id
|
||||
$sql = 'UPDATE '.$db_table.' '.
|
||||
'SET '.$db_data_col.' = \''.$data.'\', '.
|
||||
$db_time_col.' = '.time().' '.
|
||||
'WHERE '.$db_id_col.' = \''.$id.'\'';
|
||||
|
||||
if (@pg_query($this->resource, $sql))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// failed to write session data
|
||||
$error = 'PostgreSQLSessionStorage cannot write session data for id "%s"';
|
||||
$error = sprintf($error, $id);
|
||||
|
||||
throw new sfDatabaseException($error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the shutdown procedure.
|
||||
*
|
||||
*/
|
||||
public function shutdown()
|
||||
{
|
||||
}
|
||||
}
|
146
lib/symfony/storage/sfSessionStorage.class.php
Executable file
146
lib/symfony/storage/sfSessionStorage.class.php
Executable file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* (c) 2004-2006 Sean Kerr.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* sfSessionStorage allows you to store persistent symfony data in the user session.
|
||||
*
|
||||
* <b>Optional parameters:</b>
|
||||
*
|
||||
* # <b>auto_start</b> - [Yes] - Should session_start() automatically be called?
|
||||
* # <b>session_name</b> - [symfony] - The name of the session.
|
||||
*
|
||||
* @package symfony
|
||||
* @subpackage storage
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* @author Sean Kerr <skerr@mojavi.org>
|
||||
* @version SVN: $Id: sfSessionStorage.class.php 3329 2007-01-23 08:29:34Z fabien $
|
||||
*/
|
||||
class sfSessionStorage extends sfStorage
|
||||
{
|
||||
/**
|
||||
* Initializes this Storage instance.
|
||||
*
|
||||
* @param sfContext A sfContext instance
|
||||
* @param array An associative array of initialization parameters
|
||||
*
|
||||
* @return boolean true, if initialization completes successfully, otherwise false
|
||||
*
|
||||
* @throws <b>sfInitializationException</b> If an error occurs while initializing this Storage
|
||||
*/
|
||||
public function initialize($context, $parameters = null)
|
||||
{
|
||||
// initialize parent
|
||||
parent::initialize($context, $parameters);
|
||||
|
||||
// set session name
|
||||
$sessionName = $this->getParameterHolder()->get('session_name', 'symfony');
|
||||
|
||||
session_name($sessionName);
|
||||
|
||||
$use_cookies = (boolean) ini_get('session.use_cookies');
|
||||
if (!$use_cookies)
|
||||
{
|
||||
$sessionId = $context->getRequest()->getParameter($sessionName, '');
|
||||
|
||||
if ($sessionId != '')
|
||||
{
|
||||
session_id($sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
$cookieDefaults = session_get_cookie_params();
|
||||
$lifetime = $this->getParameter('session_cookie_lifetime', $cookieDefaults['lifetime']);
|
||||
$path = $this->getParameter('session_cookie_path', $cookieDefaults['path']);
|
||||
$domain = $this->getParameter('session_cookie_domain', $cookieDefaults['domain']);
|
||||
$secure = $this->getParameter('session_cookie_secure', $cookieDefaults['secure']);
|
||||
$httpOnly = $this->getParameter('session_cookie_httponly', isset($cookieDefaults['httponly']) ? $cookieDefaults['httponly'] : false);
|
||||
if (version_compare(phpversion(), '5.2', '>='))
|
||||
{
|
||||
session_set_cookie_params($lifetime, $path, $domain, $secure, $httpOnly);
|
||||
}
|
||||
else
|
||||
{
|
||||
session_set_cookie_params($lifetime, $path, $domain, $secure);
|
||||
}
|
||||
|
||||
if ($this->getParameter('auto_start', true))
|
||||
{
|
||||
// start our session
|
||||
session_start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads data from this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided.
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
*
|
||||
* @return mixed Data associated with the key
|
||||
*/
|
||||
public function & read($key)
|
||||
{
|
||||
$retval = null;
|
||||
|
||||
if (isset($_SESSION[$key]))
|
||||
{
|
||||
$retval =& $_SESSION[$key];
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes data from this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided.
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
*
|
||||
* @return mixed Data associated with the key
|
||||
*/
|
||||
public function & remove($key)
|
||||
{
|
||||
$retval = null;
|
||||
|
||||
if (isset($_SESSION[$key]))
|
||||
{
|
||||
$retval =& $_SESSION[$key];
|
||||
unset($_SESSION[$key]);
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes data to this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided.
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
* @param mixed Data associated with your key
|
||||
*
|
||||
*/
|
||||
public function write($key, &$data)
|
||||
{
|
||||
$_SESSION[$key] =& $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the shutdown procedure.
|
||||
*
|
||||
*/
|
||||
public function shutdown()
|
||||
{
|
||||
// don't need a shutdown procedure because read/write do it in real-time
|
||||
}
|
||||
}
|
152
lib/symfony/storage/sfSessionTestStorage.class.php
Executable file
152
lib/symfony/storage/sfSessionTestStorage.class.php
Executable file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* sfSessionTestStorage is a fake sfSessionStorage implementation to allow easy testing.
|
||||
*
|
||||
* @package symfony
|
||||
* @subpackage storage
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* @version SVN: $Id: sfSessionTestStorage.class.php 3329 2007-01-23 08:29:34Z fabien $
|
||||
*/
|
||||
class sfSessionTestStorage extends sfStorage
|
||||
{
|
||||
protected
|
||||
$sessionId = null,
|
||||
$sessionData = array(),
|
||||
$sessionPath = null;
|
||||
|
||||
/**
|
||||
* Initializes this Storage instance.
|
||||
*
|
||||
* @param sfContext A sfContext instance
|
||||
* @param array An associative array of initialization parameters
|
||||
*
|
||||
* @return boolean true, if initialization completes successfully, otherwise false
|
||||
*
|
||||
* @throws <b>sfInitializationException</b> If an error occurs while initializing this Storage
|
||||
*/
|
||||
public function initialize($context, $parameters = null)
|
||||
{
|
||||
// initialize parent
|
||||
parent::initialize($context, $parameters);
|
||||
|
||||
$this->sessionPath = sfConfig::get('sf_test_cache_dir').DIRECTORY_SEPARATOR.'sessions';
|
||||
|
||||
if (array_key_exists('session_id', $_SERVER))
|
||||
{
|
||||
$this->sessionId = $_SERVER['session_id'];
|
||||
|
||||
// we read session data from temp file
|
||||
$file = $this->sessionPath.DIRECTORY_SEPARATOR.$this->sessionId.'.session';
|
||||
$this->sessionData = file_exists($file) ? unserialize(file_get_contents($file)) : array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sessionId = md5(uniqid(rand(), true));
|
||||
$this->sessionData = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets session id for the current session storage instance.
|
||||
*
|
||||
* @return string Session id
|
||||
*/
|
||||
public function getSessionId()
|
||||
{
|
||||
return $this->sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads data from this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided.
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
*
|
||||
* @return mixed Data associated with the key
|
||||
*/
|
||||
public function & read($key)
|
||||
{
|
||||
$retval = null;
|
||||
|
||||
if (isset($this->sessionData[$key]))
|
||||
{
|
||||
$retval =& $this->sessionData[$key];
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes data from this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided.
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
*
|
||||
* @return mixed Data associated with the key
|
||||
*/
|
||||
public function & remove($key)
|
||||
{
|
||||
$retval = null;
|
||||
|
||||
if (isset($this->sessionData[$key]))
|
||||
{
|
||||
$retval =& $this->sessionData[$key];
|
||||
unset($this->sessionData[$key]);
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes data to this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
* @param mixed Data associated with your key
|
||||
*
|
||||
*/
|
||||
public function write($key, &$data)
|
||||
{
|
||||
$this->sessionData[$key] =& $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all test sessions.
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
sfToolkit::clearDirectory($this->sessionPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the shutdown procedure.
|
||||
*
|
||||
*/
|
||||
public function shutdown()
|
||||
{
|
||||
if ($this->sessionId)
|
||||
{
|
||||
$current_umask = umask(0000);
|
||||
if (!is_dir($this->sessionPath))
|
||||
{
|
||||
mkdir($this->sessionPath, 0777, true);
|
||||
}
|
||||
umask($current_umask);
|
||||
file_put_contents($this->sessionPath.DIRECTORY_SEPARATOR.$this->sessionId.'.session', serialize($this->sessionData));
|
||||
$this->sessionId = '';
|
||||
$this->sessionData = array();
|
||||
}
|
||||
}
|
||||
}
|
174
lib/symfony/storage/sfStorage.class.php
Executable file
174
lib/symfony/storage/sfStorage.class.php
Executable file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* (c) 2004-2006 Sean Kerr.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* sfStorage allows you to customize the way symfony stores its persistent data.
|
||||
*
|
||||
* @package symfony
|
||||
* @subpackage storage
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* @author Sean Kerr <skerr@mojavi.org>
|
||||
* @version SVN: $Id: sfStorage.class.php 3329 2007-01-23 08:29:34Z fabien $
|
||||
*/
|
||||
abstract class sfStorage
|
||||
{
|
||||
protected
|
||||
$parameterHolder = null,
|
||||
$context = null;
|
||||
|
||||
/**
|
||||
* Retrieves the current application context.
|
||||
*
|
||||
* @return sfContext A sfContext instance
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes this Storage instance.
|
||||
*
|
||||
* @param sfContext A sfContext instance
|
||||
* @param array An associative array of initialization parameters
|
||||
*
|
||||
* @return boolean true, if initialization completes successfully, otherwise false
|
||||
*
|
||||
* @throws <b>sfInitializationException</b> If an error occurs while initializing this sfStorage
|
||||
*/
|
||||
public function initialize($context, $parameters = array())
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->parameterHolder = new sfParameterHolder();
|
||||
$this->getParameterHolder()->add($parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a new Storage implementation instance.
|
||||
*
|
||||
* @param string A Storage implementation name
|
||||
*
|
||||
* @return Storage A Storage implementation instance
|
||||
*
|
||||
* @throws <b>sfFactoryException</b> If a storage implementation instance cannot be created
|
||||
*/
|
||||
public static function newInstance($class)
|
||||
{
|
||||
// the class exists
|
||||
$object = new $class();
|
||||
|
||||
if (!($object instanceof sfStorage))
|
||||
{
|
||||
// the class name is of the wrong type
|
||||
$error = 'Class "%s" is not of the type sfStorage';
|
||||
$error = sprintf($error, $class);
|
||||
|
||||
throw new sfFactoryException($error);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads data from this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided.
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
*
|
||||
* @return mixed Data associated with the key
|
||||
*
|
||||
* @throws <b>sfStorageException</b> If an error occurs while reading data from this storage
|
||||
*/
|
||||
abstract function & read($key);
|
||||
|
||||
/**
|
||||
* Removes data from this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided.
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
*
|
||||
* @return mixed Data associated with the key
|
||||
*
|
||||
* @throws <b>sfStorageException</b> If an error occurs while removing data from this storage
|
||||
*/
|
||||
abstract function & remove($key);
|
||||
|
||||
/**
|
||||
* Executes the shutdown procedure.
|
||||
*
|
||||
* @throws <b>sfStorageException</b> If an error occurs while shutting down this storage
|
||||
*/
|
||||
abstract function shutdown();
|
||||
|
||||
/**
|
||||
* Writes data to this storage.
|
||||
*
|
||||
* The preferred format for a key is directory style so naming conflicts can be avoided.
|
||||
*
|
||||
* @param string A unique key identifying your data
|
||||
* @param mixed Data associated with your key
|
||||
*
|
||||
* @throws <b>sfStorageException</b> If an error occurs while writing to this storage
|
||||
*/
|
||||
abstract function write($key, &$data);
|
||||
|
||||
/**
|
||||
* Retrieves the parameters from the storage.
|
||||
*
|
||||
* @return sfParameterHolder List of parameters
|
||||
*/
|
||||
public function getParameterHolder()
|
||||
{
|
||||
return $this->parameterHolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a parameter from the validator.
|
||||
*
|
||||
* @param string Parameter name
|
||||
* @param mixed A default parameter
|
||||
* @param string Namespace for the current storage
|
||||
*
|
||||
* @return mixed A parameter value
|
||||
*/
|
||||
public function getParameter($name, $default = null, $ns = null)
|
||||
{
|
||||
return $this->parameterHolder->get($name, $default, $ns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether or not a parameter exist for the storage instance.
|
||||
*
|
||||
* @param string A parameter name
|
||||
* @param string A parameter namespace
|
||||
*
|
||||
* @return boolean true, if parameter exists, otherwise false
|
||||
*/
|
||||
public function hasParameter($name, $ns = null)
|
||||
{
|
||||
return $this->parameterHolder->has($name, $ns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter for the current storage instance.
|
||||
*
|
||||
* @param string A parameter name
|
||||
* @param mixed A parameter value
|
||||
* @param string Namespace for the current storage
|
||||
*/
|
||||
public function setParameter($name, $value, $ns = null)
|
||||
{
|
||||
return $this->parameterHolder->set($name, $value, $ns);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user