diff --git a/install.php b/install.php
index 2d71dc9..eb2caa9 100644
--- a/install.php
+++ b/install.php
@@ -711,7 +711,8 @@ DELIMITER ;";*/
if (DB::IsError($check)) {
die_freepbx("Can not modify sccpdevice table\n");
}
- outn("
" . $sql . "");
+ outn("" . _("(Re)Create trigger Ok") . "");
+// outn("" . $sql . "");
return true;
}
function InstallDB_updateDBVer($sccp_compatible) {
@@ -790,6 +791,29 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_compatible) {
}
return true;
}
+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_ext = array('_custom.conf', '.conf');
+ $dir = $cnf_int->get('ASTETCDIR');
+ $zip = new \ZipArchive();
+ $filename = $dir . "/sccp_instal_backup" . date("Ymd"). ".zip";
+ if ($zip->open($filename, \ZIPARCHIVE::CREATE)) {
+ foreach ($backup_files as $file) {
+ foreach ($backup_ext as $b_ext) {
+ if (file_exists($dir . '/'.$file . $b_ext)) {
+ $zip->addFile($dir . '/'.$file . $b_ext);
+ }
+ }
+ }
+ $zip->close();
+ } else {
+ outn("" . _("Error Create BackUp: ") . $filename ."");
+ }
+ outn("" . _("Create Config BackUp: ") . $filename ."");
+}
function Setup_RealTime() {
global $amp_conf;
@@ -802,7 +826,7 @@ function Setup_RealTime() {
$def_config = array('sccpdevice' => 'mysql,sccp,sccpdeviceconfig', 'sccpline' => ' mysql,sccp,sccpline');
$def_bd_config = array('dbhost' => $amp_conf['AMPDBHOST'], 'dbname' => $amp_conf['AMPDBNAME'],
'dbuser' => $amp_conf['AMPDBUSER'], 'dbpass' => $amp_conf['AMPDBPASS'],
- 'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock');
+ 'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock','dbcharset'=>'utf8');
$def_bd_sec = 'sccp';
$dir = $cnf_int->get('ASTETCDIR');
@@ -873,6 +897,9 @@ $sccp_compatible = CheckChanSCCPCompatible();
$db_config = Get_DB_config($sccp_compatible);
$sccp_db_ver = CheckSCCPManagerDBVersion();
+// BackUp Old config
+CreateBackUpConfig();
+
InstallDB_sccpusers();
InstallDB_Buttons();
diff --git a/uninstall.php b/uninstall.php
index 340e7dd..6090e0f 100644
--- a/uninstall.php
+++ b/uninstall.php
@@ -5,6 +5,31 @@
/* !TODO!: This would require the install.php to make a note of all the actions that were skipped and/or performed */
/* !TODO!: Might be a good idea to create a backup of the database before removing anything */
// !TODO!: -TODO-: I remove only that which is related to the Manager, it is in my opinion not a critical configuration information. This information is partially present in other files.
+/*
+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_ext = array('_custom.conf', '.conf');
+ $dir = $cnf_int->get('ASTETCDIR');
+ $zip = new \ZipArchive();
+ $filename = $dir . "/sccp_uninstall_backup" . date("Ymd"). ".zip";
+ if ($zip->open($filename, \ZIPARCHIVE::CREATE)) {
+ foreach ($backup_files as $file) {
+ foreach ($backup_ext as $b_ext) {
+ if (file_exists($dir . '/'.$file . $b_ext)) {
+ $zip->addFile($dir . '/'.$file . $b_ext);
+ }
+ }
+ }
+ $zip->close();
+ } else {
+ outn("" . _("Error Create BackUp: ") . $filename ."");
+ }
+ outn("" . _("Create Config BackUp: ") . $filename ."");
+}
+*/
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
global $db;