From 0d458c8119a7ef1fe57bfbff973043b740fca29b Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 17 Feb 2014 16:16:44 +0000 Subject: [PATCH] disable transaction for mysql for restore, as a failure during restore may lead to an empty database, as drop table is not transactional for mysql --- phpgwapi/inc/class.db_backup.inc.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.db_backup.inc.php b/phpgwapi/inc/class.db_backup.inc.php index 2e55469562..0821ae79c1 100644 --- a/phpgwapi/inc/class.db_backup.inc.php +++ b/phpgwapi/inc/class.db_backup.inc.php @@ -359,7 +359,7 @@ class db_backup $system_config[] = $row; } } - $this->db->transaction_begin(); + if (substr($this->db->Type,0,5) != 'mysql') $this->db->transaction_begin(); // drop all existing tables foreach($this->adodb->MetaTables('TABLES') as $table) @@ -616,9 +616,12 @@ class db_backup unlink($name); rmdir($dir.'/database_backup'); } - if (!$this->db->transaction_commit()) + if (substr($this->db->Type,0,5) != 'mysql') { - return lang('Restore failed'); + if (!$this->db->transaction_commit()) + { + return lang('Restore failed'); + } } // flush instance cache egw_cache::flush(egw_cache::INSTANCE); @@ -1026,4 +1029,4 @@ echo "

line='$line'

\n"; $fields = db_backup::csv_split($line); echo "
".print_r($fields,true)."
\n"; //echo count($fields)." fields\n"; -*/ \ No newline at end of file +*/