Added session_dla field to phpgw_app_sessions to make sure things get cleaned up

This commit is contained in:
jengo 2001-03-31 08:11:41 +00:00
parent 50f0184e76
commit 609f855217
6 changed files with 64 additions and 31 deletions

View File

@ -185,11 +185,18 @@
{ {
global $phpgw_info, $phpgw; global $phpgw_info, $phpgw;
if (!isset($phpgw_info['server']['cron_apps']) || ! $phpgw_info['server']['cron_apps']) // If you plan on using the cron apps, please remove the following lines.
{ // I am going to make this a config option durring 0.9.11, instead of an application (jengo)
// if (! isset($phpgw_info['server']['cron_apps']) || ! $phpgw_info['server']['cron_apps'])
// {
$phpgw->db->query("delete from phpgw_sessions where session_dla <= '" . (time() - 7200) $phpgw->db->query("delete from phpgw_sessions where session_dla <= '" . (time() - 7200)
. "' and session_flags !='A'",__LINE__,__FILE__); . "' and session_flags !='A'",__LINE__,__FILE__);
}
// This is set a little higher, we don't want to kill session data for anonymous sessions.
$phpgw->db->query("delete from phpgw_app_sessions where session_dla <= '" . (time() - 86400)
. "'",__LINE__,__FILE__);
// }
} }
function create($login,$passwd) function create($login,$passwd)
@ -300,6 +307,9 @@
$phpgw->db->query("update phpgw_sessions set session_dla='" . time() . "', session_action='$PHP_SELF' " $phpgw->db->query("update phpgw_sessions set session_dla='" . time() . "', session_action='$PHP_SELF' "
. "where session_id='" . $this->sessionid."'",__LINE__,__FILE__); . "where session_id='" . $this->sessionid."'",__LINE__,__FILE__);
$phpgw->db->query("update phpgw_app_sessions set session_dla='" . time() . "' "
. "where sessionid='" . $this->sessionid."'",__LINE__,__FILE__);
} }
function destroy() function destroy()
@ -409,9 +419,9 @@
$data = serialize($data); $data = serialize($data);
$data = $phpgw->crypto->encrypt($data); $data = $phpgw->crypto->encrypt($data);
$phpgw->db->query("INSERT INTO phpgw_app_sessions (sessionid,loginid,app,location,content) " $phpgw->db->query("INSERT INTO phpgw_app_sessions (sessionid,loginid,app,location,content,session_dla) "
. "VALUES ('".$this->sessionid."','".$this->account_id."','".$appname . "VALUES ('".$this->sessionid."','".$this->account_id."','".$appname
. "','".$location."','".$data."')",__LINE__,__FILE__); . "','".$location."','".$data."','" . time() . "')",__LINE__,__FILE__);
} else { } else {
$data = $phpgw->crypto->encrypt(serialize($data)); $data = $phpgw->crypto->encrypt(serialize($data));
$phpgw->db->query("update phpgw_app_sessions set content = '".$data."'" $phpgw->db->query("update phpgw_app_sessions set content = '".$data."'"

View File

@ -78,7 +78,8 @@
loginid varchar(20), loginid varchar(20),
location varchar(255), location varchar(255),
app varchar(20), app varchar(20),
content text content text,
session_dla int
)"; )";
$phpgw_setup->db->query($sql); $phpgw_setup->db->query($sql);
@ -346,7 +347,7 @@
)"; )";
$phpgw_setup->db->query($sql); $phpgw_setup->db->query($sql);
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre25'; $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre26';
$phpgw_info['setup']['oldver']['phpgwapi'] = $phpgw_info['setup']['currentver']['phpgwapi']; $phpgw_info['setup']['oldver']['phpgwapi'] = $phpgw_info['setup']['currentver']['phpgwapi'];
update_version_table(); update_version_table();
// $phpgw_setup->update_version_table(); // $phpgw_setup->update_version_table();

View File

@ -1402,12 +1402,22 @@
global $phpgw_info, $phpgw_setup; global $phpgw_info, $phpgw_setup;
$sql = "alter table phpgw_categories add column cat_access char(7) after cat_owner"; $sql = "alter table phpgw_categories add column cat_access char(7) after cat_owner";
$phpgw_setup->db->query($sql,__LINE__,__FILE__); $phpgw_setup->db->query($sql,__LINE__,__FILE__);
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre25'; $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre25';
} }
$test[] = '0.9.10pre25';
function upgrade0_9_10pre25()
{
global $phpgw_info, $phpgw_setup;
$phpgw_setup->db->query("alter table phpgw_app_sessions add column session_dla int",__LINE__,__FILE__);
$phpgw_setup->db->query($sql);
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre26';
}
reset ($test); reset ($test);
while (list ($key, $value) = each ($test)){ while (list ($key, $value) = each ($test)){
if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) { if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) {

View File

@ -77,7 +77,8 @@
loginid varchar(20), loginid varchar(20),
location varchar(255), location varchar(255),
app varchar(20), app varchar(20),
content text content text,
session_dla int
)"; )";
$phpgw_setup->db->query($sql); $phpgw_setup->db->query($sql);
@ -314,7 +315,7 @@
)"; )";
$phpgw_setup->db->query($sql); $phpgw_setup->db->query($sql);
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre25'; $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre26';
$phpgw_info['setup']['oldver']['phpgwapi'] = $phpgw_info['setup']['currentver']['phpgwapi']; $phpgw_info['setup']['oldver']['phpgwapi'] = $phpgw_info['setup']['currentver']['phpgwapi'];
update_version_table(); update_version_table();
?> ?>

View File

@ -1785,6 +1785,17 @@
$phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.10pre25"; $phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.10pre25";
} }
$test[] = '0.9.10pre25';
function upgrade0_9_10pre25()
{
global $phpgw_info, $phpgw_setup;
$phpgw_setup->db->query("alter table phpgw_app_sessions add column session_dla int",__LINE__,__FILE__);
$phpgw_setup->db->query($sql);
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre26';
}
reset ($test); reset ($test);
while (list ($key, $value) = each ($test)){ while (list ($key, $value) = each ($test)){
if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) { if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) {

View File

@ -11,5 +11,5 @@
/* $Id$ */ /* $Id$ */
$phpgw_info["server"]["versions"]["phpgwapi"] = "0.9.10pre25"; $phpgw_info['server']['versions']['phpgwapi'] = '0.9.10pre26';
$phpgw_info["server"]["versions"]["current_header"] = "1.11"; $phpgw_info['server']['versions']['current_header'] = '1.11';