From fba8d13fdbc02285cc424822f2ef968d56123b8e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 25 Jul 2014 09:16:22 +0000 Subject: [PATCH] * Admin: restore from admin was not working (worked only from setup) --- admin/inc/class.admin_db_backup.inc.php | 4 +++- phpgwapi/inc/class.db_backup.inc.php | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/admin/inc/class.admin_db_backup.inc.php b/admin/inc/class.admin_db_backup.inc.php index 47f13c71ff..c2e57f5f52 100644 --- a/admin/inc/class.admin_db_backup.inc.php +++ b/admin/inc/class.admin_db_backup.inc.php @@ -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(); } } diff --git a/phpgwapi/inc/class.db_backup.inc.php b/phpgwapi/inc/class.db_backup.inc.php index 58a61d064a..e17bfdd8e6 100644 --- a/phpgwapi/inc/class.db_backup.inc.php +++ b/phpgwapi/inc/class.db_backup.inc.php @@ -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',