function siremisFillDB() { siremisReplaceDbConfig(); BizSystem::log(LOG_DEBUG, "SIREMIS", "install module siremis sql - " . $_REQUEST['db1type']); if ($_REQUEST['db1type'] == "Pdo_Pgsql" || $_REQUEST['db1type'] == "pdo_pgsql") { $sqlfile = MODULE_PATH . "/ser/mod.install.siremis.pgsql.sql"; } else { $sqlfile = MODULE_PATH . "/ser/mod.install.siremis.sql"; } if (!file_exists($sqlfile)) { return true; } // Getting the SQL file content $query = trim(file_get_contents($sqlfile)); if (empty($query)) { return true; } // $db = BizSystem::dbConnection("Serdb"); $db = siremisConnectDB(); include_once MODULE_PATH . "/system/lib/MySQLDumpParser.php"; $queryArr = MySQLDumpParser::parse($query); foreach ($queryArr as $query) { try { $db->exec($query); } catch (Exception $e) { BizSystem::log(LOG_DEBUG, "SIREMIS", $e->getMessage()); echo 'ERROR: ' . $e->getMessage(); exit; } } return true; }
echo 'ERROR: Data was not populated into database.'; exit; } } if (isset($_REQUEST['loadsip_db'])) { if (!siremisFillDB()) { echo 'ERROR: Data was not populated into SIP database.'; exit; } } if (isset($_REQUEST['replace_db'])) { if (!replaceDbConfig()) { echo 'ERROR: Database config was not updated.'; exit; } if (!siremisReplaceDbConfig()) { echo 'ERROR: Database config was not replaced.'; exit; } } echo 'SUCCESS - actions completed, wait one second ...'; exit; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Siremis Installation</title> <meta http-equiv="x-ua-compatible" content="ie=7" /> <link rel="stylesheet" href="install.css" type="text/css" />