From: vincent@cubedesigners.com Date: Tue, 7 Jan 2020 17:34:14 +0000 (+0000) Subject: fix #3311 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=2263e3613a2122917fb62d200fe25043d7173a6e;p=cubeextranet.git fix #3311 @0.5 --- diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index dc1091798..a361fc867 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -1317,10 +1317,17 @@ class wsAjax extends cubeAjax { global $core; - $dao = new wsDAOBook($core->con); + // Do a backup of the book tables + $path = WS_FILES . '/cache/settingsbackups/books.' . time() . '.sql.gz'; + $username = DB_USER; + $database = DB_NAME; + $password = DB_PASSWORD; + $cmd = "mysqldump -u $username -p$password $database books | gzip > $path"; - new PHPExcel(); + `$cmd`; + new PHPExcel(); + $dao = new wsDAOBook($core->con); $reader = new PHPExcel_Reader_Excel2007(); $xls = $reader->load($_FILES['file']['tmp_name']); @@ -1346,11 +1353,11 @@ class wsAjax extends cubeAjax } $settings[$col] = $v; } - // $x->addDebug($id.' : '.json_encode($settings)); + // $x->addDebug($id.' : '.json_encode($settings)); try { $dao->setSettings($id, $settings); - }catch (Exception $e){ + } catch (Exception $e) { $x->addDebug($e->getMessage()); } }