From fb9ea641347b2892ab1f0a368aea6b30d47ffdf8 Mon Sep 17 00:00:00 2001
From: steve-lad <72376554+steve-lad@users.noreply.github.com>
Date: Fri, 25 Jun 2021 06:35:51 +0200
Subject: [PATCH] Fix SQL in Install Rename
Change SQL in Installer rename column
Change TFTP variable name for better clarity
---
Sccp_manager.class.php | 14 ++++++------
install.php | 2 +-
sccpManClasses/extconfigs.class.php | 2 +-
views/advserver.model.php | 1 -
views/form.buttons.php | 35 +++++++++++++----------------
5 files changed, 24 insertions(+), 30 deletions(-)
diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php
index d573a3f..c287bb3 100644
--- a/Sccp_manager.class.php
+++ b/Sccp_manager.class.php
@@ -885,7 +885,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
'asterisk' => $this->sccpvalues['asterisk_etc_path']['data'],
'tftp_path' => $this->sccpvalues['tftp_path']['data'],
'tftp_templates' => $this->sccpvalues['tftp_templates']['data'],
- 'tftp_path_store' => $this->sccpvalues['tftp_path_store']['data'],
+ 'tftp_store_path' => $this->sccpvalues['tftp_store_path']['data'],
'tftp_lang_path' => $this->sccpvalues['tftp_lang_path']['data'],
'tftp_firmware_path' => $this->sccpvalues['tftp_firmware_path']['data'],
'tftp_dialplan' => $this->sccpvalues['tftp_dialplan']['data'],
@@ -1044,7 +1044,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$lang_data = $this->extconfigs->getExtConfig('sccp_lang');
$data_value['tftp_path'] = $this->sccppath["tftp_path"];
- $this->xmlinterface->create_default_XML($this->sccppath["tftp_path_store"], $data_value, $model_information, $lang_data);
+ $this->xmlinterface->create_default_XML($this->sccppath["tftp_store_path"], $data_value, $model_information, $lang_data);
}
/*
@@ -1121,7 +1121,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$lang_data = $this->extconfigs->getExtConfig('sccp_lang');
if (!$sccp_native) {
- return $this->xmlinterface->create_SEP_SIP_XML($this->sccppath["tftp_path_store"], $data_value, $dev_config, $dev_id, $lang_data);
+ return $this->xmlinterface->create_SEP_SIP_XML($this->sccppath["tftp_store_path"], $data_value, $dev_config, $dev_id, $lang_data);
}
return $this->xmlinterface->create_SEP_XML($this->sccppath["tftp_templates"], $data_value, $dev_config, $dev_id, $lang_data);
}
@@ -1131,17 +1131,17 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return false;
}
if ($dev_id == 'all') {
- $xml_name = $this->sccppath["tftp_path_store"] . '/SEP*.cnf.xml';
+ $xml_name = $this->sccppath["tftp_store_path"] . '/SEP*.cnf.xml';
array_map("unlink", glob($xml_name));
- $xml_name = $this->sccppath["tftp_path_store"] . '/ATA*.cnf.xml';
+ $xml_name = $this->sccppath["tftp_store_path"] . '/ATA*.cnf.xml';
array_map("unlink", glob($xml_name));
- $xml_name = $this->sccppath["tftp_path_store"] . '/VG*.cnf.xml';
+ $xml_name = $this->sccppath["tftp_store_path"] . '/VG*.cnf.xml';
array_map("unlink", glob($xml_name));
} else {
if (!strpos($dev_id, 'SEP')) {
return false;
}
- $xml_name = $this->sccppath["tftp_path_store"] . '/' . $dev_id . '.cnf.xml';
+ $xml_name = $this->sccppath["tftp_store_path"] . '/' . $dev_id . '.cnf.xml';
if (file_exists($xml_name)) {
unlink($xml_name);
}
diff --git a/install.php b/install.php
index bc01f43..2cc2026 100644
--- a/install.php
+++ b/install.php
@@ -429,7 +429,7 @@ function InstallDB_updateSchema($db_config)
}
} else {
if (!empty($row_data['rename'])) {
- $sql_modify .= "CHANGE COLUMN {$row_fld} {$row_data['rename']} {$row_data['create']}, ";
+ $sql_modify .= "RENAME COLUMN {$row_fld} TO {$row_data['rename']}, ";
$count_modify ++;
}
$row_data['fieldModified'] = FALSE;
diff --git a/sccpManClasses/extconfigs.class.php b/sccpManClasses/extconfigs.class.php
index 890619e..5937043 100644
--- a/sccpManClasses/extconfigs.class.php
+++ b/sccpManClasses/extconfigs.class.php
@@ -271,7 +271,7 @@ class extconfigs
);
$base_tree = array('tftp_templates' => 'templates',
- 'tftp_path_store' => 'settings',
+ 'tftp_store_path' => 'settings',
'tftp_lang_path' => 'languages',
'tftp_firmware_path' => 'firmware',
'tftp_dialplan' => 'dialplan',
diff --git a/views/advserver.model.php b/views/advserver.model.php
index a7240ab..5d5d2d5 100644
--- a/views/advserver.model.php
+++ b/views/advserver.model.php
@@ -272,7 +272,6 @@
return "File not found
" + value ;
}
return value;
-
}
function SetRowColor(row, index) {
diff --git a/views/form.buttons.php b/views/form.buttons.php
index 2a7e3b2..c0c63ad 100644
--- a/views/form.buttons.php
+++ b/views/form.buttons.php
@@ -66,7 +66,7 @@ if (!empty($_REQUEST['ru_id'])) {