From 94d797b4b7eee35a81419fb5d7d77a89c7af1e73 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 28 Aug 2019 11:33:02 +0200 Subject: [PATCH 1/2] Fixed session garbage collector --- pandora_console/include/load_session.php | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/load_session.php b/pandora_console/include/load_session.php index 8b243d808a..80fb8643ef 100644 --- a/pandora_console/include/load_session.php +++ b/pandora_console/include/load_session.php @@ -159,7 +159,26 @@ function pandora_session_gc($max_lifetime=300) global $config; if (isset($config['session_timeout'])) { - $max_lifetime = $config['session_timeout']; + $session_timeout = $config['session_timeout']; + } else { + // if $config doesn`t work ... + $session_timeout = db_get_value( + 'value', + 'tconfig', + 'token', + 'session_timeout' + ); + } + + if (!empty($session_timeout)) { + if ($session_timeout == -1) { + // The session expires in 10 years + $session_timeout = 315576000; + } else { + $session_timeout *= 60; + } + + $max_lifetime = $session_timeout; } $time_limit = (time() - $max_lifetime); @@ -171,6 +190,11 @@ function pandora_session_gc($max_lifetime=300) ] ); + // Deleting cron and empty sessions. + $sql = "DELETE FROM tsessions_php WHERE + data IS NULL OR id_session REGEXP '^cron-'"; + db_process_sql($sql); + return $retval; } From 5ad22620b91ed155395b5bd060bcf43c8eb53ce4 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 28 Aug 2019 12:49:41 +0200 Subject: [PATCH 2/2] mr power up --- pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 +- pandora_console/pandoradb_data.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 964441c6c1..704ab61d74 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1243,7 +1243,7 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned; INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 30); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 31); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index e36a1a6fbf..a02f88fe5f 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -109,7 +109,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_header', ''), ('custom_report_front_footer', ''), -('MR', 30), +('MR', 31), ('identification_reminder', 1), ('identification_reminder_timestamp', 0), ('current_package_enterprise', '738'),