diff --git a/Sccp_manager.inc/dbinterface.class.php b/Sccp_manager.inc/dbinterface.class.php index ebeaea5..ce2eb80 100644 --- a/Sccp_manager.inc/dbinterface.class.php +++ b/Sccp_manager.inc/dbinterface.class.php @@ -210,8 +210,9 @@ class dbinterface { } return $result; } + /* - * Replace by SccpTables !!!! + * My be Replace by SccpTables ??! * */ public function dump_sccp_tables($data_path, $database, $user, $pass ) { @@ -219,5 +220,44 @@ class dbinterface { $result = exec('mysqldump '.$database.' --password='.$pass.' --user='.$user.' --single-transaction >'.$filename ,$output); return $filename; } + +/* + * Check Table structure + */ + public function validate() { + global $db; + $check_fields = array('430' => array('_hwlang' => "varchar(12)"), '431' => array('private'=> "enum('on','off')"), '433' => array('directed_pickup'=>'') ); + $sql = "DESCRIBE `sccpdevice`;"; + $raw_result = sql($sql, "getAll", DB_FETCHMODE_ASSOC); + $result = 0; + foreach ($raw_result as $value) { + $id_result[$value['Field']] = $value['Type']; + } + foreach ($check_fields as $key => $value) { + $sub_result = true; + foreach($value as $skey => $svalue) { + if (!empty($svalue) ) { + if (empty($id_result[$skey])) { + $sub_result = false; + } else { + if (strtolower($id_result[$skey]) != strtolower($svalue)) { + $sub_result = false; + } + } + } else { + if (!empty($id_result[$skey])) { + $sub_result = false; + } + } + } + if ($sub_result) { + $result = $key; + } else { + break; + } + } + + return $result; + } } diff --git a/views/server.info.php b/views/server.info.php index 5449cbc..47466a7 100644 --- a/views/server.info.php +++ b/views/server.info.php @@ -27,6 +27,8 @@ $info = array(); $info['srvinterface'] = $this->srvinterface->info(); $info['extconfigs'] = $this->extconfigs->info(); $info['dbinterface'] = $this->dbinterface->info(); +$db_Schema = $this->dbinterface->validate(); + $info['XML'] = $this->xmlinterface->info(); $info['sccp_class'] = $driver['sccp']; $info['Core_sccp'] = array('Version' => $core['Version'], 'about'=> 'Sccp ver.'. $core['Version'].' r'.$core['vCode']. ' Revision :'. $core['RevisionNum']. ' Hash :'. $core['RevisionHash']); @@ -47,6 +49,12 @@ if (!empty($this->sccpvalues['SccpDBmodel'])) { $info['Сompatible']['about'] = '
Reinstall SCCP manager required
'; } } +if ($db_Schema == 0) { + $info['DB_Schema'] = array('Version' => 'Error', 'about'=> '
ERROR DB Version
'); +} else { + $info['DB_Schema'] = array('Version' => $db_Schema, 'about'=> (($this->srvinterface->get_compatible_sccp() == $db_Schema ) ? 'Ok' : 'Incompatable Version')); +} + if (empty($ast_realtime)) { $info['RealTime'] = array('Version' => 'Error', 'about'=> '
No found Real Time connections
'); } else { @@ -86,25 +94,25 @@ if (empty($conf_realtime)) { print_r("
Request:
");
  $json = '';
  print_r("
"); - print_r($conf_realtime); +// print_r($conf_realtime); print_r("
"); print_r("
"); - print_r($ast_realtime); + print_r($this->dbinterface->validate()); // print_r("DIRECT START"); - print_r($this->sccpvalues['ccm_address']); +// print_r($this->sccpvalues['ccm_address']); print_r("
"); // print_r($this->getIP_information2()); // print_r($this->srvinterface->getеtestChanSCCP_GlablsInfo()); // print_r($this->sccp_metainfo); print("
"); -*/ + // $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK'); // print_r('
'); // print_r(timezone_identifiers_list()); // print_r('
'); //print_r($this->dbinterface->info()); - +*/ if (!empty($this->class_error)) { ?>