Change 'do' to 'action' and update options.
Options: upgrade_source, upgrade_schema, app_defaults, menu_defaults, permission_defaults
This commit is contained in:
+22
-20
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
Portions created by the Initial Developer are Copyright (C) 2008-2022
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -54,10 +54,11 @@
|
|||||||
//process the http post
|
//process the http post
|
||||||
if (sizeof($_POST) > 0) {
|
if (sizeof($_POST) > 0) {
|
||||||
|
|
||||||
$do = $_POST['do'];
|
//get the action options: source, schema, app_defaults, menu_defaults, permisisons
|
||||||
|
$action = $_POST['action'];
|
||||||
|
|
||||||
// run source update
|
//run source update
|
||||||
if ($do["source"] && permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx")) {
|
if ($action["upgrade_source"] && permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx")) {
|
||||||
$cwd = getcwd();
|
$cwd = getcwd();
|
||||||
chdir($_SERVER["PROJECT_ROOT"]);
|
chdir($_SERVER["PROJECT_ROOT"]);
|
||||||
exec("git pull 2>&1", $response_source_update);
|
exec("git pull 2>&1", $response_source_update);
|
||||||
@@ -84,27 +85,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load an array of the database schema and compare it with the active database
|
//load an array of the database schema and compare it with the active database
|
||||||
if ($do["schema"] && permission_exists("upgrade_schema")) {
|
if ($action["upgrade_schema"] && permission_exists("upgrade_schema")) {
|
||||||
require_once "resources/classes/schema.php";
|
require_once "resources/classes/schema.php";
|
||||||
$obj = new schema();
|
$obj = new schema();
|
||||||
if (isset($do["data_types"]) && $do["data_types"] == 'true') {
|
if (isset($action["data_types"]) && $action["data_types"] == 'true') {
|
||||||
$obj->data_types = true;
|
$obj->data_types = true;
|
||||||
}
|
}
|
||||||
$_SESSION["response"]["schema"] = $obj->schema("html");
|
$_SESSION["response"]["schema"] = $obj->schema("html");
|
||||||
message::add($text['message-upgrade_schema'], null, $message_timeout);
|
message::add($text['message-upgrade_schema'], null, $message_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// process the apps defaults
|
//process the apps defaults
|
||||||
if ($do["apps"] && permission_exists("upgrade_apps")) {
|
if ($action["app_defaults"] && permission_exists("upgrade_apps")) {
|
||||||
require_once "resources/classes/domains.php";
|
require_once "resources/classes/domains.php";
|
||||||
$domain = new domains;
|
$domain = new domains;
|
||||||
$domain->upgrade();
|
$domain->upgrade();
|
||||||
message::add($text['message-upgrade_apps'], null, $message_timeout);
|
message::add($text['message-upgrade_apps'], null, $message_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore defaults of the selected menu
|
//restore defaults of the selected menu
|
||||||
if ($do["menu"] && permission_exists("menu_restore")) {
|
if ($action["menu_defaults"] && permission_exists("menu_restore")) {
|
||||||
$sel_menu = explode('|', check_str($_POST["sel_menu"]));
|
$sel_menu = explode('|', check_str($_POST["sel_menu"]));
|
||||||
$menu_uuid = $sel_menu[0];
|
$menu_uuid = $sel_menu[0];
|
||||||
$menu_language = $sel_menu[1];
|
$menu_language = $sel_menu[1];
|
||||||
@@ -114,13 +115,14 @@
|
|||||||
message::add($text['message-upgrade_menu'], null, $message_timeout);
|
message::add($text['message-upgrade_menu'], null, $message_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore default permissions
|
//restore default permissions
|
||||||
if ($do["permissions"] && permission_exists("group_edit")) {
|
if ($action["permission_defaults"] && permission_exists("group_edit")) {
|
||||||
$included = true;
|
$included = true;
|
||||||
require_once("core/groups/permissions_default.php");
|
require_once("core/groups/permissions_default.php");
|
||||||
message::add($text['message-upgrade_permissions'], null, $message_timeout);
|
message::add($text['message-upgrade_permissions'], null, $message_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//redirect the browser
|
||||||
header("Location: ".PROJECT_PATH."/core/upgrade/index.php");
|
header("Location: ".PROJECT_PATH."/core/upgrade/index.php");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@@ -158,7 +160,7 @@
|
|||||||
echo " ".$text['label-upgrade_source'];
|
echo " ".$text['label-upgrade_source'];
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
||||||
echo " <input type='checkbox' name='do[source]' id='do_source' value='1'> ".$text['description-upgrade_source']."<br />\n";
|
echo " <input type='checkbox' name='action[upgrade_source]' id='do_source' value='1'> ".$text['description-upgrade_source']."<br />\n";
|
||||||
|
|
||||||
// show current git version info
|
// show current git version info
|
||||||
chdir($_SERVER["PROJECT_ROOT"]);
|
chdir($_SERVER["PROJECT_ROOT"]);
|
||||||
@@ -188,7 +190,7 @@
|
|||||||
echo " ".$text['label-upgrade_schema'];
|
echo " ".$text['label-upgrade_schema'];
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
||||||
echo " <input type='checkbox' name='do[schema]' id='do_schema' value='1' onchange=\"$('#do_data_types').prop('checked', false); $('#tr_data_types').slideToggle('fast');\"> ".$text['description-upgrade_schema']."\n";
|
echo " <input type='checkbox' name='action[upgrade_schema]' id='do_schema' value='1' onchange=\"$('#do_data_types').prop('checked', false); $('#tr_data_types').slideToggle('fast');\"> ".$text['description-upgrade_schema']."\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
@@ -201,7 +203,7 @@
|
|||||||
echo " ".$text['label-upgrade_data_types'];
|
echo " ".$text['label-upgrade_data_types'];
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
||||||
echo " <input type='checkbox' name='do[data_types]' id='do_data_types' value='true'> ".$text['description-upgrade_data_types']."\n";
|
echo " <input type='checkbox' name='action[data_types]' id='do_data_types' value='true'> ".$text['description-upgrade_data_types']."\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
@@ -216,7 +218,7 @@
|
|||||||
echo " ".$text['label-upgrade_apps'];
|
echo " ".$text['label-upgrade_apps'];
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
||||||
echo " <input type='checkbox' name='do[apps]' id='do_apps' value='1'> ".$text['description-upgrade_apps']."\n";
|
echo " <input type='checkbox' name='action[app_defaults]' id='do_apps' value='1'> ".$text['description-upgrade_apps']."\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
@@ -230,7 +232,7 @@
|
|||||||
echo " ".$text['label-upgrade_menu'];
|
echo " ".$text['label-upgrade_menu'];
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
||||||
echo "<input type='checkbox' name='do[menu]' id='do_menu' value='1' onchange=\"$('#sel_menu').fadeToggle('fast');\">";
|
echo "<input type='checkbox' name='action[menu_defaults]' id='do_menu' value='1' onchange=\"$('#sel_menu').fadeToggle('fast');\">";
|
||||||
echo "<select name='sel_menu' id='sel_menu' class='formfld' style='display: none; vertical-align: middle; margin-left: 5px;'>";
|
echo "<select name='sel_menu' id='sel_menu' class='formfld' style='display: none; vertical-align: middle; margin-left: 5px;'>";
|
||||||
$sql = "select * from v_menus ";
|
$sql = "select * from v_menus ";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
@@ -256,7 +258,7 @@
|
|||||||
echo " ".$text['label-upgrade_permissions'];
|
echo " ".$text['label-upgrade_permissions'];
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
||||||
echo " <input type='checkbox' name='do[permissions]' id='do_permissions' value='1'> ".$text['description-upgrade_permissions']."\n";
|
echo " <input type='checkbox' name='action[permission_defaults]' id='do_permissions' value='1'> ".$text['description-upgrade_permissions']."\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user