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)
@ -298,8 +305,11 @@
{ {
global $phpgw_info, $phpgw, $PHP_SELF; global $phpgw_info, $phpgw, $PHP_SELF;
$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

@ -1396,17 +1396,27 @@
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre24'; $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre24';
} }
$test[] = '0.9.10pre24'; $test[] = '0.9.10pre24';
function upgrade0_9_10pre24() function upgrade0_9_10pre24()
{ {
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)){

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

@ -1,15 +1,15 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare * * phpGroupWare *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the * * under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $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';