Fix that code that writes the gateway xml to the file system so that it will use the gateway uuid for the filename and gateway name. Benefit of using the XML is that it is a major step closer to renaming tenants, or changing the gateway name without hurting the outbound routes.
This commit is contained in:
parent
91d489b8b2
commit
4f8ab969d9
|
|
@ -1725,25 +1725,16 @@ function save_gateway_xml() {
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||||
foreach ($result as &$row) {
|
foreach ($result as &$row) {
|
||||||
if ($row['enabled'] != "false") {
|
if ($row['enabled'] != "false") {
|
||||||
//remove invalid characters from the file names
|
|
||||||
$gateway = $row['gateway'];
|
|
||||||
$gateway = str_replace(" ", "_", $gateway);
|
|
||||||
$gateway = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $gateway);
|
|
||||||
//set the default profile as external
|
//set the default profile as external
|
||||||
$profile = $row['profile'];
|
$profile = $row['profile'];
|
||||||
if (strlen($profile) == 0) {
|
if (strlen($profile) == 0) {
|
||||||
$profile = "external";
|
$profile = "external";
|
||||||
}
|
}
|
||||||
if (count($_SESSION["domains"]) > 1) {
|
//open the xml file
|
||||||
$fout = fopen($_SESSION['switch']['gateways']['dir']."/".$profile."/v_".$_SESSION['domain_name'].'-'.$gateway.".xml","w");
|
$fout = fopen($_SESSION['switch']['gateways']['dir']."/".$profile."/v_".$row['gateway_uuid'].".xml","w");
|
||||||
|
//build the xml
|
||||||
$xml .= "<include>\n";
|
$xml .= "<include>\n";
|
||||||
$xml .= " <gateway name=\"". $_SESSION['domain_name'] .'-'. $gateway . "\">\n";
|
$xml .= " <gateway name=\"" . $row['gateway_uuid'] . "\">\n";
|
||||||
}
|
|
||||||
else {
|
|
||||||
$fout = fopen($_SESSION['switch']['gateways']['dir']."/".$profile."/v_".$gateway.".xml","w");
|
|
||||||
$xml .= "<include>\n";
|
|
||||||
$xml .= " <gateway name=\"" . $gateway . "\">\n";
|
|
||||||
}
|
|
||||||
if (strlen($row['username']) > 0) {
|
if (strlen($row['username']) > 0) {
|
||||||
$xml .= " <param name=\"username\" value=\"" . $row['username'] . "\"/>\n";
|
$xml .= " <param name=\"username\" value=\"" . $row['username'] . "\"/>\n";
|
||||||
}
|
}
|
||||||
|
|
@ -1832,6 +1823,7 @@ function save_gateway_xml() {
|
||||||
$xml .= " </gateway>\n";
|
$xml .= " </gateway>\n";
|
||||||
$xml .= "</include>";
|
$xml .= "</include>";
|
||||||
|
|
||||||
|
//write the xml
|
||||||
fwrite($fout, $xml);
|
fwrite($fout, $xml);
|
||||||
unset($xml);
|
unset($xml);
|
||||||
fclose($fout);
|
fclose($fout);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue