- Installation procedure, detect chan_sccp
This commit is contained in:
parent
47f92a0c53
commit
c23a697234
|
@ -195,6 +195,8 @@ class srvinterface {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch ($res["vCode"]) {
|
switch ($res["vCode"]) {
|
||||||
|
case 0:
|
||||||
|
return 0;
|
||||||
case 433:
|
case 433:
|
||||||
return 433;
|
return 433;
|
||||||
|
|
||||||
|
@ -229,6 +231,10 @@ class srvinterface {
|
||||||
$result = array();
|
$result = array();
|
||||||
$ast_out = $this->sccp_version();
|
$ast_out = $this->sccp_version();
|
||||||
$result["Version"] = $ast_out[0];
|
$result["Version"] = $ast_out[0];
|
||||||
|
if ($ast_out[0] == '-1') {
|
||||||
|
$result["vCode"] = 0;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
$version_parts = explode(".", $ast_out[0]);
|
$version_parts = explode(".", $ast_out[0]);
|
||||||
$result["vCode"] = implode('', $version_parts);
|
$result["vCode"] = implode('', $version_parts);
|
||||||
if (!empty($ast_out[1]) && $ast_out[1] == 'develop') {
|
if (!empty($ast_out[1]) && $ast_out[1] == 'develop') {
|
||||||
|
@ -247,6 +253,9 @@ class srvinterface {
|
||||||
|
|
||||||
private function sccp_version() {
|
private function sccp_version() {
|
||||||
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_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)) {
|
if (preg_match("/Release.*\(/", $ast_out['data'], $matches)) {
|
||||||
$ast_out = substr($matches[0], 9, -1);
|
$ast_out = substr($matches[0], 9, -1);
|
||||||
return explode(' ', $ast_out);
|
return explode(' ', $ast_out);
|
||||||
|
|
23
install.php
23
install.php
|
@ -802,12 +802,12 @@ function CreateBackUpConfig() {
|
||||||
global $amp_conf;
|
global $amp_conf;
|
||||||
outn("<li>" . _("Create Config BackUp") . "</li>");
|
outn("<li>" . _("Create Config BackUp") . "</li>");
|
||||||
$cnf_int = \FreePBX::Config();
|
$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');
|
$backup_ext = array('_custom.conf', '.conf');
|
||||||
$dir = $cnf_int->get('ASTETCDIR');
|
$dir = $cnf_int->get('ASTETCDIR');
|
||||||
|
|
||||||
$filename = $dir.'/sccp_backup_'.date("Ymd").'.sql';
|
$fsql = $dir.'/sccp_backup_'.date("Ymd").'.sql';
|
||||||
$result = exec('mysqldump '.$amp_conf['AMPDBNAME'].' --password='.$amp_conf['AMPDBPASS'].' --user='.$amp_conf['AMPDBUSER'].' --single-transaction >'.$filename ,$output);
|
$result = exec('mysqldump '.$amp_conf['AMPDBNAME'].' --password='.$amp_conf['AMPDBPASS'].' --user='.$amp_conf['AMPDBUSER'].' --single-transaction >'.$fsql ,$output);
|
||||||
|
|
||||||
$zip = new \ZipArchive();
|
$zip = new \ZipArchive();
|
||||||
$filename = $dir . "/sccp_instal_backup" . date("Ymd"). ".zip";
|
$filename = $dir . "/sccp_instal_backup" . date("Ymd"). ".zip";
|
||||||
|
@ -819,10 +819,14 @@ function CreateBackUpConfig() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (file_exists($fsql)) {
|
||||||
|
$zip->addFile($fsql);
|
||||||
|
}
|
||||||
$zip->close();
|
$zip->close();
|
||||||
} else {
|
} else {
|
||||||
outn("<li>" . _("Error Create BackUp: ") . $filename ."</li>");
|
outn("<li>" . _("Error Create BackUp: ") . $filename ."</li>");
|
||||||
}
|
}
|
||||||
|
unlink($fsql);
|
||||||
outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>");
|
outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,14 +909,21 @@ CheckSCCPManagerDBTables($table_req);
|
||||||
#CheckPermissions();
|
#CheckPermissions();
|
||||||
CheckAsteriskVersion();
|
CheckAsteriskVersion();
|
||||||
$sccp_compatible = CheckChanSCCPCompatible();
|
$sccp_compatible = CheckChanSCCPCompatible();
|
||||||
|
if ($sccp_compatible == 0) {
|
||||||
|
// die_freepbx('Chan Sccp not Found. Install it before continuing');
|
||||||
|
outn("<br>");
|
||||||
|
outn("<font color='red'>Chan Sccp not Found. Install it before continuing !</font>");
|
||||||
|
die();
|
||||||
|
}
|
||||||
$db_config = Get_DB_config($sccp_compatible);
|
$db_config = Get_DB_config($sccp_compatible);
|
||||||
$sccp_db_ver = CheckSCCPManagerDBVersion();
|
$sccp_db_ver = CheckSCCPManagerDBVersion();
|
||||||
|
|
||||||
// BackUp Old config
|
// BackUp Old config
|
||||||
CreateBackUpConfig();
|
CreateBackUpConfig();
|
||||||
|
if ($sccp_compatible > 431) {
|
||||||
InstallDB_sccpuser();
|
InstallDB_sccpuser();
|
||||||
InstallDB_Buttons();
|
InstallDB_Buttons();
|
||||||
|
}
|
||||||
|
|
||||||
InstallDB_sccpsettings();
|
InstallDB_sccpsettings();
|
||||||
InstallDB_sccpdevmodel();
|
InstallDB_sccpdevmodel();
|
||||||
|
|
Loading…
Reference in a new issue