Merge pull request #99 from steve-lad/Fix-Installer
Installer failed to update db version
This commit is contained in:
commit
30ba68d03e
32
install.php
32
install.php
|
@ -398,14 +398,14 @@ function CheckSCCPManagerDBTables($table_req)
|
||||||
function CheckSCCPManagerDBVersion()
|
function CheckSCCPManagerDBVersion()
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
outn("<li>" . _("Checking for previw version Sccp_manager..") . "</li>");
|
outn("<li>" . _("Checking for previous version of Sccp_manager.") . "</li>");
|
||||||
$check = $db->getRow("SELECT data FROM `sccpsettings` where keyword ='sccp_compatible'", DB_FETCHMODE_ASSOC);
|
$check = $db->getRow("SELECT data FROM `sccpsettings` where keyword ='sccp_compatible'", DB_FETCHMODE_ASSOC);
|
||||||
if (DB::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
outn(_("Can't find previw version : "));
|
outn(_("No previous version found "));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!empty($check['data'])) {
|
if (!empty($check['data'])) {
|
||||||
outn(_("Find DB Schema : " . $check['data']));
|
outn(_("Found DB Schema : " . $check['data']));
|
||||||
return $check['data'];
|
return $check['data'];
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -472,7 +472,7 @@ function InstallDB_Buttons()
|
||||||
KEY `ref` (`ref`,`reftype`)
|
KEY `ref` (`ref`,`reftype`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
||||||
$check = $db->query($sql);
|
$check = $db->query($sql);
|
||||||
if (db::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
die_freepbx("Can not create sccpbuttonconfig table, error:$check\n");
|
die_freepbx("Can not create sccpbuttonconfig table, error:$check\n");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -490,7 +490,7 @@ function InstallDB_sccpsettings()
|
||||||
PRIMARY KEY (`keyword`,`seq`,`type`)
|
PRIMARY KEY (`keyword`,`seq`,`type`)
|
||||||
);";
|
);";
|
||||||
$check = $db->query($sql);
|
$check = $db->query($sql);
|
||||||
if (db::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
die_freepbx("Can not create sccpsettings table, error:$check\n");
|
die_freepbx("Can not create sccpsettings table, error:$check\n");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -513,7 +513,7 @@ function InstallDB_sccpdevmodel()
|
||||||
KEY `model` (`model`)
|
KEY `model` (`model`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
||||||
$check = $db->query($sql);
|
$check = $db->query($sql);
|
||||||
if (db::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -536,7 +536,7 @@ function InstallDB_sccpuser()
|
||||||
PRIMARY KEY (`name`)
|
PRIMARY KEY (`name`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
||||||
$check = $db->query($sql);
|
$check = $db->query($sql);
|
||||||
if (db::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -647,7 +647,7 @@ function InstallDB_updateSchema($db_config)
|
||||||
outn("<li>" . _("Create New table") . "</li>");
|
outn("<li>" . _("Create New table") . "</li>");
|
||||||
$sql_create = "ALTER TABLE `" . $tabl_name . "` " . substr($sql_create, 0, -2);
|
$sql_create = "ALTER TABLE `" . $tabl_name . "` " . substr($sql_create, 0, -2);
|
||||||
$check = $db->query($sql_create);
|
$check = $db->query($sql_create);
|
||||||
if (db::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
die_freepbx("Can not create " . $tabl_name . " table sql: " . $sql_create . "n");
|
die_freepbx("Can not create " . $tabl_name . " table sql: " . $sql_create . "n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -656,7 +656,7 @@ function InstallDB_updateSchema($db_config)
|
||||||
|
|
||||||
$sql_modify = "ALTER TABLE `" . $tabl_name . "` " . substr($sql_modify, 0, -2) . ';';
|
$sql_modify = "ALTER TABLE `" . $tabl_name . "` " . substr($sql_modify, 0, -2) . ';';
|
||||||
$check = $db->query($sql_modify);
|
$check = $db->query($sql_modify);
|
||||||
if (db::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
out("<li>" . print_r($check, 1) . "</li>");
|
out("<li>" . print_r($check, 1) . "</li>");
|
||||||
die("Can not modify " . $tabl_name . " table sql: " . $sql_modify . "n");
|
die("Can not modify " . $tabl_name . " table sql: " . $sql_modify . "n");
|
||||||
die_freepbx("Can not modify " . $tabl_name . " table sql: " . $sql_modify . "n");
|
die_freepbx("Can not modify " . $tabl_name . " table sql: " . $sql_modify . "n");
|
||||||
|
@ -686,7 +686,7 @@ function InstallDB_fillsccpdevmodel()
|
||||||
"('9951-sip', 'CISCO-SIP', 1, 1, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template'),".
|
"('9951-sip', 'CISCO-SIP', 1, 1, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template'),".
|
||||||
"('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
|
"('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
|
||||||
$check = $db->query($sql);
|
$check = $db->query($sql);
|
||||||
if (db::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -742,10 +742,10 @@ function InstallDB_updateDBVer($sccp_compatible)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
outn("<li>" . _("Update DB Ver") . "</li>");
|
outn("<li>" . _("Update DB Ver") . "</li>");
|
||||||
$sql = "REPLACE INTO `sccpsettings` (`keyword`, `data`, `seq`, `type`), VALUES ('SccpDBmodel', '". $sccp_compatible. "','30','0');";
|
$sql = "REPLACE INTO `sccpsettings` (`keyword`, `data`, `seq`, `type`) VALUES ('SccpDBmodel', '". $sccp_compatible. "','30','0');";
|
||||||
$results = $db->query($sql);
|
$results = $db->query($sql);
|
||||||
if (DB::IsError($check)) {
|
if (DB::IsError($results)) {
|
||||||
die_freepbx(sprintf(_("Error updating sccpdeviceconfig view. Command was: %s; error was: %s "), $sql, $results->getMessage()));
|
die_freepbx(sprintf(_("Error updating sccpsettings. Command was: %s; error was: %s "), $sql, $results->getMessage()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -830,7 +830,7 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_compatible)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$results = $db->query($sql);
|
$results = $db->query($sql);
|
||||||
if (DB::IsError($check)) {
|
if (DB::IsError($results)) {
|
||||||
die_freepbx(sprintf(_("Error updating sccpdeviceconfig view. Command was: %s; error was: %s "), $sql, $results->getMessage()));
|
die_freepbx(sprintf(_("Error updating sccpdeviceconfig view. Command was: %s; error was: %s "), $sql, $results->getMessage()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -998,10 +998,10 @@ InstallDB_updateDBVer($sccp_compatible);
|
||||||
if (!$sccp_db_ver) {
|
if (!$sccp_db_ver) {
|
||||||
Setup_RealTime();
|
Setup_RealTime();
|
||||||
outn("<br>");
|
outn("<br>");
|
||||||
outn("Install Complite !");
|
outn("Install Complete !");
|
||||||
} else {
|
} else {
|
||||||
outn("<br>");
|
outn("<br>");
|
||||||
outn("Update Complite !");
|
outn("Update Complete !");
|
||||||
}
|
}
|
||||||
outn("<br>");
|
outn("<br>");
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ if (!defined('FREEPBX_IS_AUTH')) {
|
||||||
global $db;
|
global $db;
|
||||||
$version = FreePBX::Config()->get('ASTVERSION');
|
$version = FreePBX::Config()->get('ASTVERSION');
|
||||||
|
|
||||||
out('Remove all SCCP tables');
|
out('Removing all Sccp_manager tables');
|
||||||
$tables = array('sccpdevmodel', 'sccpsettings');
|
$tables = array('sccpdevmodel', 'sccpsettings');
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
$sql = "DROP TABLE IF EXISTS {$table}";
|
$sql = "DROP TABLE IF EXISTS {$table}";
|
||||||
|
@ -52,13 +52,13 @@ if (!empty($version)) {
|
||||||
$check = $db->getRow("SELECT 1 FROM `kvstore` LIMIT 0", DB_FETCHMODE_ASSOC);
|
$check = $db->getRow("SELECT 1 FROM `kvstore` LIMIT 0", DB_FETCHMODE_ASSOC);
|
||||||
if (!(DB::IsError($check))) {
|
if (!(DB::IsError($check))) {
|
||||||
//print_r("none, creating table :". $value);
|
//print_r("none, creating table :". $value);
|
||||||
echo "Deleting key FROM kvstore..";
|
echo "Deleting keys FROM kvstore..";
|
||||||
sql("DELETE FROM kvstore WHERE module = 'sccpsettings'");
|
sql("DELETE FROM kvstore WHERE module = 'sccpsettings'");
|
||||||
sql("DELETE FROM kvstore WHERE module = 'Sccp_manager'");
|
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 */
|
/* 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 */
|
/* So that you know if it is safe to drop/delete them */
|
||||||
|
|
||||||
/* DROP VIEW IF EXISTS`sccpdeviceconfig`;
|
/* DROP VIEW IF EXISTS`sccpdeviceconfig`;
|
||||||
DROP TABLE IF EXISTS `sccpbuttonconfig`;
|
DROP TABLE IF EXISTS `sccpbuttonconfig`;
|
||||||
|
|
Loading…
Reference in a new issue