Added Switch upgrade as a separate option

This commit is contained in:
Matthew Vale 2015-12-01 14:32:58 +00:00
parent 82a31894d5
commit d0d3240fc4
4 changed files with 106 additions and 0 deletions

View File

@ -0,0 +1,59 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// set included, if not
if (!isset($included)) { $included = false; }
//check the permission
if(defined('STDIN')) {
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
preg_match("/^(.*)\/core\/.*$/", $document_root, $matches);
$document_root = $matches[1];
set_include_path($document_root);
require_once "resources/require.php";
$_SERVER["DOCUMENT_ROOT"] = $document_root;
$format = 'text'; //html, text
}
else if (!$included) {
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('upgrade_switch') || if_group("superadmin")) {
//echo "access granted";
}
else {
echo "access denied";
exit;
}
$format = 'html'; //html, text
}
//run switch upgrade
require_once "resources/classes/install_switch.php";
$switch = new install_switch;
$switch->upgrade();
?>

View File

@ -32,6 +32,9 @@
$apps[$x]['permissions'][$y]['menu']['uuid'] = "e7bb1296-3141-48c9-a95a-82d2768d0ae4";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "upgrade_switch";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
//schema details
$y = 0; //table array index

View File

@ -180,6 +180,16 @@ $text['label-upgrade_apps']['sv-se'] = "App Standard";
$text['label-upgrade_apps']['uk'] = "Типові значення додатків";
$text['label-upgrade_apps']['de-at'] = "Applikationen zurücksetzen";
$text['label-upgrade_switch']['en-us'] = "Switch Upgrade";
$text['label-upgrade_switch']['es-cl'] = "";
$text['label-upgrade_switch']['pt-pt'] = "";
$text['label-upgrade_switch']['fr-fr'] = "";
$text['label-upgrade_switch']['pt-br'] = "";
$text['label-upgrade_switch']['pl'] = "";
$text['label-upgrade_switch']['sv-se'] = "";
$text['label-upgrade_switch']['uk'] = "";
$text['label-upgrade_switch']['de-at'] = "";
$text['label-upgrade']['en-us'] = "Upgrade";
$text['label-upgrade']['es-cl'] = "Actualizar";
$text['label-upgrade']['pt-pt'] = "Actualizar";
@ -390,6 +400,16 @@ $text['description-upgrade_apps']['sv-se'] = "Återställer standardinställning
$text['description-upgrade_apps']['uk'] = "Встановлює типові значення для додатків";
$text['description-upgrade_apps']['de-at'] = "Setzt alle Applikationen auf die Standardeinstellungen zurück.";
$text['description-upgrade_switch']['en-us'] = "Runs the upgrade switch routine.";
$text['description-upgrade_switch']['es-cl'] = "";
$text['description-upgrade_switch']['pt-pt'] = "";
$text['description-upgrade_switch']['fr-fr'] = "";
$text['description-upgrade_switch']['pt-br'] = "";
$text['description-upgrade_switch']['pl'] = "";
$text['description-upgrade_switch']['sv-se'] = "";
$text['description-upgrade_switch']['uk'] = "";
$text['description-upgrade_switch']['de-at'] = "";
$text['description-upgrade']['en-us'] = "Select the actions below you wish to perform.";
$text['description-upgrade']['es-cl'] = "Seleccione las acciones a continuación que desea realizar.";
$text['description-upgrade']['pt-pt'] = "Selecione as ações abaixo você deseja executar.";

View File

@ -35,6 +35,7 @@ if (
!permission_exists('upgrade_source') &&
!permission_exists('upgrade_schema') &&
!permission_exists('upgrade_apps') &&
!permission_exists('upgrade_switch') &&
!permission_exists('menu_restore') &&
!permission_exists('group_edit')
) {
@ -121,6 +122,13 @@ if (sizeof($_POST) > 0) {
$response_message = "Permission Defaults Restored";
}
// upgrade switch
if ($do["switch"] && permission_exists("upgrade_switch")) {
$included = true;
require_once("core/install/upgrade_switch.php");
$response_message = "Switch Upgraded";
}
if (sizeof($_POST['do']) > 1) {
$response_message = $text['message-upgrade'];
}
@ -250,6 +258,22 @@ if (permission_exists("group_edit")) {
echo "</table>\n";
}
if (permission_exists("upgrade_switch")) {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td width='30%' class='vncell'>\n";
echo " ".$text['label-upgrade_switch'];
echo " </td>\n";
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
echo " <label for='do_switch'>";
echo " <input type='checkbox' class='formfld' name='do[switch]' id='do_switch' value='1'>";
echo " ".$text['description-upgrade_switch'];
echo " </label>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
}
echo "<br>";
echo "<div style='text-align: right;'><input type='submit' class='btn' value='".$text['button-upgrade_execute']."'></div>";
echo "<br><br>";