fixed since r38811 not working restore of backups

This commit is contained in:
Ralf Becker 2012-04-12 13:25:27 +00:00
parent 15c9fd0d32
commit d85cffb5e8
2 changed files with 31 additions and 12 deletions

View File

@ -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
{

View File

@ -1631,15 +1631,15 @@ class egw_db
*
* @author RalfBecker<at>outdoor-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)