From 20ce9d0581329702773443828542188ae6528a8f Mon Sep 17 00:00:00 2001 From: PhantomVl Date: Wed, 1 Nov 2017 15:34:09 +0300 Subject: [PATCH] Begin resample Sccp_manager add system info --- README.md | 3 +- Sccp_manager.class.php | 10 ++-- Sccp_manager.inc/dbinterface.class.php | 3 +- Sccp_manager.inc/extconfigs.class.php | 3 +- Sccp_manager.inc/srvinterface.class.php | 3 +- conf/Sccp.class.php | 7 +-- conf/Sccp.class.php.v431 | 4 +- conf/sccpgeneral.xml | 12 ++++- conf/sccpgeneral.xml.v431 | 9 ++++ install.php | 2 +- uninstall.php | 27 ++++++----- views/server.info.php | 62 +++++++++++++++++++++++++ views/server.setting.php | 8 +--- 13 files changed, 119 insertions(+), 34 deletions(-) create mode 100644 views/server.info.php diff --git a/README.md b/README.md index e881b60..1b98001 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,8 @@ Make sure you have the following installed on your system: ### Requirements - Chan_SCCP module 4.3.0 (or later) channel driver for Asterisk: [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/Building-and-Installation-Guide) - configure flags ./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate + - Creating mysql DB from sorce (mysql -u root asterisk < mysql-v5_enum.sql) -- Real Time cofiguration for Chan_SCCP - - Creating mysql DB from sorce (mysql -u root asterisk < mysql-v5.sql) - TFTP Server running under (recomended) /tftpboot/ [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-tftp-service) - You will need the phone settings templates. You can use the templates taken from the distribution "chan-sccp" diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index 0a4b6e9..69cd42f 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -70,7 +70,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { // private $SCCP_LANG_DICTIONARY = 'SCCP-dictionary.xml'; // CISCO LANG file search in /tftp-path private $SCCP_LANG_DICTIONARY = 'be-sccp.jar'; // CISCO LANG file search in /tftp-path private $pagedata = null; - private $sccp_driver_ver = '11.2'; + private $sccp_driver_ver = '11.3'; private $tftpLang = array(); private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! private $val_null = 'NONE'; /// REPLACE to null Field @@ -348,6 +348,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { "name" => _("Advanced SCCP Settings"), "page" => 'views/server.advanced.php' ), + "sccpinfo" => array( + "name" => _("SCCP info"), + "page" => 'views/server.info.php' + ), ); foreach ($this->pagedata as &$page) { @@ -1469,10 +1473,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { if (empty($driver['sccp'])) { $driver_replace = 'yes'; } else { - if (empty($driver['sccp']['sccp_driver_ver'])) { + if (empty($driver['sccp']['Version'])) { $driver_replace = 'yes'; } else { - if ($driver['sccp']['sccp_driver_ver'] != $this->sccp_driver_ver){ + if ($driver['sccp']['Version'] != $this->sccp_driver_ver){ $driver_replace = 'yes'; } } diff --git a/Sccp_manager.inc/dbinterface.class.php b/Sccp_manager.inc/dbinterface.class.php index affd81a..26915c9 100644 --- a/Sccp_manager.inc/dbinterface.class.php +++ b/Sccp_manager.inc/dbinterface.class.php @@ -13,7 +13,8 @@ class dbinterface { public function __construct() { } public function info() { - return Array('Ver' =>'Data access interface'); + return Array('Version' => '13.0.2', + 'about' =>'Data access interface v. 13.0.2'); } /* diff --git a/Sccp_manager.inc/extconfigs.class.php b/Sccp_manager.inc/extconfigs.class.php index 9573dfd..793e1e9 100644 --- a/Sccp_manager.inc/extconfigs.class.php +++ b/Sccp_manager.inc/extconfigs.class.php @@ -9,7 +9,8 @@ class extconfigs { } public function info() { - return Array('Ver' =>'Default Setings and Enums'); + return Array('Version' => '13.0.2', + 'about' =>'Default Setings and Enums ver: 13.0.2'); } public function getextConfig($id = '', $index = '') { diff --git a/Sccp_manager.inc/srvinterface.class.php b/Sccp_manager.inc/srvinterface.class.php index 9e0cf28..c9f7282 100644 --- a/Sccp_manager.inc/srvinterface.class.php +++ b/Sccp_manager.inc/srvinterface.class.php @@ -13,7 +13,8 @@ class srvinterface { public function __construct() { } public function info() { - return Array('Ver' =>'server interface data'); + return Array('Version' => '13.0.2', + 'about' =>'Server interface data ver 13.0.2'); } /* diff --git a/conf/Sccp.class.php b/conf/Sccp.class.php index 7eff4be..b827f54 100644 --- a/conf/Sccp.class.php +++ b/conf/Sccp.class.php @@ -22,8 +22,8 @@ class Sccp extends \FreePBX\modules\Core\Driver { "prettyName" => _("Sccp Custom Driver"), "shortName" => "SCCP", "description" => _("Sccp Device"), - "sccp_driver_ver" => "11.2", - "about" => "Sccp mysql class Base ver: 11.2, Sccp ver: default" + "Version" => "11.3", + "about" => "Sccp mysql class Base ver: 11.3, Sccp ver: default" ); } @@ -79,7 +79,8 @@ class Sccp extends \FreePBX\modules\Core\Driver { public function getDevice($id) { $sccp_line = array(); - $sql = "SELECT name as id, name as name"; +// $sql = "SELECT name as id, name as name"; + $sql = "SELECT name as id, name as name "; foreach($this->data_fld as $key => $val) { $sql .= ',`'. $key .'` as '.$val; } diff --git a/conf/Sccp.class.php.v431 b/conf/Sccp.class.php.v431 index a5abfbd..456bd90 100644 --- a/conf/Sccp.class.php.v431 +++ b/conf/Sccp.class.php.v431 @@ -29,8 +29,8 @@ class Sccp extends \FreePBX\modules\Core\Driver { "prettyName" => _("Sccp Custom Driver"), "shortName" => "SCCP", "description" => _("Sccp Device"), - "sccp_driver_ver" => "11.2", - "about" => "Sccp mysql class Base ver: 11.2, Sccp ver: 431" + "Version" => "11.3", + "about" => "Sccp mysql class Base ver: 11.3, Sccp ver: 431" ); } public function addDevice1($id, $settings) { diff --git a/conf/sccpgeneral.xml b/conf/sccpgeneral.xml index 8ee1c21..c28fae1 100644 --- a/conf/sccpgeneral.xml +++ b/conf/sccpgeneral.xml @@ -5,7 +5,17 @@ To change this template file, choose Tools | Templates and open the template in the editor. Base Version before all crash :-) --> - + + XML_info + NONE + + + + + + + + dev_sshUserId diff --git a/conf/sccpgeneral.xml.v431 b/conf/sccpgeneral.xml.v431 index ca8c345..c4e5500 100644 --- a/conf/sccpgeneral.xml.v431 +++ b/conf/sccpgeneral.xml.v431 @@ -5,6 +5,15 @@ To change this template file, choose Tools | Templates and open the template in the editor. Base Version before all crash :-) --> + + XML_info + NONE + + + + + + diff --git a/install.php b/install.php index 8371446..f8eb48a 100644 --- a/install.php +++ b/install.php @@ -668,7 +668,7 @@ function Setup_RealTime() { } CheckSCCPManagerDBTables($table_req); -CheckPermissions(); +#CheckPermissions(); CheckAsteriskVersion(); $sccp_compatible = CheckChanSCCPСomatable(); $db_config = Get_DB_config($sccp_compatible); diff --git a/uninstall.php b/uninstall.php index 18ddcfa..fd0e833 100644 --- a/uninstall.php +++ b/uninstall.php @@ -2,20 +2,23 @@ /* $Id:$ */ if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } - global $db; - $version = FreePBX::Config()->get('ASTVERSION'); + global $db; + $version = FreePBX::Config()->get('ASTVERSION'); - echo "dropping table sccpdevmodel.."; - sql("DROP TABLE IF EXISTS `sccpdevmodel`"); - echo "dropping table sccpsettings.."; - sql("DROP TABLE IF EXISTS `sccpsettings`"); - if (!empty($version)) { + echo "dropping table sccpdevmodel.."; + sql("DROP TABLE IF EXISTS `sccpdevmodel`"); + echo "dropping table sccpsettings.."; + sql("DROP TABLE IF EXISTS `sccpsettings`"); + if (!empty($version)) { // Woo, we have a version - if (version_compare($version, "14.0.0", "<=")) { - echo "Deleting key FROM kvstore.."; - sql("DELETE FROM kvstore WHERE module = 'sccpsettings'"); - sql("DELETE FROM kvstore WHERE module = 'Sccp_manager'"); - } + + $check = $db->getRow("SELECT 1 FROM `kvstore` LIMIT 0", DB_FETCHMODE_ASSOC); + if (!(DB::IsError($check))) { + //print_r("none, creating table :". $value); + echo "Deleting key FROM kvstore.."; + sql("DELETE FROM kvstore WHERE module = 'sccpsettings'"); + sql("DELETE FROM kvstore WHERE module = 'Sccp_manager'"); + } /* Comment: Maybe save in sccpsettings, if the chan_sccp tables already existed in the database or if they were created by install.php */ /* So that you know if it is save to drop/delete them */ diff --git a/views/server.info.php b/views/server.info.php new file mode 100644 index 0000000..9b35e97 --- /dev/null +++ b/views/server.info.php @@ -0,0 +1,62 @@ +sccp_conf_init); +// print_r($this->sccpvalues); +//$core = $this->srvinterface->getCoreSCCPVersion(); +//print_r($core); +//print_r('

'); + +$driver = $this->FreePBX->Core->getAllDriversInfo(); +$core = $this->srvinterface->getChanSCCPVersion(); +$info = array(); +$info['srvinterface'] = $this->srvinterface->info(); +$info['extconfigs'] = $this->extconfigs->info(); +$info['dbinterface'] = $this->dbinterface->info(); +$info['sccp_class'] = $driver['sccp']; +$info['Core_sccp'] = array('Version' => $core['Version'], 'about'=> 'Sccp ver.'. $core['Version'].' r'.$core['vCode']. ' Revision :'. $core['RevisionNum']); +$info['Asterisk'] = array('Version' => FreePBX::Config()->get('ASTVERSION'), 'about'=> 'Asterisk.'); +$info['Сompatible'] = array('Version' => $this->srvinterface->get_compatible_sccp(), 'about'=> ''); +//print_r('

'); + +//print_r($this->srvinterface->info()); +//print_r($this->extconfigs->info()); +//print_r($this->dbinterface->info()); + +// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK'); +// print_r('
'); +// print_r(timezone_identifiers_list()); +// print_r('
'); + +?> +
+
+
+

Sccp Manager Info

+
+ + + + + + + + + + $value) { + echo ''; + } + ?> + +
ModuleVersionInfo
' . $key . '' . $value['Version'] . '' . $value['about'] . '
+
+
+
+
+ShowGroup('sccp_info',0); ?> + diff --git a/views/server.setting.php b/views/server.setting.php index 577a2d9..5e82364 100644 --- a/views/server.setting.php +++ b/views/server.setting.php @@ -5,13 +5,7 @@ * and open the template in the editor. */ // vim: set ai ts=4 sw=4 ft=phtml: -// print_r($this->sccp_conf_init); -// print_r($this->sccpvalues); -// print_r($this->srvinterface->getCoreSCCPVersion()); -// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK'); -// print_r('
'); -// print_r(timezone_identifiers_list()); -// print_r('
'); + ?>