Update TZ selection method
Change Cisco code determination
This commit is contained in:
parent
50d2f25326
commit
84925a334e
|
@ -1069,6 +1069,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
}
|
}
|
||||||
|
|
||||||
$driver = $this->FreePBX->Core->getAllDriversInfo();
|
$driver = $this->FreePBX->Core->getAllDriversInfo();
|
||||||
|
// Below is always set to replace; good for Develop, but needs to be updated for release
|
||||||
$sccp_driver_replace = '';
|
$sccp_driver_replace = '';
|
||||||
if (empty($driver['sccp'])) {
|
if (empty($driver['sccp'])) {
|
||||||
$sccp_driver_replace = 'yes';
|
$sccp_driver_replace = 'yes';
|
||||||
|
@ -1084,7 +1085,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
|
|
||||||
$this->sccpvalues['sccp_compatible'] = array('keyword' => 'sccp_compatible', 'data' => $ver_id, 'type' => '1', 'seq' => '99');
|
$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, $sccp_driver_replace);
|
||||||
$driver = $this->FreePBX->Core->getAllDriversInfo(); // ??????
|
$driver = $this->FreePBX->Core->getAllDriversInfo(); // Check that Sccp Driver has been updated by above
|
||||||
|
|
||||||
$read_config = $this->cnf_read->getConfig('sccp.conf');
|
$read_config = $this->cnf_read->getConfig('sccp.conf');
|
||||||
$this->sccp_conf_init['general'] = $read_config['general'];
|
$this->sccp_conf_init['general'] = $read_config['general'];
|
||||||
|
|
|
@ -14,15 +14,13 @@ class extconfigs
|
||||||
$this->paren_class = $parent_class;
|
$this->paren_class = $parent_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function info()
|
public function info() {
|
||||||
{
|
$Ver = '13.1.1';
|
||||||
$Ver = '13.0.3';
|
|
||||||
return array('Version' => $Ver,
|
return array('Version' => $Ver,
|
||||||
'about' => 'Default Setings and Enums ver: ' . $Ver);
|
'about' => 'Default Setings and Enums ver: ' . $Ver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getextConfig($id = '', $index = '')
|
public function getextConfig($id = '', $index = '') {
|
||||||
{
|
|
||||||
switch ($id) {
|
switch ($id) {
|
||||||
case 'keyset':
|
case 'keyset':
|
||||||
$result = $this->keysetdefault;
|
$result = $this->keysetdefault;
|
||||||
|
@ -47,7 +45,7 @@ class extconfigs
|
||||||
return $tmp_ofset / 60;
|
return $tmp_ofset / 60;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'sccp_timezone': // Sccp manafer: 1400 (+ Id) :2007 (+ Id)
|
case 'sccp_timezone': // Sccp manager: 1303; server_info: 122
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
if (empty($index)) {
|
if (empty($index)) {
|
||||||
|
@ -59,15 +57,26 @@ class extconfigs
|
||||||
$timezone_abbreviations = \DateTimeZone::listAbbreviations();
|
$timezone_abbreviations = \DateTimeZone::listAbbreviations();
|
||||||
|
|
||||||
$tz_tmp = array();
|
$tz_tmp = array();
|
||||||
foreach ($timezone_abbreviations as $subArray) {
|
foreach ($timezone_abbreviations as $key=>$subArray) {
|
||||||
$tf_idt = array_search($index, array_column($subArray, 'timezone_id'));
|
$tf_idt = array_search($index, array_column($subArray, 'timezone_id'));
|
||||||
if (!empty($tf_idt)) {
|
if (!empty($tf_idt)) {
|
||||||
$tz_tmp[] = $subArray[$tf_idt];
|
$tz_tmp[$key] = $subArray[$tf_idt];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($tz_tmp)) {
|
if (empty($tz_tmp)) {
|
||||||
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// as php DateTimeZone::listAbbreviations() has multiple historic Values
|
||||||
|
// Need to find one that matches this machine offset.
|
||||||
|
|
||||||
|
//Now find out if DST is used here. Test if DST setting is different in 6 months
|
||||||
|
$haveDstNow = date('I');
|
||||||
|
$futureDate = (new \DateTime(null,new \DateTimeZone($index)))->modify('+6 months');
|
||||||
|
dbug('now is',$haveDstNow);
|
||||||
|
dbug('future date', $futureDate->format('I'));
|
||||||
|
|
||||||
|
|
||||||
if (count($tz_tmp)==1) {
|
if (count($tz_tmp)==1) {
|
||||||
$time_set = $tz_tmp[0];
|
$time_set = $tz_tmp[0];
|
||||||
|
@ -81,6 +90,8 @@ class extconfigs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Should now have a match on offset.
|
||||||
$tmp_ofset = $time_set['offset'] / 60;
|
$tmp_ofset = $time_set['offset'] / 60;
|
||||||
$tmp_dli = (empty($time_set['dst']) ? '' : 'Daylight' );
|
$tmp_dli = (empty($time_set['dst']) ? '' : 'Daylight' );
|
||||||
foreach ($this->cisco_timezone as $key => $value) {
|
foreach ($this->cisco_timezone as $key => $value) {
|
||||||
|
@ -109,11 +120,6 @@ class extconfigs
|
||||||
|
|
||||||
private function get_cisco_time_zone($tzc)
|
private function get_cisco_time_zone($tzc)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((empty($tzc)) or (!array_key_exists($tzc, $this->cisco_timezone))) {
|
|
||||||
// return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
$tzdata = $this->cisco_timezone[$tzc];
|
$tzdata = $this->cisco_timezone[$tzc];
|
||||||
$cisco_code = $tzc . ' Standard' . ((empty($tzdata['daylight'])) ? '' : '/' . $tzdata['daylight']) . ' Time';
|
$cisco_code = $tzc . ' Standard' . ((empty($tzdata['daylight'])) ? '' : '/' . $tzdata['daylight']) . ' Time';
|
||||||
if (isset($tzdata['cisco_code'])) {
|
if (isset($tzdata['cisco_code'])) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ if ($mysql_info['Value'] <= '2000') {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check Time Zone comatable
|
// Check Time Zone compatibility
|
||||||
$conf_tz = $this->sccpvalues['ntp_timezone']['data'];
|
$conf_tz = $this->sccpvalues['ntp_timezone']['data'];
|
||||||
$cisco_tz = $this->extconfigs->getextConfig('sccp_timezone', $conf_tz);
|
$cisco_tz = $this->extconfigs->getextConfig('sccp_timezone', $conf_tz);
|
||||||
if ($cisco_tz['offset'] == 0) {
|
if ($cisco_tz['offset'] == 0) {
|
||||||
|
|
Loading…
Reference in a new issue