diff --git a/phpgwapi/inc/class.db_backup.inc.php b/phpgwapi/inc/class.db_backup.inc.php index 423a650406..7e5fe02a22 100644 --- a/phpgwapi/inc/class.db_backup.inc.php +++ b/phpgwapi/inc/class.db_backup.inc.php @@ -479,11 +479,6 @@ class db_backup { $GLOBALS['egw_setup']->translation->setup_translation_sql(); } - $translation =& $GLOBALS['egw_setup']->translation->sql; - } - else - { - $translation =& $GLOBALS['egw']->translation; } } if ($table) // do we already reached the data part @@ -506,9 +501,9 @@ class db_backup { if ($convert_to_system_charset && !$this->db->capabilities['client_encoding']) { - $translation->convert($data,$charset); + $data = translation::convert($data,$charset); } - $this->db->insert($table,$data,False,__LINE__,__FILE__,'all-apps',true); + $this->db->insert($table,$data,False,__LINE__,__FILE__,true,true); } else { diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index 9ba54c6527..8428a147e1 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -1631,15 +1631,15 @@ class egw_db * * @author RalfBeckeroutdoor-training.de * - * @param bool/string $app name of the app or default False to use the app set by db::set_app or the current app, - * true to search the already loaded table-definitions for $table - * @param bool/string $table if set return only defintions of that table, else return all defintions + * @param bool|string $app name of the app or default False to use the app set by db::set_app or the current app, + * true to search the already loaded table-definitions for $table and then search all existing apps for it + * @param bool|string $table if set return only defintions of that table, else return all defintions * @return mixed array with table-defintions or False if file not found */ function get_table_definitions($app=False,$table=False) { - static $all_app_data; - if ($app === true && $table && isset($all_app_data)) + static $all_app_data = array(); + if ($app === true && $table) { foreach($all_app_data as $app => &$app_data) { @@ -1648,6 +1648,30 @@ class egw_db return $app_data[$table]; } } + // $table not found in loaded apps, check not yet loaded ones + foreach(scandir(EGW_INCLUDE_ROOT) as $app) + { + if ($app[0] == '.' || !is_dir(EGW_INCLUDE_ROOT.'/'.$app) || isset($all_app_data[$app])) + { + continue; + } + $tables_current = EGW_INCLUDE_ROOT . "/$app/setup/tables_current.inc.php"; + if (!@file_exists($tables_current)) + { + $all_app_data[$app] = False; + } + else + { + include($tables_current); + $all_app_data[$app] =& $phpgw_baseline; + unset($phpgw_baseline); + + if (isset($all_app_data[$app][$table])) + { + return $all_app_data[$app][$table]; + } + } + } $app = false; } if (!$app)