Source for file session.php
Documentation is available at session.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @deprecated 13.3 (Platform) & 4.0 (CMS) - Use SQL queries to interact with the session table.
* @param JDatabaseDriver $db Database driver object.
* @deprecated 13.3 Use SQL queries to interact with the session table.
JLog::add('JTableSession is deprecated. Use SQL queries directly to interact with the session table.', JLog::WARNING, 'deprecated');
* @param string $sessionId The session id
* @param integer $clientId The id of the client application
* @return boolean True on success
* @deprecated 13.3 Use SQL queries to interact with the session table.
public function insert($sessionId, $clientId)
$this->session_id =
$sessionId;
$this->client_id =
$clientId;
$ret =
$this->_db->insertObject($this->_tbl, $this, 'session_id');
* @param boolean $updateNulls True to update fields even if they are null.
* @return boolean True on success.
* @deprecated 13.3 Use SQL queries to interact with the session table.
public function update($updateNulls =
false)
$ret =
$this->_db->updateObject($this->_tbl, $this, 'session_id', $updateNulls);
* Destroys the pre-existing session
* @param integer $userId Identifier of the user for this session.
* @param array $clientIds Array of client ids for which session(s) will be destroyed
* @return boolean True on success.
* @deprecated 13.3 Use SQL queries to interact with the session table.
public function destroy($userId, $clientIds =
array())
$clientIds =
implode(',', $clientIds);
$query =
$this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('userid') .
' = ' .
$this->_db->quote($userId))
->where($this->_db->quoteName('client_id') .
' IN (' .
$clientIds .
')');
$this->_db->setQuery($query);
if (!$this->_db->execute())
* @param integer $maxLifetime Session age in seconds
* @return mixed Resource on success, null on fail
* @deprecated 13.3 Use SQL queries to interact with the session table.
public function purge($maxLifetime =
1440)
$past =
time() -
$maxLifetime;
$query =
$this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('time') .
' < ' . (int)
$past);
$this->_db->setQuery($query);
return $this->_db->execute();
* Find out if a user has a one or more active sessions
* @param integer $userid The identifier of the user
* @return boolean True if a session for this user exists
* @deprecated 13.3 Use SQL queries to interact with the session table.
public function exists($userid)
$query =
$this->_db->getQuery(true)
->select('COUNT(userid)')
->from($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('userid') .
' = ' .
$this->_db->quote($userid));
$this->_db->setQuery($query);
if (!$result =
$this->_db->loadResult())
return (boolean)
$result;
* Overloaded delete method
* We must override it because of the non-integer primary key
* @param integer $oid The object id (optional).
* @return mixed True if successful otherwise an error message
* @deprecated 13.3 Use SQL queries to interact with the session table.
public function delete($oid =
null)
$query =
$this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName($this->_tbl_key) .
' = ' .
$this->_db->quote($this->$k));
$this->_db->setQuery($query);
Documentation generated on Tue, 19 Nov 2013 15:12:53 +0100 by phpDocumentor 1.4.3