Fix issue 12
This commit is contained in:
steve-lad 2021-06-11 11:09:30 +02:00 committed by GitHub
commit 50d2f25326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 9 deletions

View file

@ -793,18 +793,23 @@ function Setup_RealTime()
// Check extconfig file for correct connector values
$ext_conf = '';
$ext_conf_file = 'extconfig.conf';
$ext_conf_file = '';
$backup_ext = array('_custom.conf', '_additional.conf','.conf');
foreach ($backup_ext as $value) {
if (file_exists($dir . '/extconfig' . $value)) {
// Last possibility is normal file extconfig.conf
$ext_conf_file = 'extconfig' . $value;
$ext_conf_file = $dir . 'extconfig' . $value;
$ext_conf = $cnf_read->getConfig($ext_conf_file);
break;
}
}
if (empty($ext_conf_file)) {
// Have not found a file, so will need to create. $ext_conf must be empty
$ext_conf_file = $dir . '/extconfig.conf';
}
if (!empty($ext_conf)) {
// Have found a file and read a config. Now need to check required settings
$currentExtSettings = array();
$writeExtSettings = $ext_conf;
if (empty($ext_conf['settings']['sccpdevice']) || ($ext_conf['settings']['sccpdevice'] !== $def_ext_config['sccpdevice'])) {
@ -816,9 +821,15 @@ function Setup_RealTime()
$writeExtSettings['settings']['sccpline'] = $def_ext_config['sccpline'];
}
if (!empty($writeExtSettings)) {
outn("<li>" . _("Updating extconfig file ...") . "</li>");
outn("<li>" . _("Updating extconfig file ... ") . $ext_conf_file . "</li>");
$cnf_wr->writeConfig($ext_conf_file, $writeExtSettings);
}
} else {
// Either did not find file or file did not contain any config, so create and fill
outn("<li>" . _("Creating extconfig file ... ") . . $ext_conf_file . "</li>");
$writeExtSettings['settings']['sccpdevice'] = $def_ext_config['sccpdevice'];
$writeExtSettings['settings']['sccpline'] = $def_ext_config['sccpline'];
$cnf_wr->writeConfig($ext_conf_file, $writeExtSettings);
}
// Check database settings

View file

@ -30,7 +30,7 @@
<md5sum></md5sum>
<database>
<table name="sccpdevice">
<field name="name" type="string" length="15" default="" primarykey="true"/>
<field name="name" type="string" length="15" primarykey="true"/>
<field name="type" type="string" length="15" notnull="false"/>
<field name="addon" type="string" length="45" notnull="false"/>
<field name="_description" type="string" length="45" notnull="false"/>
@ -115,14 +115,14 @@
<field name="dnd" type="string" default="reject" notnull="false"/>
<field name="videomode" type="string" default="auto" notnull="false"/>
<field name="setvar" type="string" length="50" notnull="false"/>
<field name="name" type="string" length="40" default="" primarykey="true"/>
<field name="name" type="string" length="40" primarykey="true"/>
<field name="phonecodepage" type="string" length="50" notnull="false"/>
<key name="id" type="unique">
<column name="id"/>
</key>
</table>
<table name="sccpbuttonconfig">
<field name="ref" type="string" length="15" default="" primarykey="true"/>
<field name="ref" type="string" length="15" primarykey="true"/>
<field name="reftype" type="string" length="15" default="sccpdevice" primarykey="true"/>
<field name="instance" type="boolean" default="0" primarykey="true"/>
<field name="buttontype" type="string" default="line" primarykey="true"/>
@ -134,11 +134,11 @@
</key>
</table>
<table name="sccpdevmodel">
<field name="model" type="string" length="20" default="" primarykey="true"/>
<field name="vendor" type="string" length="40" default="" notnull="false"/>
<field name="model" type="string" length="20" primarykey="true"/>
<field name="vendor" type="string" length="40" notnull="false"/>
<field name="dns" type="integer" default="1" notnull="false"/>
<field name="buttons" type="integer" default="0" notnull="false"/>
<field name="loadimage" type="string" length="40" default="" notnull="false"/>
<field name="loadimage" type="string" length="40" notnull="false"/>
<field name="loadinformationid" type="string" length="30" notnull="false"/>
<field name="enabled" type="integer" default="0" notnull="false"/>
<field name="nametemplate" type="string" length="50" notnull="false"/>