* Admin: restore from admin was not working (worked only from setup)

This commit is contained in:
Ralf Becker 2014-07-25 09:16:22 +00:00
parent b68cb6e5c0
commit fba8d13fdb
2 changed files with 7 additions and 5 deletions

View File

@ -23,7 +23,7 @@ class admin_db_backup
{
$this->db_backup = new db_backup();
if ($f = $this->db_backup->fopen_backup())
if (($f = $this->db_backup->fopen_backup()))
{
$this->db_backup->backup($f);
if(is_resource($f))
@ -41,9 +41,11 @@ class admin_db_backup
$tpl_root = EGW_SERVER_ROOT.'/setup/templates/default';
$self = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'admin.admin_db_backup.index'));
translation::add_app('setup');
egw_framework::csp_script_src_attrs('unsafe-inline');
include EGW_SERVER_ROOT.'/setup/db_backup.php';
unset($tpl_root, $self);
common::egw_footer();
}
}

View File

@ -149,7 +149,7 @@ class db_backup
}
else // called from eGW
{
$this->schema_proc = CreateObject('phpgwapi.schema_proc');
$this->schema_proc = new schema_proc();
if (!($this->backup_dir = $GLOBALS['egw_info']['server']['backup_dir']))
{
$this->backup_dir = $GLOBALS['egw_info']['server']['files_dir'].'/db_backup';
@ -437,7 +437,7 @@ class db_backup
@ini_set('mbstring.internal_encoding',$charset);
// check if we really need to convert the charset, as it's not perfect and can do some damage
if ($convert_to_system_charset && !strcasecmp($convert_to_system_charset,$charset))
if ($convert_to_system_charset && !strcasecmp($this->schema_proc->system_charset, $charset))
{
$convert_to_system_charset = false; // no conversation necessary
}
@ -567,8 +567,8 @@ class db_backup
if ($convert_to_system_charset) // store the changed charset
{
$this->db->insert($GLOBALS['egw_setup']->config_table,array(
'config_value' => $GLOBALS['egw_setup']->system_charset,
$this->db->insert(config::TABLE, array(
'config_value' => $this->schema_proc->system_charset,
),array(
'config_app' => 'phpgwapi',
'config_name' => 'system_charset',