diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 16e69a55..634668df 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -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; } diff --git a/nexus/Install/settings.default.php b/nexus/Install/settings.default.php index 416a16d0..0deff5cd 100644 --- a/nexus/Install/settings.default.php +++ b/nexus/Install/settings.default.php @@ -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' => 'http://nexusphp.org', + 'subversion' => 'v1.6.0-beta2', + 'releasedate' => '2021-02-03', + 'website' => 'https://nexusphp.org', ), ); \ No newline at end of file diff --git a/nexus/Install/update/update.php b/nexus/Install/update/update.php index c7344065..f2c9c118 100644 --- a/nexus/Install/update/update.php +++ b/nexus/Install/update/update.php @@ -183,7 +183,7 @@ if ($currentStep == 4) { -