Database class integration.
This commit is contained in:
parent
ccfce8ee1f
commit
12d7ceb397
|
|
@ -28,12 +28,10 @@
|
||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
|
|
||||||
//add the access control list to the database
|
//add the access control list to the database
|
||||||
$sql = "select count(*) as num_rows from v_access_controls ";
|
$sql = "select count(*) from v_access_controls ";
|
||||||
$prep_statement = $db->prepare($sql);
|
$database = new database;
|
||||||
if ($prep_statement) {
|
$num_rows = $database->select($sql, null, 'column');
|
||||||
$prep_statement->execute();
|
if ($num_rows == 0) {
|
||||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
|
||||||
if ($row['num_rows'] == 0) {
|
|
||||||
//set the directory
|
//set the directory
|
||||||
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
||||||
$xml_file = $xml_dir."/acl.conf.xml";
|
$xml_file = $xml_dir."/acl.conf.xml";
|
||||||
|
|
@ -69,21 +67,20 @@
|
||||||
|
|
||||||
//insert the name, description
|
//insert the name, description
|
||||||
$access_control_uuid = uuid();
|
$access_control_uuid = uuid();
|
||||||
$sql = "insert into v_access_controls ";
|
$array['access_controls'][0]['access_control_uuid'] = $access_control_uuid;
|
||||||
$sql .= "(";
|
$array['access_controls'][0]['access_control_name'] = $access_control_name;
|
||||||
$sql .= "access_control_uuid, ";
|
$array['access_controls'][0]['access_control_default'] = $access_control_default;
|
||||||
$sql .= "access_control_name, ";
|
|
||||||
$sql .= "access_control_default ";
|
$p = new permissions;
|
||||||
$sql .= ") ";
|
$p->add('access_control_add', 'temp');
|
||||||
$sql .= "values ";
|
|
||||||
$sql .= "( ";
|
$database = new database;
|
||||||
$sql .= "'".$access_control_uuid."', ";
|
$database->app_name = 'access_controls';
|
||||||
$sql .= "'".check_str($access_control_name)."', ";
|
$database->app_uuid = '1416a250-f6e1-4edc-91a6-5c9b883638fd';
|
||||||
$sql .= "'".check_str($access_control_default)."' ";
|
$database->save($array);
|
||||||
$sql .= ")";
|
unset($array);
|
||||||
//echo $sql."\n";
|
|
||||||
$db->exec(check_sql($sql));
|
$p->delete('access_control_add', 'temp');
|
||||||
unset($sql);
|
|
||||||
|
|
||||||
//normalize the array - needed because the array is inconsistent when there is only one row vs multiple
|
//normalize the array - needed because the array is inconsistent when there is only one row vs multiple
|
||||||
if (strlen($list['node']['@attributes']['type']) > 0) {
|
if (strlen($list['node']['@attributes']['type']) > 0) {
|
||||||
|
|
@ -104,26 +101,23 @@
|
||||||
}
|
}
|
||||||
//add the profile settings into the database
|
//add the profile settings into the database
|
||||||
$access_control_node_uuid = uuid();
|
$access_control_node_uuid = uuid();
|
||||||
$sql = "insert into v_access_control_nodes ";
|
$array['access_control_nodes'][0]['access_control_node_uuid'] = $access_control_node_uuid;
|
||||||
$sql .= "(";
|
$array['access_control_nodes'][0]['access_control_uuid'] = $access_control_uuid;
|
||||||
$sql .= "access_control_node_uuid, ";
|
$array['access_control_nodes'][0]['node_type'] = $node_type;
|
||||||
$sql .= "access_control_uuid, ";
|
$array['access_control_nodes'][0]['node_cidr'] = $node_cidr;
|
||||||
$sql .= "node_type, ";
|
$array['access_control_nodes'][0]['node_domain'] = $node_domain;
|
||||||
$sql .= "node_cidr, ";
|
$array['access_control_nodes'][0]['node_description'] = $node_description;
|
||||||
$sql .= "node_domain, ";
|
|
||||||
$sql .= "node_description ";
|
$p = new permissions;
|
||||||
$sql .= ") ";
|
$p->add('access_control_node_add', 'temp');
|
||||||
$sql .= "values ";
|
|
||||||
$sql .= "( ";
|
$database = new database;
|
||||||
$sql .= "'".$access_control_node_uuid."', ";
|
$database->app_name = 'access_controls';
|
||||||
$sql .= "'".$access_control_uuid."', ";
|
$database->app_uuid = '1416a250-f6e1-4edc-91a6-5c9b883638fd';
|
||||||
$sql .= "'".$node_type."', ";
|
$database->save($array);
|
||||||
$sql .= "'".$node_cidr."', ";
|
unset($array);
|
||||||
$sql .= "'".$node_domain."', ";
|
|
||||||
$sql .= "'".$node_description."' ";
|
$p->delete('access_control_node_add', 'temp');
|
||||||
$sql .= ")";
|
|
||||||
//echo $sql."\n";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($prep_statement);
|
unset($prep_statement);
|
||||||
|
|
@ -133,7 +127,7 @@
|
||||||
rename($xml_dir.'/acl.conf.xml', $xml_dir.'/acl.conf');
|
rename($xml_dir.'/acl.conf.xml', $xml_dir.'/acl.conf');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
unset($sql, $num_rows);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,24 +33,36 @@ if ($domains_processed == 1) {
|
||||||
$sql .= "from v_call_center_tiers as t, v_domains as d ";
|
$sql .= "from v_call_center_tiers as t, v_domains as d ";
|
||||||
$sql .= "where t.domain_uuid = d.domain_uuid ";
|
$sql .= "where t.domain_uuid = d.domain_uuid ";
|
||||||
$sql .= "and (t.call_center_queue_uuid is null or t.call_center_agent_uuid is null) ";
|
$sql .= "and (t.call_center_queue_uuid is null or t.call_center_agent_uuid is null) ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$database = new database;
|
||||||
$prep_statement->execute();
|
$tiers = $database->select($sql, null, 'all');
|
||||||
$tiers = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
if (is_array($tiers) && @sizeof($tiers) != 0) {
|
||||||
foreach ($tiers as &$row) {
|
foreach ($tiers as $index => &$row) {
|
||||||
if ($row['call_center_queue_uuid'] == null && $row['queue_uuid'] != null) {
|
if ($row['call_center_queue_uuid'] == null && $row['queue_uuid'] != null) {
|
||||||
$sql = "update v_call_center_tiers set call_center_queue_uuid = '".$row['queue_uuid']."' ";
|
$array['call_center_tiers'][$index]['call_center_queue_uuid'] = $row['queue_uuid'];
|
||||||
$sql .= "where call_center_tier_uuid = '".$row['call_center_tier_uuid']."' ";
|
}
|
||||||
$db->exec(check_sql($sql));
|
if ($row['call_center_agent_uuid'] == null && $row['agent_uuid'] != null) {
|
||||||
unset($sql);
|
$array['call_center_tiers'][$index]['call_center_agent_uuid'] = $row['agent_uuid'];
|
||||||
|
}
|
||||||
|
if (is_array($array['call_center_tiers'][$index]) && @sizeof($array['call_center_tiers'][$index]) != 0) {
|
||||||
|
$array['call_center_tiers'][$index]['call_center_tier_uuid'] = $row['call_center_tier_uuid'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['call_center_agent_uuid'] == null && $row['agent_uuid'] != null) {
|
if (is_array($array) && @sizeof($array) != 0) {
|
||||||
$sql = "update v_call_center_tiers set call_center_agent_uuid = '".$row['agent_uuid']."' ";
|
$p = new permissions;
|
||||||
$sql .= "where call_center_tier_uuid = '".$row['call_center_tier_uuid']."' ";
|
$p->add('call_center_tier_edit', 'temp');
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
|
$database = new database;
|
||||||
|
$database->app_name = 'call_centers';
|
||||||
|
$database->app_uuid = '95788e50-9500-079e-2807-fd530b0ea370';
|
||||||
|
$database->save($array);
|
||||||
|
$response = $database->message;
|
||||||
|
unset($array);
|
||||||
|
|
||||||
|
$p->delete('call_center_tier_edit', 'temp');
|
||||||
|
}
|
||||||
|
}
|
||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,10 @@
|
||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
|
|
||||||
//add the conference controls list to the database
|
//add the conference controls list to the database
|
||||||
$sql = "select count(*) as num_rows from v_conference_controls; ";
|
$sql = "select count(*) from v_conference_controls; ";
|
||||||
$prep_statement = $db->prepare($sql);
|
$database = new database;
|
||||||
if ($prep_statement) {
|
$num_rows = $database->select($sql, null, 'column');
|
||||||
$prep_statement->execute();
|
if ($num_rows == 0) {
|
||||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
|
||||||
if ($row['num_rows'] == 0) {
|
|
||||||
|
|
||||||
//set the directory
|
//set the directory
|
||||||
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
||||||
|
|
@ -64,23 +62,20 @@
|
||||||
|
|
||||||
//insert the data into the database
|
//insert the data into the database
|
||||||
$conference_control_uuid = uuid();
|
$conference_control_uuid = uuid();
|
||||||
$sql = "insert into v_conference_controls ";
|
$array['conference_controls'][0]['conference_control_uuid'] = $conference_control_uuid;
|
||||||
$sql .= "(";
|
$array['conference_controls'][0]['control_name'] = $control_name;
|
||||||
//$sql .= "domain_uuid, ";
|
$array['conference_controls'][0]['control_enabled'] = 'true';
|
||||||
$sql .= "conference_control_uuid, ";
|
|
||||||
$sql .= "control_name, ";
|
$p = new permissions;
|
||||||
$sql .= "control_enabled ";
|
$p->add('conference_control_add', 'temp');
|
||||||
$sql .= ") ";
|
|
||||||
$sql .= "values ";
|
$database = new database;
|
||||||
$sql .= "( ";
|
$database->app_name = 'conference_controls';
|
||||||
//$sql .= "'".$domain_uuid."', ";
|
$database->app_uuid = 'e1ad84a2-79e1-450c-a5b1-7507a043e048';
|
||||||
$sql .= "'".$conference_control_uuid."', ";
|
$database->save($array);
|
||||||
$sql .= "'".check_str($control_name)."', ";
|
unset($array);
|
||||||
$sql .= "'true' ";
|
|
||||||
$sql .= ");";
|
$p->delete('conference_control_add', 'temp');
|
||||||
//echo $sql."\n";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
|
|
||||||
//insert the profile params
|
//insert the profile params
|
||||||
foreach ($row['control'] as $p) {
|
foreach ($row['control'] as $p) {
|
||||||
|
|
@ -94,37 +89,32 @@
|
||||||
|
|
||||||
//add the coference profile params
|
//add the coference profile params
|
||||||
$conference_control_detail_uuid = uuid();
|
$conference_control_detail_uuid = uuid();
|
||||||
$sql = "insert into v_conference_control_details ";
|
$array['conference_contro_details'][0]['conference_control_uuid'] = $conference_control_uuid;
|
||||||
$sql .= "(";
|
$array['conference_contro_details'][0]['conference_control_detail_uuid'] = $conference_control_detail_uuid;
|
||||||
$sql .= "conference_control_uuid, ";
|
$array['conference_contro_details'][0]['control_digits'] = $control_digits;
|
||||||
$sql .= "conference_control_detail_uuid, ";
|
$array['conference_contro_details'][0]['control_action'] = $control_action;
|
||||||
$sql .= "control_digits, ";
|
|
||||||
$sql .= "control_action, ";
|
|
||||||
if (strlen($control_data) > 0) {
|
if (strlen($control_data) > 0) {
|
||||||
$sql .= "control_data, ";
|
$array['conference_contro_details'][0]['control_data'] = $control_data;
|
||||||
}
|
}
|
||||||
$sql .= "control_enabled ";
|
$array['conference_contro_details'][0]['control_enabled'] = $control_enabled;
|
||||||
$sql .= ") ";
|
|
||||||
$sql .= "values ";
|
$p = new permissions;
|
||||||
$sql .= "( ";
|
$p->add('conference_contro_detail_add', 'temp');
|
||||||
$sql .= "'".$conference_control_uuid."', ";
|
|
||||||
$sql .= "'".$conference_control_detail_uuid."', ";
|
$database = new database;
|
||||||
$sql .= "'".$control_digits."', ";
|
$database->app_name = 'conference_controls';
|
||||||
$sql .= "'".$control_action."', ";
|
$database->app_uuid = 'e1ad84a2-79e1-450c-a5b1-7507a043e048';
|
||||||
if (strlen($control_data) > 0) {
|
$database->save($array);
|
||||||
$sql .= "'".$control_data."', ";
|
unset($array);
|
||||||
}
|
|
||||||
$sql .= "'".$control_enabled."' ";
|
$p->delete('conference_contro_detail_add', 'temp');
|
||||||
$sql .= ");";
|
|
||||||
//echo $sql."\n";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //if num_rows
|
}
|
||||||
} //if prep_statement
|
unset($sql, $num_rows);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,10 @@
|
||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
|
|
||||||
//add the music_on_hold list to the database
|
//add the music_on_hold list to the database
|
||||||
$sql = "select count(*) as num_rows from v_conference_profiles; ";
|
$sql = "select count(*) from v_conference_profiles; ";
|
||||||
$prep_statement = $db->prepare($sql);
|
$database = new database;
|
||||||
if ($prep_statement) {
|
$num_rows = $database->select($sql, null, 'column');
|
||||||
$prep_statement->execute();
|
if ($num_rows == 0) {
|
||||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
|
||||||
if ($row['num_rows'] == 0) {
|
|
||||||
|
|
||||||
//set the directory
|
//set the directory
|
||||||
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
||||||
|
|
@ -64,23 +62,20 @@
|
||||||
|
|
||||||
//insert the data into the database
|
//insert the data into the database
|
||||||
$conference_profile_uuid = uuid();
|
$conference_profile_uuid = uuid();
|
||||||
$sql = "insert into v_conference_profiles ";
|
$array['conference_profiles'][0]['conference_profile_uuid'] = $conference_profile_uuid;
|
||||||
$sql .= "(";
|
$array['conference_profiles'][0]['profile_name'] = $profile_name;
|
||||||
//$sql .= "domain_uuid, ";
|
$array['conference_profiles'][0]['profile_enabled'] = 'true';
|
||||||
$sql .= "conference_profile_uuid, ";
|
|
||||||
$sql .= "profile_name, ";
|
$p = new permissions;
|
||||||
$sql .= "profile_enabled ";
|
$p->add('conference_profile_add', 'temp');
|
||||||
$sql .= ") ";
|
|
||||||
$sql .= "values ";
|
$database = new database;
|
||||||
$sql .= "( ";
|
$database->app_name = 'conference_profiles';
|
||||||
//$sql .= "'".$domain_uuid."', ";
|
$database->app_uuid = 'c33e2c2a-847f-44c1-8c0d-310df5d65ba9';
|
||||||
$sql .= "'".$conference_profile_uuid."', ";
|
$database->save($array);
|
||||||
$sql .= "'".check_str($profile_name)."', ";
|
unset($array);
|
||||||
$sql .= "'true' ";
|
|
||||||
$sql .= ");";
|
$p->delete('conference_profile_add', 'temp');
|
||||||
//echo $sql."\n";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
|
|
||||||
//insert the profile params
|
//insert the profile params
|
||||||
foreach ($row['param'] as $p) {
|
foreach ($row['param'] as $p) {
|
||||||
|
|
@ -92,31 +87,28 @@
|
||||||
|
|
||||||
//add the coference profile params
|
//add the coference profile params
|
||||||
$conference_profile_param_uuid = uuid();
|
$conference_profile_param_uuid = uuid();
|
||||||
$sql = "insert into v_conference_profile_params ";
|
$array['conference_profile_params'][0]['conference_profile_uuid'] = $conference_profile_uuid;
|
||||||
$sql .= "(";
|
$array['conference_profile_params'][0]['conference_profile_param_uuid'] = $conference_profile_param_uuid;
|
||||||
$sql .= "conference_profile_uuid, ";
|
$array['conference_profile_params'][0]['profile_param_name'] = $profile_param_name;
|
||||||
$sql .= "conference_profile_param_uuid, ";
|
$array['conference_profile_params'][0]['profile_param_value'] = $profile_param_value;
|
||||||
$sql .= "profile_param_name, ";
|
$array['conference_profile_params'][0]['profile_param_enabled'] = $profile_param_enabled;
|
||||||
$sql .= "profile_param_value, ";
|
|
||||||
$sql .= "profile_param_enabled ";
|
$p = new permissions;
|
||||||
$sql .= ") ";
|
$p->add('conference_profile_param_add', 'temp');
|
||||||
$sql .= "values ";
|
|
||||||
$sql .= "( ";
|
$database = new database;
|
||||||
$sql .= "'".$conference_profile_uuid."', ";
|
$database->app_name = 'conference_profiles';
|
||||||
$sql .= "'".$conference_profile_param_uuid."', ";
|
$database->app_uuid = 'c33e2c2a-847f-44c1-8c0d-310df5d65ba9';
|
||||||
$sql .= "'".$profile_param_name."', ";
|
$database->save($array);
|
||||||
$sql .= "'".$profile_param_value."', ";
|
unset($array);
|
||||||
$sql .= "'".$profile_param_enabled."' ";
|
|
||||||
$sql .= ");";
|
$p->delete('conference_profile_param_add', 'temp');
|
||||||
//echo $sql."\n";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //if num_rows
|
}
|
||||||
} //if prep_statement
|
unset($sql, $num_rows);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ if ($domains_processed == 1) {
|
||||||
$sql = "update v_dialplan_details ";
|
$sql = "update v_dialplan_details ";
|
||||||
$sql .= "set dialplan_detail_data = replace(dialplan_detail_data, '-','@') ";
|
$sql .= "set dialplan_detail_data = replace(dialplan_detail_data, '-','@') ";
|
||||||
$sql .= "where dialplan_detail_type = 'conference' and dialplan_detail_data like '%-%';";
|
$sql .= "where dialplan_detail_type = 'conference' and dialplan_detail_data like '%-%';";
|
||||||
//echo $sql."\n";
|
$database = new database;
|
||||||
$db->exec($sql);
|
$database->execute($sql);
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue