mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Remove save_module_xml() function and move it it into the modules class as the xml method. Eventual goal move everything out of switch.php.
This commit is contained in:
@@ -378,52 +378,6 @@ function save_gateway_xml() {
|
||||
|
||||
}
|
||||
|
||||
function save_module_xml() {
|
||||
global $config, $domain_uuid;
|
||||
|
||||
//get the database connection
|
||||
require_once "resources/classes/database.php";
|
||||
$database = new database;
|
||||
$database->connect();
|
||||
$db = $database->db;
|
||||
|
||||
$xml = "";
|
||||
$xml .= "<configuration name=\"modules.conf\" description=\"Modules\">\n";
|
||||
$xml .= " <modules>\n";
|
||||
|
||||
$sql = "select * from v_modules ";
|
||||
$sql .= "order by module_order ASC, ";
|
||||
$sql .= "module_category ASC";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$prev_module_cat = '';
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach ($result as $row) {
|
||||
if ($prev_module_cat != $row['module_category']) {
|
||||
$xml .= "\n <!-- ".$row['module_category']." -->\n";
|
||||
}
|
||||
if ($row['module_enabled'] == "true"){
|
||||
$xml .= " <load module=\"".$row['module_name']."\"/>\n";
|
||||
}
|
||||
$prev_module_cat = $row['module_category'];
|
||||
}
|
||||
$xml .= "\n";
|
||||
$xml .= " </modules>\n";
|
||||
$xml .= "</configuration>";
|
||||
|
||||
$fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/modules.conf.xml","w");
|
||||
fwrite($fout, $xml);
|
||||
unset($xml);
|
||||
fclose($fout);
|
||||
|
||||
//apply settings
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//$cmd = "api reloadxml";
|
||||
//event_socket_request_cmd($cmd);
|
||||
//unset($cmd);
|
||||
}
|
||||
|
||||
function save_var_xml() {
|
||||
global $config, $domain_uuid;
|
||||
|
||||
@@ -1478,7 +1432,8 @@ if (!function_exists('save_switch_xml')) {
|
||||
save_setting_xml();
|
||||
}
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/modules/app_config.php")) {
|
||||
save_module_xml();
|
||||
$module new modules;;
|
||||
$module->xml();
|
||||
}
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/vars/app_config.php")) {
|
||||
save_var_xml();
|
||||
|
||||
Reference in New Issue
Block a user