Make the domain and schema work with the PHP classes
This commit is contained in:
parent
4fd34d1c80
commit
181e2881c0
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
//application details
|
||||
$apps[$x]['name'] = "Upgrade";
|
||||
$apps[$x]['uuid'] = "8b1d7eb5-1009-052c-e1a8-d1f4887a3f5c";
|
||||
|
|
@ -11,7 +12,7 @@
|
|||
$apps[$x]['description']['de-de'] = "";
|
||||
$apps[$x]['description']['de-ch'] = "";
|
||||
$apps[$x]['description']['de-at'] = "";
|
||||
$apps[$x]['description']['fr-fr'] = "Mise à jour du Schéma de la base de données";
|
||||
$apps[$x]['description']['fr-fr'] = "Mise %uFFFD jour du Sch%uFFFDma de la base de donn%uFFFDes";
|
||||
$apps[$x]['description']['fr-ca'] = "";
|
||||
$apps[$x]['description']['fr-ch'] = "";
|
||||
$apps[$x]['description']['pt-pt'] = "Atualizar o esquema da base de dados.";
|
||||
|
|
@ -174,4 +175,5 @@
|
|||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
*/
|
||||
?>
|
||||
|
||||
?>
|
||||
|
|
@ -190,11 +190,9 @@
|
|||
$text['message-upgrade']['pt-pt'] = "Actualização Efectuada";
|
||||
$text['message-upgrade']['fr-fr'] = "Mis à jour";
|
||||
|
||||
/******************/
|
||||
|
||||
$text['login-message_text']['en-us'] = "Keep up with the FusionPBX project by configuring your preferences in the newly added <a href=''/core/notifications/notification_edit.php''>Notifications</a> section, under the System menu!";
|
||||
$text['login-message_text']['es-cl'] = "Manténgase al día con el proyecto FusionPBX configurando sus preferencias en la sección <a href=''/core/notifications/notification_edit.php''>Notificaciones</a> acaba de agregar, en el menú del sistema!";
|
||||
$text['login-message_text']['pt-pt'] = "Mantenha-se com o projeto FusionPBX configurando suas preferências na seção <a href=''/core/notifications/notification_edit.php''>Notificações</a> recém-adicionado, no menu Sistema!";
|
||||
$text['login-message_text']['fr-fr'] = "Tenez-vous au projet FusionPBX en configurant vos préférences dans la section <a href=''/core/notifications/notification_edit.php''>Notifications</a> nouvellement ajouté, dans le menu du système!";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -64,28 +64,23 @@ if (sizeof($_POST) > 0) {
|
|||
$response_message = $text['message-upgrade_svn'];
|
||||
}
|
||||
|
||||
// load the default database into memory 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")) {
|
||||
$included = true;
|
||||
$response_output = "return";
|
||||
$response_format = "html";
|
||||
$upgrade_data_types = check_str($do["data_types"]);
|
||||
require_once "core/upgrade/upgrade_schema.php";
|
||||
if ($response_upgrade_schema != '') {
|
||||
$_SESSION["response_upgrade_schema"] = $response_upgrade_schema;
|
||||
}
|
||||
unset($apps);
|
||||
$response_message = $text['message-upgrade_schema'];
|
||||
|
||||
$upgrade_data_types = check_str($do["data_types"]);
|
||||
require_once "resources/classes/schema.php";
|
||||
$obj = new schema();
|
||||
$_SESSION["schema"]["response"] = $obj->schema("html");
|
||||
}
|
||||
|
||||
// process the apps defaults
|
||||
if ($do["apps"] && permission_exists("upgrade_apps")) {
|
||||
$included = true;
|
||||
$domain_language_code = $_SESSION['domain']['language']['code'];
|
||||
require_once "core/upgrade/upgrade_domains.php";
|
||||
$_SESSION['domain']['language']['code'] = $domain_language_code;
|
||||
unset($domain_language_code);
|
||||
$response_message = $text['message-upgrade_apps'];
|
||||
|
||||
require_once "resources/classes/domains.php";
|
||||
$domain = new domains;
|
||||
$domain->upgrade();
|
||||
}
|
||||
|
||||
// restore defaults of the selected menu
|
||||
|
|
@ -260,12 +255,12 @@ if ($_SESSION["response_svn_update"] != '') {
|
|||
|
||||
|
||||
// output result of upgrade schema
|
||||
if ($_SESSION["response_upgrade_schema"] != '') {
|
||||
if ($_SESSION["schema"]["response"] != '') {
|
||||
echo "<br /><br /><br />";
|
||||
echo "<b>".$text['header-upgrade_schema_results']."</b>";
|
||||
echo "<br /><br />";
|
||||
echo $_SESSION["response_upgrade_schema"];
|
||||
unset($_SESSION["response_upgrade_schema"]);
|
||||
echo $_SESSION["schema"]["response"];
|
||||
unset($_SESSION["schema"]["response"]);
|
||||
}
|
||||
|
||||
require_once "resources/footer.php";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
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
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -32,13 +32,7 @@
|
|||
set_include_path($document_root);
|
||||
require_once "resources/require.php";
|
||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||
$response_format = 'text'; //html, text
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
$format = 'text'; //html, text
|
||||
}
|
||||
else {
|
||||
include "root.php";
|
||||
|
|
@ -51,39 +45,28 @@
|
|||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
$format = 'html';
|
||||
}
|
||||
|
||||
//set the default
|
||||
if (!isset($response_output)) {
|
||||
$response_output = "echo";
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//include the header
|
||||
if ($response_output == "echo") {
|
||||
require_once "resources/header.php";
|
||||
//show the title
|
||||
if ($format == 'text') {
|
||||
echo "\n";
|
||||
echo $text['label-upgrade']."\n";
|
||||
echo "-----------------------------------------\n";
|
||||
echo "\n";
|
||||
echo $text['label-database']."\n";
|
||||
}
|
||||
|
||||
if ($response_format == 'text') {
|
||||
echo "\n";
|
||||
echo $text['label-upgrade']."\n";
|
||||
echo "-----------------------------------------\n";
|
||||
echo "\n";
|
||||
echo $text['label-database']."\n";
|
||||
}
|
||||
|
||||
//make sure the database schema and installation have performed all necessary tasks
|
||||
$display_results = false;
|
||||
$display_type = 'none';
|
||||
require_once "resources/classes/schema.php";
|
||||
$obj = new schema;
|
||||
$obj->schema($db, $db_type, $db_name, $display_type);
|
||||
echo $obj->schema("text");
|
||||
|
||||
//run all app_defaults.php files
|
||||
require_once "resources/classes/domains.php";
|
||||
|
|
@ -91,7 +74,7 @@ if ($response_format == 'text') {
|
|||
$domain->upgrade();
|
||||
|
||||
//show the content
|
||||
if ($response_format == 'html') {
|
||||
if ($format == 'html') {
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
echo "<tr>\n";
|
||||
|
|
@ -111,12 +94,13 @@ if ($response_format == 'text') {
|
|||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
}
|
||||
elseif ($response_format == 'text') {
|
||||
elseif ($format == 'text') {
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
//include the footer
|
||||
if ($response_output == "echo") {
|
||||
if ($format == "html") {
|
||||
require_once "resources/footer.php";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
set_include_path($document_root);
|
||||
require_once "resources/require.php";
|
||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||
$display_type = 'text'; //html, text
|
||||
$format = 'text'; //html, text
|
||||
}
|
||||
else if (!$included) {
|
||||
include "root.php";
|
||||
|
|
@ -48,6 +48,7 @@
|
|||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
$format = 'html'; //html, text
|
||||
}
|
||||
|
||||
//run all app_defaults.php files
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
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
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
// set included, if not
|
||||
if (!isset($included)) { $included = false; }
|
||||
|
||||
|
||||
//check the permission
|
||||
if(defined('STDIN')) {
|
||||
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
||||
|
|
@ -36,7 +35,7 @@
|
|||
set_include_path($document_root);
|
||||
require_once "resources/require.php";
|
||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||
$response_format = 'text'; //html, text
|
||||
$format = 'text'; //html, text
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
|
|
@ -57,31 +56,18 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-upgrade_schema'];
|
||||
|
||||
$response_format = 'html'; //html, text
|
||||
$format = 'html'; //html, text
|
||||
}
|
||||
|
||||
//set the default
|
||||
if (!isset($response_output)) {
|
||||
$response_output = "echo";
|
||||
}
|
||||
|
||||
//load the default database into memory and compare it with the active database
|
||||
//get the database schema put it into an array then compare and update the database as needed.
|
||||
require_once "resources/classes/schema.php";
|
||||
$obj = new schema;
|
||||
$obj->schema($db, $db_type, $db_name, $response_output);
|
||||
unset($apps);
|
||||
echo $obj->schema($format);
|
||||
|
||||
|
||||
if (!$included && $response_output == 'echo' && $response_format == 'html') {
|
||||
if (!$included && $format == 'html') {
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
require_once "resources/footer.php";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
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
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2013
|
||||
Copyright (C) 2013 - 2014
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -445,16 +445,23 @@ include "root.php";
|
|||
}
|
||||
|
||||
//datatase schema
|
||||
public function schema ($db, $db_type, $db_name, $response_output) {
|
||||
//set the global variables
|
||||
global $db;
|
||||
global $text; // pulls in language variable array
|
||||
global $response_format;
|
||||
global $upgrade_data_types;
|
||||
public function schema ($format) {
|
||||
|
||||
//set the global variable
|
||||
global $db, $db_type, $db_name, $db_username, $db_password;
|
||||
global $db_host, $db_path, $db_port, $upgrade_data_types, $text;
|
||||
|
||||
//get the PROJECT PATH
|
||||
include "root.php";
|
||||
|
||||
//add multi-lingual support
|
||||
if (!isset($text)) {
|
||||
require "core/upgrade/app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
}
|
||||
|
||||
//PHP PDO check if table or column exists
|
||||
//check if table exists
|
||||
// SELECT * FROM sqlite_master WHERE type='table' AND name='v_cdr'
|
||||
|
|
@ -709,7 +716,7 @@ include "root.php";
|
|||
$response = '';
|
||||
|
||||
//display results as html
|
||||
if ($response_output != '' && $response_format == "html") {
|
||||
if ($format == "html") {
|
||||
//show the database type
|
||||
$response .= "<strong>".$text['header-database_type'].": ".$db_type. "</strong><br /><br />";
|
||||
//start the table
|
||||
|
|
@ -812,11 +819,11 @@ include "root.php";
|
|||
|
||||
//loop line by line through all the lines of sql code
|
||||
$x = 0;
|
||||
if (strlen($sql_update) == 0 && $response_format == "text") {
|
||||
if (strlen($sql_update) == 0 && $format == "text") {
|
||||
$response .= " ".$text['label-schema'].": ".$text['label-no_change']."\n";
|
||||
}
|
||||
else {
|
||||
if ($response_format == "text") {
|
||||
if ($format == "text") {
|
||||
$response .= " ".$text['label-schema'].":\n";
|
||||
}
|
||||
//$db->beginTransaction();
|
||||
|
|
@ -825,14 +832,12 @@ include "root.php";
|
|||
if (strlen(trim($sql))) {
|
||||
try {
|
||||
$db->query(trim($sql));
|
||||
if ($response_format == "text") {
|
||||
if ($format == "text") {
|
||||
$response .= " $sql\n";
|
||||
}
|
||||
}
|
||||
catch (PDOException $error) {
|
||||
if ($response_output != '') {
|
||||
$response .= " error: " . $error->getMessage() . " sql: $sql<br/>";
|
||||
}
|
||||
$response .= " error: " . $error->getMessage() . " sql: $sql<br/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -842,12 +847,12 @@ include "root.php";
|
|||
}
|
||||
|
||||
//handle response
|
||||
if ($response_output == "echo") {
|
||||
echo $response;
|
||||
}
|
||||
else if ($response_output == "return") {
|
||||
//if ($output == "echo") {
|
||||
// echo $response;
|
||||
//}
|
||||
//else if ($output == "return") {
|
||||
return $response;
|
||||
}
|
||||
//}
|
||||
|
||||
} //end function
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue