Added new languages, updated translations, changed sql installation
Separated language in db dump, makes it easier for me to update Added commit alongside the version in the generated config file
This commit is contained in:
parent
65ae062a96
commit
895e36c8ec
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -44,24 +44,39 @@ if (!empty($_POST)) {
|
|||
if (isset($dbconfig)) {
|
||||
try {
|
||||
$db = new Medoo($dbconfig);
|
||||
$sqlfile = $usingMysql ? "dbinstall_mysql" : "dbinstall_sqlite";
|
||||
$sqlquery = file_get_contents(__DIR__ . "/../$sqlfile.sql");
|
||||
|
||||
$sqlfiles = [];
|
||||
|
||||
if ($usingMysql) {
|
||||
$sqlfiles = [
|
||||
"dbinstall_mysql",
|
||||
"dbinstall_mysql_lang"
|
||||
];
|
||||
} else {
|
||||
// no other option yet
|
||||
}
|
||||
|
||||
foreach ($sqlfiles as $file) {
|
||||
$sqlquery = file_get_contents(__DIR__ . "/../$file.sql");
|
||||
|
||||
if($sqlquery === false) {
|
||||
$errormessage = "Cannot read $sqlfile.sql file!";
|
||||
} else {
|
||||
throw new Exception("Cannot read SQL file: $file.sql");
|
||||
}
|
||||
|
||||
$sqlquery = str_replace("DBPREFIX", $dbprefix, $sqlquery);
|
||||
$sqlresult = $db->pdo->exec($sqlquery);
|
||||
|
||||
if($sqlresult === false) {
|
||||
if ($sqlresult === false) {
|
||||
throw new Exception("EXEC returned false");
|
||||
}
|
||||
}
|
||||
|
||||
// if all queries succeeded, create a config file and save connection info there
|
||||
$phpcode = <<<EOT
|
||||
<?php
|
||||
/*
|
||||
* TS-website database config file
|
||||
* Generated at %s with TS-website %s
|
||||
* Generated at %s with TS-website %s (%s)
|
||||
*/
|
||||
|
||||
return [
|
||||
|
@ -80,14 +95,14 @@ EOT;
|
|||
$confarray = rtrim($confarray, "," . PHP_EOL);
|
||||
|
||||
// Replace all variables with sprintf
|
||||
$phpcode = sprintf($phpcode, date("d-m-Y H:i:s"), __TSWEBSITE_VERSION, $confarray);
|
||||
$phpcode = sprintf($phpcode, date("d-m-Y H:i:s"), __TSWEBSITE_VERSION, __TSWEBSITE_COMMIT, $confarray);
|
||||
|
||||
if(file_put_contents(__CONFIG_FILE, $phpcode) === false) {
|
||||
$errormessage = "Cannot write to <code>" . __CONFIG_FILE . "</code>! Please check the file/directory permissions";
|
||||
} else {
|
||||
// redirect to next step on success
|
||||
header("Location: ?step=" . ($stepNumber + 1));
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$errormessage = htmlspecialchars("Error " . $e->getCode() . ": " . $e->getMessage());
|
||||
|
||||
|
|
Loading…
Reference in New Issue