Move install functions from sccp_manager to installer
Change core driver to be an include Move driver to sccpManClasses to improve maintainability and eliminate possible version issues Add driver in installer (remove from extConfigs) Create sccp.conf in installer if it does not exist (remove from extconfigs) Update extconfigs.class.php Update Sccp.class.php.v433
This commit is contained in:
parent
2dad547e3d
commit
55285cf625
|
@ -976,22 +976,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
|
||||
$driver = $this->FreePBX->Core->getAllDriversInfo();
|
||||
// Below is always set to replace; good for Develop, but needs to be updated for release
|
||||
$sccp_driver_replace = '';
|
||||
if (empty($driver['sccp'])) {
|
||||
$sccp_driver_replace = 'yes';
|
||||
} else {
|
||||
if (empty($driver['sccp']['Version'])) {
|
||||
$sccp_driver_replace = 'yes';
|
||||
} else {
|
||||
if ($driver['sccp']['Version'] != $this->sccp_driver_ver . $driver_revision[$ver_id]) {
|
||||
$sccp_driver_replace = 'yes';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->sccpvalues['sccp_compatible'] = array('keyword' => 'sccp_compatible', 'data' => $ver_id, 'type' => '1', 'seq' => '99');
|
||||
$this->sccppath = $this->extconfigs->validate_init_path($confDir, $this->sccpvalues, $sccp_driver_replace);
|
||||
$this->sccppath = $this->extconfigs->validate_init_path($confDir, $this->sccpvalues);
|
||||
$driver = $this->FreePBX->Core->getAllDriversInfo(); // Check that Sccp Driver has been updated by above
|
||||
|
||||
$read_config = $this->cnf_read->getConfig('sccp.conf');
|
||||
|
|
16
install.php
16
install.php
|
@ -65,6 +65,7 @@ if ($chanSCCPWarning) {
|
|||
outn("<font color='red'>Error: installed version of chan-sccp is not compatible. Please upgrade chan-sccp</font>");
|
||||
}
|
||||
Setup_RealTime();
|
||||
addDriver($sccp_compatible);
|
||||
outn("<br>");
|
||||
outn("Install Complete !");
|
||||
outn("<br>");
|
||||
|
@ -851,4 +852,19 @@ function Setup_RealTime()
|
|||
}
|
||||
}
|
||||
|
||||
function addDriver($sccp_compatible) {
|
||||
outn("<li>" . _("Adding driver ...") . "</li>");
|
||||
$file = "/var/www/html/admin/modules/core/functions.inc/drivers/Sccp.class.php";
|
||||
$contents = "<?php include '/var/www/html/admin/modules/sccp_manager/sccpManClasses/Sccp.class.php.v{$sccp_compatible}'; ?>";
|
||||
file_put_contents($file, $contents);
|
||||
|
||||
$cnf_int = \FreePBX::Config();
|
||||
$dir = $cnf_int->get('ASTETCDIR');
|
||||
if (!file_exists("{$dir}/sccp.conf")) { // System re Config
|
||||
outn("<li>" . _("Adding default configuration file ...") . "</li>");
|
||||
$sccpfile = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/sccp.conf');
|
||||
file_put_contents("{$dir}/sccp.conf", $sccpfile);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<module>
|
||||
<rawname>sccp_manager</rawname>
|
||||
<name>SCCP Manager</name>
|
||||
<version>14.3.0.1</version>
|
||||
<version>14.3.0.0</version>
|
||||
<type>setup</type>
|
||||
<category>SCCP Connectivity</category>
|
||||
<publisher>Steve Lad, Alex GP</publisher>
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
// vim: set ai ts=4 sw=4 ft=php:
|
||||
// Version for SCCP Manager 13.0.X
|
||||
//
|
||||
// Template for Sccp Driver
|
||||
/*
|
||||
* Required Functions for Core Drivers
|
||||
/* This is the driver for Sccp_manager in FreePBX.
|
||||
It is loaded via an include, written by the installer, at
|
||||
modules/core/functions.inc/drivers
|
||||
and provides the following required methods. it provides the interface between
|
||||
FreePBX extensions and sccp_manager lines
|
||||
*
|
||||
* getInfo
|
||||
* addDevice
|
||||
* delDevice
|
|
@ -15,9 +15,9 @@ class extconfigs
|
|||
}
|
||||
|
||||
public function info() {
|
||||
$Ver = '13.1.1';
|
||||
$Ver = '13.2.0';
|
||||
return array('Version' => $Ver,
|
||||
'about' => 'Default Setings and Enums ver: ' . $Ver);
|
||||
'about' => 'Default Settings and Enums ver: ' . $Ver);
|
||||
}
|
||||
|
||||
public function getextConfig($id = '', $index = '') {
|
||||
|
@ -216,36 +216,50 @@ class extconfigs
|
|||
'New Zealand' => array('offset' => '720', 'daylight' => true)
|
||||
);
|
||||
|
||||
public function validate_init_path($confDir = '', $db_vars, $sccp_driver_replace = '')
|
||||
{
|
||||
// global $db;
|
||||
// global $amp_conf;
|
||||
// *** Setings for Provision Sccp
|
||||
$adv_config = array('tftproot' => '', 'firmware' => 'firmware', 'settings' => 'settings',
|
||||
'locales' => 'locales', 'languages' => 'languages', 'templates' => 'templates', 'dialplan' => 'dialplan', 'softkey' => 'softkey');
|
||||
// 'pro' /tftpboot - root dir
|
||||
// /tftpboot/locales/locales/%Languge_name%
|
||||
// /tftpboot/settings/XMLdefault.cnf.xml
|
||||
// /tftpboot/settings/SEP[MAC].cnf.xml
|
||||
// /tftpboot/firmware/79xx/SCCPxxxx.loads
|
||||
$adv_tree['pro'] = array('templates' => 'tftproot', 'settings' => 'tftproot', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'locales', 'dialplan' => 'tftproot', 'softkey' => 'tftproot');
|
||||
public function validate_init_path($confDir = '', $db_vars) {
|
||||
$adv_config = array('tftproot' => '',
|
||||
'firmware' => 'firmware',
|
||||
'settings' => 'settings',
|
||||
'locales' => 'locales',
|
||||
'languages' => 'languages',
|
||||
'templates' => 'templates',
|
||||
'dialplan' => 'dialplan',
|
||||
'softkey' => 'softkey'
|
||||
);
|
||||
|
||||
// 'def' /tftpboot - root dir
|
||||
// /tftpboot/languages/%Languge_name%
|
||||
// /tftpboot/XMLdefault.cnf.xml
|
||||
// /tftpboot/SEP[MAC].cnf.xml
|
||||
// /tftpboot/SCCPxxxx.loads
|
||||
$adv_tree['def'] = array('templates' => 'tftproot', 'settings' => '', 'locales' => '', 'firmware' => '', 'languages' => 'tftproot', 'dialplan' => '', 'softkey' => '');
|
||||
// $adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => '');
|
||||
// $adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'tftproot');
|
||||
//* **************------ ****
|
||||
$base_tree = array('tftp_templates' => 'templates', 'tftp_path_store' => 'settings', 'tftp_lang_path' => 'languages', 'tftp_firmware_path' => 'firmware', 'tftp_dialplan' => 'dialplan', 'tftp_softkey' => 'softkey');
|
||||
$adv_tree['pro'] = array('templates' => 'tftproot',
|
||||
'settings' => 'tftproot',
|
||||
'locales' => 'tftproot',
|
||||
'firmware' => 'tftproot',
|
||||
'languages' => 'locales',
|
||||
'dialplan' => 'tftproot',
|
||||
'softkey' => 'tftproot'
|
||||
);
|
||||
|
||||
$adv_tree['def'] = array('templates' => 'tftproot',
|
||||
'settings' => '',
|
||||
'locales' => '',
|
||||
'firmware' => '',
|
||||
'languages' => 'tftproot',
|
||||
'dialplan' => '',
|
||||
'softkey' => ''
|
||||
);
|
||||
|
||||
$base_tree = array('tftp_templates' => 'templates',
|
||||
'tftp_path_store' => 'settings',
|
||||
'tftp_lang_path' => 'languages',
|
||||
'tftp_firmware_path' => 'firmware',
|
||||
'tftp_dialplan' => 'dialplan',
|
||||
'tftp_softkey' => 'softkey'
|
||||
);
|
||||
|
||||
if (empty($confDir)) {
|
||||
return array('error' => 'empty СonfDir');
|
||||
}
|
||||
|
||||
$base_config = array('asterisk' => $confDir, 'sccp_conf' => $confDir . '/sccp.conf', 'tftp_path' => '');
|
||||
$base_config = array('asterisk' => $confDir,
|
||||
'sccp_conf' => "$confDir/sccp.conf",
|
||||
'tftp_path' => '');
|
||||
|
||||
// Test Base dir (/tftproot)
|
||||
if (!empty($db_vars["tftp_path"])) {
|
||||
|
@ -314,21 +328,7 @@ class extconfigs
|
|||
}
|
||||
}
|
||||
}
|
||||
print_r($base_config, 1);
|
||||
// die(print_r($base_config,1));
|
||||
// $base_config['External_ini'] = $adv_config;
|
||||
// $base_config['External_mode'] = $adv_tree_mode;
|
||||
|
||||
/*
|
||||
if (!empty($this->sccppath["tftp_path"])) {
|
||||
$this->sccppath["tftp_DP"] = $this->sccppath["tftp_path"] . '/Dialplan';
|
||||
if (!file_exists($this->sccppath["tftp_DP"])) {
|
||||
if (!mkdir($this->sccppath["tftp_DP"], 0777, true)) {
|
||||
die('Error creating DialPlan template dir');
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// TFTP -REWrite double model
|
||||
if (empty($_SERVER['DOCUMENT_ROOT'])) {
|
||||
if (!empty($this->paren_class)) {
|
||||
|
@ -345,27 +345,9 @@ class extconfigs
|
|||
copy($filename, $dst_path . basename($filename));
|
||||
}
|
||||
}
|
||||
|
||||
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
|
||||
if (!file_exists($dst) || $sccp_driver_replace == 'yes') {
|
||||
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst) . '.v' . $db_vars['sccp_compatible']['data'];
|
||||
if (file_exists($src_path)) {
|
||||
copy($src_path, $dst);
|
||||
} else {
|
||||
// Set new default
|
||||
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst) . '.v433';
|
||||
copy($src_path, $dst);
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists($base_config["sccp_conf"])) { // System re Config
|
||||
$sccpfile = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/sccp.conf');
|
||||
file_put_contents($base_config["sccp_conf"], $sccpfile);
|
||||
}
|
||||
|
||||
return $base_config;
|
||||
}
|
||||
// Type declaration in below function is incompatible with PHP 5
|
||||
|
||||
public function validate_RealTime( $connector )
|
||||
{
|
||||
// This method only checks that asterisk is correctly configured for Realtime
|
||||
|
|
Loading…
Reference in a new issue