فهرست منبع

Replace known key database on upgrade

Kristan Kenney 5 سال پیش
والد
کامیت
8a15b1cff0
4فایلهای تغییر یافته به همراه14 افزوده شده و 3 حذف شده
  1. 2 3
      func/syshealth.sh
  2. 10 0
      func/upgrade.sh
  3. 1 0
      install/upgrade/upgrade.conf
  4. 1 0
      src/deb/hestia/postinst

+ 2 - 3
func/syshealth.sh

@@ -110,7 +110,7 @@ function syshealth_update_user_config_format() {
 }
 
 # Update list of known keys for db.conf files
-function syshealth_update_database_config_format() {
+function syshealth_update_db_config_format() {
 
     # DATABASE CONFIGURATION
     # Create array of known keys in configuration file
@@ -139,8 +139,7 @@ function syshealth_repair_web_config() {
     sanitize_config_file
     get_domain_values 'web'
     prev="DOMAIN"
-    for key in $known_keys;
-    do
+    for key in $known_keys; do
         if [ -z "${!key}" ]; then 
             add_object_key 'web' 'DOMAIN' "$domain" "$key" "$prev"   
         fi

+ 10 - 0
func/upgrade.sh

@@ -624,6 +624,16 @@ upgrade_rebuild_users() {
     fi
 }
 
+upgrade_replace_default_config() {
+    if [ "$UPGRADE_REPLACE_KNOWN_KEYS" ]; then
+        syshealth_update_web_config_format
+        syshealth_update_mail_config_format
+        syshealth_update_dns_config_format
+        syshealth_update_db_config_format
+        syshealth_update_user_config_format
+    fi
+}
+
 upgrade_restart_services() {
     if [ "$UPGRADE_RESTART_SERVICES" = "true" ]; then
         echo "[ * ] Restarting services..."

+ 1 - 0
install/upgrade/upgrade.conf

@@ -41,6 +41,7 @@ UPGRADE_UPDATE_FILEMANAGER='true'
 UPGRADE_UPDATE_FILEMANAGER_CONFIG='false'
 
 # Post installation clean-up
+UPGRADE_REPLACE_KNOWN_KEYS='true'
 UPGRADE_REBUILD_USERS='true'
 UPGRADE_RESTART_SERVICES='true'
 

+ 1 - 0
src/deb/hestia/postinst

@@ -42,6 +42,7 @@ upgrade_welcome_message
 
 # Perform upgrade health check and refresh configuration before upgrading
 upgrade_health_check | tee -a $LOG
+upgrade_replace_default_config
 upgrade_refresh_config
 
 # Back up existing configuration files and templates