Fix issue #39
Get masterFilesList at install direct from Provisioner. If not available, install a copy from the module
This commit is contained in:
parent
1b979222fa
commit
a2217e6e37
|
@ -616,13 +616,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
private function findInstLangs() {
|
||||
//locales and country tones are installed in the tftp_lang_path
|
||||
//Available packs from provisioner are in masterFilesStructure.xml in tftpRoot Path
|
||||
// TODO: Need to include this file as part of module in case download not allowed/available
|
||||
|
||||
$searchDir = '/'; //set default for when called by installer on virgin system
|
||||
$result = array();
|
||||
|
||||
if (!file_exists("{$this->sccppath['tftp_path']}/masterFilesStructure.xml")) {
|
||||
if (!$this->getFileListFromProvisioner()) {
|
||||
if (!$this->getFileListFromProvisioner($this->sccppath['tftp_path'])) {
|
||||
// File does not exist and cannot get from internet.
|
||||
return $result;
|
||||
};
|
||||
|
|
20
install.php
20
install.php
|
@ -1035,9 +1035,29 @@ function checkTftpServer() {
|
|||
die_freepbx(_("Error updating sccpsettings. $sql"));
|
||||
}
|
||||
}
|
||||
getMasterFileList($tftpRootPath);
|
||||
return;
|
||||
}
|
||||
|
||||
function getMasterFileList(string $tftpRootPath) {
|
||||
global $thisInstaller;
|
||||
global $amp_conf;
|
||||
outn("<li>" . _("Checking TFTP server path and availability ...") . "</li>");
|
||||
if (file_exists("{$tftpRootPath}/masterFilesStructure.xml")) {
|
||||
outn("<li>" . _("Backing up existing masterFilesList ...") . "</li>");
|
||||
rename("{$tftpRootPath}/masterFilesStructure.xml","{$tftpRootPath}/masterFilesStructure.xml.old");
|
||||
}
|
||||
outn("<li>" . _("Getting latest master file list from provisioner ...") . "</li>");
|
||||
if (!$thisInstaller->getFileListFromProvisioner($tftpRootPath)) {
|
||||
outn("<li>" . _("Unable to fetch master file list from provisioner, installing local copy ...") . "</li>");
|
||||
// Cannot get file from internet, so use copy with this dist which may be older.
|
||||
if (!copy($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/contrib/masterFilesStructure.xml',"{$tftpRootPath}/masterFilesStructure.xml")) {
|
||||
return false;
|
||||
};
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
function cleanUpSccpSettings() {
|
||||
global $thisInstaller;
|
||||
global $settingsFromDb;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<module>
|
||||
<rawname>sccp_manager</rawname>
|
||||
<name>SCCP Manager</name>
|
||||
<version>14.3.0.14a</version>
|
||||
<version>14.3.0.15</version>
|
||||
<type>setup</type>
|
||||
<category>SCCP Connectivity</category>
|
||||
<publisher>Steve Lad, Alex GP</publisher>
|
||||
|
@ -24,6 +24,7 @@
|
|||
* Version 14.2.0.9 * - Bug Fix - incorrect response class for Reset Token Device
|
||||
* Version 14.2.0.10 * - Bug Fix - line not assigned on device creation
|
||||
* Version 14.3.0.0 * - New Minor Version - Change DB and add new settings
|
||||
* Version 14.3.0.15 * - Get masterFilesList from provisoner via installer Fix Issue 39
|
||||
</changelog>
|
||||
<location>https://github.com/chan-sccp/sccp_manager</location>
|
||||
<supported>
|
||||
|
|
|
@ -554,8 +554,9 @@ trait ajaxHelper {
|
|||
$filesToGet = array();
|
||||
$totalFiles = 0;
|
||||
$provisionerUrl = "https://github.com/dkgroot/provision_sccp/raw/master/";
|
||||
// TODO: Maybe should always fetch to ensure have latest, backing up old version
|
||||
if (!file_exists("{$this->sccppath['tftp_path']}/masterFilesStructure.xml")) {
|
||||
if (!$this->getFileListFromProvisioner()) {
|
||||
if (!$this->getFileListFromProvisioner($this->sccppath['tftp_path'])) {
|
||||
return array('status' => false,
|
||||
'message' => "{$provisionerUrl}tools/tftpbootFiles.xml cannot be found. Check your internet connection, and that this path exists",
|
||||
'reload' => false);
|
||||
|
|
|
@ -253,12 +253,12 @@ trait helperfunctions {
|
|||
$dom->save($filename);
|
||||
}
|
||||
|
||||
public function getFileListFromProvisioner() {
|
||||
public function getFileListFromProvisioner(string $tftpRootPath) {
|
||||
|
||||
$provisionerUrl = "https://github.com/dkgroot/provision_sccp/raw/master/";
|
||||
// Get master tftpboot directory structure
|
||||
try {
|
||||
file_put_contents("{$this->sccppath['tftp_path']}/masterFilesStructure.xml",file_get_contents("{$provisionerUrl}tools/tftpbootFiles.xml"));
|
||||
file_put_contents("{$tftpRootPath}/masterFilesStructure.xml",file_get_contents("{$provisionerUrl}tools/tftpbootFiles.xml"));
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,14 @@ global $amp_conf;
|
|||
<?php
|
||||
|
||||
$selectArray = array();
|
||||
//below probably unnecessary as installer should ensure that a copy always exists
|
||||
// TODO: Maybe should always check here to ensure that have latest
|
||||
if (!file_exists("{$this->sccppath['tftp_path']}/masterFilesStructure.xml")) {
|
||||
if (!$this->getFileListFromProvisioner($this->sccppath['tftp_path'])) {
|
||||
// File does not exist and cannot get from internet.
|
||||
return $result;
|
||||
};
|
||||
}
|
||||
$tftpBootXml = simplexml_load_file("{$this->sccppath['tftp_path']}/masterFilesStructure.xml");
|
||||
$firmwareDir = $tftpBootXml->xpath("//Directory[@name='firmware']");
|
||||
|
||||
|
|
Loading…
Reference in a new issue