mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-09-16 16:18:50 -04:00
Merge pull request #1791 from agueybanapr/patch-1
Refactor config import logic for legacy column references
This commit is contained in:
1 file changed
+5
-5
@@ -230,17 +230,14 @@ def importConfigs(pm, db, all_plugins):
|
|||||||
# get config file name
|
# get config file name
|
||||||
config_file = Path(fullConfPath)
|
config_file = Path(fullConfPath)
|
||||||
|
|
||||||
# Only import file if the file was modifed since last import.
|
# Only import file if the file was modified since last import.
|
||||||
# this avoids time zone issues as we just compare the previous timestamp to the current time stamp
|
# this avoids time zone issues as we just compare the previous timestamp to the current time stamp
|
||||||
|
|
||||||
# rename settings that have changed names due to code cleanup and migration to plugins
|
# rename settings that have changed names due to code cleanup and migration to plugins
|
||||||
# renameSettings(config_file)
|
# renameSettings(config_file)
|
||||||
|
|
||||||
# rename legacy DB column references in user config values (e.g. templates, WATCH lists)
|
|
||||||
renameColumnReferences(config_file)
|
|
||||||
|
|
||||||
fileModifiedTime = os.path.getmtime(config_file)
|
fileModifiedTime = os.path.getmtime(config_file)
|
||||||
|
|
||||||
mylog("debug", ["[Import Config] checking config file "])
|
mylog("debug", ["[Import Config] checking config file "])
|
||||||
mylog("debug", ["[Import Config] lastImportedConfFile :", conf.lastImportedConfFile],)
|
mylog("debug", ["[Import Config] lastImportedConfFile :", conf.lastImportedConfFile],)
|
||||||
mylog("debug", ["[Import Config] fileModifiedTime :", fileModifiedTime])
|
mylog("debug", ["[Import Config] fileModifiedTime :", fileModifiedTime])
|
||||||
@@ -249,6 +246,9 @@ def importConfigs(pm, db, all_plugins):
|
|||||||
mylog("debug", ["[Import Config] skipping config file import"])
|
mylog("debug", ["[Import Config] skipping config file import"])
|
||||||
return pm, all_plugins, False
|
return pm, all_plugins, False
|
||||||
|
|
||||||
|
# rename legacy column references only when the config file actually changed
|
||||||
|
renameColumnReferences(config_file)
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
updateState("Import config", showSpinner=True)
|
updateState("Import config", showSpinner=True)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user