From d4333c2a754fe4531cbce3fe1f616b2f6e41ffa4 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 25 Jun 2015 21:10:50 +0000 Subject: [PATCH] Add transaction support to dialplan import. --- app/dialplan/resources/classes/dialplan.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/dialplan/resources/classes/dialplan.php b/app/dialplan/resources/classes/dialplan.php index 922819efaf..5e27d2654f 100644 --- a/app/dialplan/resources/classes/dialplan.php +++ b/app/dialplan/resources/classes/dialplan.php @@ -252,6 +252,7 @@ include "root.php"; } public function import() { + global $db; if (strlen($this->xml) > 0) { //replace the variables $this->xml = str_replace("{v_context}", $this->default_context, $this->xml); @@ -283,6 +284,8 @@ include "root.php"; //dialplan entry already exists do nothing } else { + //start the transaction + $db->beginTransaction(); //get the attributes $this->dialplan_uuid = uuid(); $this->dialplan_name = $dialplan['extension']['@attributes']['name']; @@ -370,6 +373,8 @@ include "root.php"; $order = $order + 5; $x++; } + //end the transaction + $db->commit(); } }