From 2ee9082f2e4ffffa2b930014b29b7e07ed2b058c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 25 Jun 2014 12:43:11 +0000 Subject: [PATCH] * PostgreSQL: fixed not working installation (access to not yet existing table stalls transaction) --- phpgwapi/inc/class.accounts_sql.inc.php | 9 +++++++-- phpgwapi/inc/class.egw_db.inc.php | 13 +++++++------ setup/inc/class.setup_process.inc.php | 18 ++++++++++-------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index 08da1b8bdd..794915e52e 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -230,7 +230,12 @@ class accounts_sql if ($data['account_id'] < 0 && class_exists('emailadmin_smtp_sql', isset($data['account_email']))) { try { - if (empty($data['account_email'])) + if (isset($GLOBALS['egw_info']['apps']) && !isset($GLOBALS['egw_info']['apps']['emailadmin']) || + isset($GLOBALS['egw_setup']) && !in_array(emailadmin_smtp_sql::TABLE, $this->db->table_names(true))) + { + // cant store email, if emailadmin not (yet) installed + } + elseif (empty($data['account_email'])) { $this->db->delete(emailadmin_smtp_sql::TABLE, array( 'account_id' => $data['account_id'], @@ -247,7 +252,7 @@ class accounts_sql ), __LINE__, __FILE__, emailadmin_smtp_sql::APP); } } - // ignore not (yet) existing mailaccounts table + // ignore not (yet) existing mailaccounts table (does NOT work in PostgreSQL, because of transaction!) catch (egw_exception_db $e) { unset($e); } diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index ef9f4f27c7..2aadd26135 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -1030,11 +1030,12 @@ class egw_db } /** - * Get a list of table names in the current database - * - * @return array list of the tables - */ - function table_names() + * Get a list of table names in the current database + * + * @param boolean $just_naem=false true return array of table-names, false return old format + * @return array list of the tables + */ + function table_names($just_name=false) { if (!$this->Link_ID) $this->connect(); if (!$this->Link_ID) @@ -1051,7 +1052,7 @@ class egw_db { $table = strtolower($table); } - $result[] = array( + $result[] = $just_name ? $table : array( 'table_name' => $table, 'tablespace_name' => $this->Database, 'database' => $this->Database diff --git a/setup/inc/class.setup_process.inc.php b/setup/inc/class.setup_process.inc.php index b794ba70c3..6a28e51038 100755 --- a/setup/inc/class.setup_process.inc.php +++ b/setup/inc/class.setup_process.inc.php @@ -45,14 +45,6 @@ class setup_process function init_process() { $GLOBALS['egw_setup']->oProc = new schema_proc(); - - // delete image-map, in case new apps get installed, or existing ones updated - try { - common::delete_image_map(); - } - catch(Exception $e) { - // ignore exception, as during a new install, there's no cache configured and therefore no need to unset - } } /** @@ -175,6 +167,16 @@ class setup_process $pass_string = implode (':', $pass); $passing_string = implode (':', $passing); } + try { + // flush instance cache + egw_cache::flush(egw_cache::INSTANCE); + // delete image-map, in case new apps get installed, or existing ones updated + common::delete_image_map(); + } + catch(Exception $e) { + unset($e); + // ignore exception, as during a new install, there's no cache configured and therefore no need to unset + } /* now return the list */ return $setup_info = array_merge($setup_info,$passed); }