Skip to content

Commit 134da22

Browse files
committed
config: add support for flushing back to db
1 parent 529c50e commit 134da22

File tree

3 files changed

+37
-12
lines changed

3 files changed

+37
-12
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
#################
4+
# start flush #
5+
#################
6+
if ($action=="flush")
7+
{
8+
require("../../../common/mi_comm.php");
9+
$success = 0;
10+
$mi_connectors=get_all_proxys_by_assoc_id(get_settings_value('talk_to_this_assoc_id'));
11+
for ($i=0;$i<count($mi_connectors);$i++){
12+
13+
$message=mi_command("config_flush", NULL, $mi_connectors[$i], $errors);
14+
15+
if (empty($errors)) {
16+
$success++;
17+
} else {
18+
echo "<script>alert('ERROR: ".implode(",",$errors).");</script>";
19+
}
20+
echo "<br>";
21+
}
22+
23+
if ($success > 0)
24+
echo "<script>alert('Successfully flushed on $success servers');</script>";
25+
}
26+
#################
27+
# end flush #
28+
#################
29+
30+
?>

config/tools/system/config/settings.inc.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,4 @@
8181
"validation_regex" => "^[a-zA-Z][a-zA-Z0-9]*$",
8282
"tip" => "The column used for configuration entry description.",
8383
),
84-
"config_id" => array(
85-
"default" => "config",
86-
"name" => "Cacher Id",
87-
"type" => "text",
88-
"validation_regex" => "^[a-zA-Z][a-zA-Z0-9]*$",
89-
"tip" => "The name of the sql cacher id used in OpenSIPS configuration file.."
90-
),
9184
);

config/tools/system/config/tviewer.inc.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@
166166
$custom_config[$module_id][0]['reload'] = 1;
167167

168168
//if you need reload please specify the MI command to be ran
169-
$custom_config[$module_id][0]['custom_mi_command'] = "sql_cacher_reload";
170-
171-
if (get_settings_value("config_id") != NULL)
172-
$custom_config[$module_id][0]['custom_mi_command'] .= " " . get_settings_value("config_id");
173-
169+
$custom_config[$module_id][0]['custom_mi_command'] = "config_reload";
174170

175171
//the system ID to send the reload MI command to
176172
$talk_to_this_assoc_id = 1;
@@ -219,6 +215,12 @@
219215
"style" => "formButton",
220216
"action_script" => "custom_actions/add.php",
221217
"action_template" => "template/custom_templates/add.php"
218+
),
219+
"1" => array(
220+
"text" => "Flush in Database",
221+
"action" => "flush",
222+
"action_script" => "../../../../config/tools/system/config/flush.php",
223+
"style" => "formButton",
222224
)
223225
);
224226

0 commit comments

Comments
 (0)