mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-21 10:27:27 +08:00
update merge from db
This commit is contained in:
@@ -204,13 +204,32 @@ class Install
|
||||
$symbolicLinks = [];
|
||||
require $originalConfigFile;
|
||||
$settings = require $defaultSettingsFile;
|
||||
$settingsFromDb = [];
|
||||
if (get_row_count('settings') > 0) {
|
||||
$settingsFromDb = get_setting();
|
||||
}
|
||||
$this->doLog("settings form db: " . json_encode($settingsFromDb));
|
||||
foreach ($settings as $prefix => &$group) {
|
||||
$prefixUpperCase = strtoupper($prefix);
|
||||
$oldGroupValues = $$prefixUpperCase ?? null;
|
||||
foreach ($group as $key => &$value) {
|
||||
//merge original config to default setting, exclude code part
|
||||
if ($prefix != 'code' && isset($oldGroupValues) && isset($oldGroupValues[$key])) {
|
||||
$value = $oldGroupValues[$key];
|
||||
//merge original config or db config to default setting, exclude code part
|
||||
if ($prefix != 'code') {
|
||||
if (isset($settingsFromDb[$prefix][$key])) {
|
||||
$this->doLog(sprintf(
|
||||
"$prefix.$key, db exists, change from: %s => %s",
|
||||
is_scalar($value) ? $value : json_encode($value),
|
||||
is_scalar($settingsFromDb[$prefix][$key]) ? $settingsFromDb[$prefix][$key] : json_encode($settingsFromDb[$prefix][$key]))
|
||||
);
|
||||
$value = $settingsFromDb[$prefix][$key];
|
||||
} elseif (isset($oldGroupValues) && isset($oldGroupValues[$key])) {
|
||||
$this->doLog(sprintf(
|
||||
"$prefix.$key, original config file exists, change from: %s => %s",
|
||||
is_scalar($value) ? $value : json_encode($value),
|
||||
is_scalar($oldGroupValues[$key]) ? $oldGroupValues[$key] : json_encode($oldGroupValues[$key]))
|
||||
);
|
||||
$value = $oldGroupValues[$key];
|
||||
}
|
||||
}
|
||||
if (isset($requireDirs[$prefix]) && in_array($key, $requireDirs[$prefix])) {
|
||||
$dir = getFullDirectory($value);
|
||||
@@ -458,7 +477,7 @@ class Install
|
||||
{
|
||||
foreach ($symbolicLinks as $path) {
|
||||
$linkName = ROOT_PATH . 'public/' . basename($path);
|
||||
if (is_dir($linkName)) {
|
||||
if (is_link($linkName)) {
|
||||
$this->doLog("path: $linkName already exits, skip create symbolic link $linkName -> $path");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
'guest_visit_type' => 'redirect',
|
||||
'guest_visit_value_static_page' => 'beian-aliyun.html',
|
||||
'guest_visit_value_custom_content' => ' [em24] ',
|
||||
'guest_visit_value_redirect' => 'http://nexusphp.org/',
|
||||
'guest_visit_value_redirect' => 'https://nexusphp.org/',
|
||||
'login_type' => 'secret',
|
||||
'login_secret_lifetime' => '10',
|
||||
'login_secret_deadline' => '2021-02-03 18:55:46',
|
||||
@@ -353,8 +353,8 @@
|
||||
'code' =>
|
||||
array (
|
||||
'mainversion' => 'NexusPHP',
|
||||
'subversion' => 'v1.6.0-beta1',
|
||||
'releasedate' => '2021-01-30',
|
||||
'website' => '<a href="http://nexusphp.org" target="_blank">http://nexusphp.org</a>',
|
||||
'subversion' => 'v1.6.0-beta2',
|
||||
'releasedate' => '2021-02-03',
|
||||
'website' => '<a href="https://nexusphp.org" target="_blank">https://nexusphp.org</a>',
|
||||
),
|
||||
);
|
||||
@@ -183,7 +183,7 @@ if ($currentStep == 4) {
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
|
||||
<title>Install NexusPHP | step <?php echo $currentStep?></title>
|
||||
<title>Update NexusPHP | step <?php echo $currentStep?></title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mx-auto">
|
||||
|
||||
Reference in New Issue
Block a user