Add beginTransaction and commit to speed up the install and upgrade.

This commit is contained in:
Mark Crane 2015-06-25 21:00:15 +00:00
parent 336a8d763d
commit c99e249f71
3 changed files with 6 additions and 22 deletions

View File

@ -70,7 +70,7 @@
$sql = "select dialplan_uuid, dialplan_name, dialplan_description from v_dialplans ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
echo $sql;
//echo $sql;
$prep_statement = $this->db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();

View File

@ -69,6 +69,7 @@
else {
$sip_profile_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/conf/sip_profiles/*.xml';
}
$db->beginTransaction();
$xml_files = glob($sip_profile_dir);
foreach ($xml_files as &$xml_file) {
//load the sip profile xml and save it into an array
@ -154,6 +155,7 @@
}
}
}
$db->commit();
//save the sip profile xml
save_sip_profile_xml();
@ -163,26 +165,6 @@
}
unset($prep_statement);
}
}
//if there is more than one domain then disable the force domains sip profile settings
if ($domains_processed == 1) {
if (count($_SESSION['domains']) > 1) {
//disable force domains
$sql = "update v_sip_profile_settings set ";
$sql .= "sip_profile_setting_enabled = 'false' ";
$sql .= "where sip_profile_setting_name = 'force-register-domain'";
$sql .= "or sip_profile_setting_name = 'force-subscription-domain'";
$sql .= "or sip_profile_setting_name = 'force-register-db-domain'";
$db->exec(check_sql($sql));
unset($sql);
//save the sip profile xml
save_sip_profile_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
}
}
//if empty, set sip_profile_enabled = true

View File

@ -1068,6 +1068,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
$x++;
$tmp[$x]['group_name'] = 'agent';
$tmp[$x]['group_description'] = 'Call Center Agent Group';
$db_tmp->beginTransaction();
foreach($tmp as $row) {
$sql = "insert into v_groups ";
$sql .= "(";
@ -1088,6 +1089,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
unset($sql);
}
unset($tmp);
$db_tmp->commit();
//add a user and then add the user to the superadmin group
//prepare the values
@ -1229,7 +1231,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
$sql .= "'$menu_description' ";
$sql .= ");";
if ($v_debug) {
fwrite($fp, $sql."\n");
fwrite($fp, $sql."\n");
}
$db->exec(check_sql($sql));
unset($sql);