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