API15

JTableSession/purge

From Joomla! Documentation

< API15:JTableSession
Revision as of 17:17, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Purge old sessions <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span>...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Purge old sessions

[Edit Descripton]

Template:Description:JTableSession/purge

Syntax[edit]

purge($maxLifetime=1440)
Parameter Name Default Value Description
$maxLifetime 1440 Session age in seconds

Returns[edit]

mixed Resource on success, null on fail

Defined in[edit]

libraries/joomla/database/table/session.php

Importing[edit]

jimport( 'joomla.database.table.session' );

Source Body[edit]

function purge( $maxLifetime = 1440 )
{
        $past = time() - $maxLifetime;
        $query = 'DELETE FROM '. $this->_tbl .' WHERE ( time < \''. (int) $past .'\' )'; // Index on 'VARCHAR'
        $this->_db->setQuery($query);

        return $this->_db->query();
}

[Edit See Also] Template:SeeAlso:JTableSession/purge

Examples[edit]

<CodeExamplesForm />