diff --git a/Sccp_manager.inc/srvinterface.class.php b/Sccp_manager.inc/srvinterface.class.php index eaf5664..0f4933b 100644 --- a/Sccp_manager.inc/srvinterface.class.php +++ b/Sccp_manager.inc/srvinterface.class.php @@ -195,6 +195,8 @@ class srvinterface { return 0; } switch ($res["vCode"]) { + case 0: + return 0; case 433: return 433; @@ -229,6 +231,10 @@ class srvinterface { $result = array(); $ast_out = $this->sccp_version(); $result["Version"] = $ast_out[0]; + if ($ast_out[0] == '-1') { + $result["vCode"] = 0; + return $result; + } $version_parts = explode(".", $ast_out[0]); $result["vCode"] = implode('', $version_parts); if (!empty($ast_out[1]) && $ast_out[1] == 'develop') { @@ -247,6 +253,9 @@ class srvinterface { private function sccp_version() { $ast_out = $this->sccp_core_commands(array('cmd' => 'get_version')); + if ( ($ast_out['Response'] == 'Error') || (strpos($ast_out['data'], 'No such command') != false) ) { + return array('-1'); + } if (preg_match("/Release.*\(/", $ast_out['data'], $matches)) { $ast_out = substr($matches[0], 9, -1); return explode(' ', $ast_out); diff --git a/install.php b/install.php index fbcfc27..4d908ce 100644 --- a/install.php +++ b/install.php @@ -802,12 +802,12 @@ function CreateBackUpConfig() { global $amp_conf; outn("
  • " . _("Create Config BackUp") . "
  • "); $cnf_int = \FreePBX::Config(); - $backup_files = array('extconfig','extconfig','res_mysql', 'res_config_mysql','sccp'); + $backup_files = array('extensions','extconfig','res_mysql', 'res_config_mysql','sccp'); $backup_ext = array('_custom.conf', '.conf'); $dir = $cnf_int->get('ASTETCDIR'); - $filename = $dir.'/sccp_backup_'.date("Ymd").'.sql'; - $result = exec('mysqldump '.$amp_conf['AMPDBNAME'].' --password='.$amp_conf['AMPDBPASS'].' --user='.$amp_conf['AMPDBUSER'].' --single-transaction >'.$filename ,$output); + $fsql = $dir.'/sccp_backup_'.date("Ymd").'.sql'; + $result = exec('mysqldump '.$amp_conf['AMPDBNAME'].' --password='.$amp_conf['AMPDBPASS'].' --user='.$amp_conf['AMPDBUSER'].' --single-transaction >'.$fsql ,$output); $zip = new \ZipArchive(); $filename = $dir . "/sccp_instal_backup" . date("Ymd"). ".zip"; @@ -819,10 +819,14 @@ function CreateBackUpConfig() { } } } + if (file_exists($fsql)) { + $zip->addFile($fsql); + } $zip->close(); } else { outn("
  • " . _("Error Create BackUp: ") . $filename ."
  • "); } + unlink($fsql); outn("
  • " . _("Create Config BackUp: ") . $filename ."
  • "); } @@ -905,14 +909,21 @@ CheckSCCPManagerDBTables($table_req); #CheckPermissions(); CheckAsteriskVersion(); $sccp_compatible = CheckChanSCCPCompatible(); +if ($sccp_compatible == 0) { +// die_freepbx('Chan Sccp not Found. Install it before continuing'); + outn("
    "); + outn("Chan Sccp not Found. Install it before continuing !"); + die(); +} $db_config = Get_DB_config($sccp_compatible); $sccp_db_ver = CheckSCCPManagerDBVersion(); // BackUp Old config CreateBackUpConfig(); - -InstallDB_sccpuser(); -InstallDB_Buttons(); +if ($sccp_compatible > 431) { + InstallDB_sccpuser(); + InstallDB_Buttons(); +} InstallDB_sccpsettings(); InstallDB_sccpdevmodel();