From 407570090d281a8462b4a24391d6968775c63ac3 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 5 Apr 2012 07:05:22 +0000 Subject: [PATCH] store already read table-defintions no longer in session (in ['egw_info']['apps'][]['table_defs']) but in a static variable only within the request: --> keeps session smaller --> php file with table-defintion get stored by accelerator anyway, so nothing to gain --> if schema get's updated long running sessions like CalDAV not getting fatal errors --- phpgwapi/inc/class.egw_db.inc.php | 32 +++++++++++++------------------ 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index 8ed45bfa59..9ba54c6527 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -1627,7 +1627,7 @@ class egw_db /** * reads the table-definitions from the app's setup/tables_current.inc.php file * - * The already read table-definitions are shared between all db-instances via $GLOBALS['egw_info']['apps'][$app]['table_defs'] + * The already read table-definitions are shared between all db-instances via a static var. * * @author RalfBeckeroutdoor-training.de * @@ -1638,13 +1638,14 @@ class egw_db */ function get_table_definitions($app=False,$table=False) { - if ($app === true && $table && isset($GLOBALS['egw_info']['apps'])) + static $all_app_data; + if ($app === true && $table && isset($all_app_data)) { - foreach($GLOBALS['egw_info']['apps'] as $app => &$app_data) + foreach($all_app_data as $app => &$app_data) { - if (isset($app_data['table_defs'][$table])) + if (isset($app_data[$table])) { - return $app_data['table_defs'][$table]; + return $app_data[$table]; } } $app = false; @@ -1653,33 +1654,26 @@ class egw_db { $app = $this->app ? $this->app : $GLOBALS['egw_info']['flags']['currentapp']; } - if (isset($GLOBALS['egw_info']['apps'])) // dont set it, if it does not exist!!! - { - $this->app_data = &$GLOBALS['egw_info']['apps'][$app]; - } - // this happens during the eGW startup or in setup - else - { - $this->app_data =& $this->all_app_data[$app]; - } - if (!isset($this->app_data['table_defs'])) + $app_data =& $all_app_data[$app]; + + if (!isset($app_data)) { $tables_current = EGW_INCLUDE_ROOT . "/$app/setup/tables_current.inc.php"; if (!@file_exists($tables_current)) { - return $this->app_data['table_defs'] = False; + return $app_data = False; } include($tables_current); - $this->app_data['table_defs'] =& $phpgw_baseline; + $app_data =& $phpgw_baseline; unset($phpgw_baseline); } - if ($table && (!$this->app_data['table_defs'] || !isset($this->app_data['table_defs'][$table]))) + if ($table && (!$app_data || !isset($app_data[$table]))) { if ($this->Debug) echo "

!!!get_table_definitions($app,$table) failed!!!

\n"; return False; } if ($this->Debug) echo "

get_table_definitions($app,$table) succeeded

\n"; - return $table ? $this->app_data['table_defs'][$table] : $this->app_data['table_defs']; + return $table ? $app_data[$table] : $app_data; } /**