Copy over last DB backup timestamp on DB import

When importing a backup from a long time ago (more than one DB backup interval ago), a backup would be created the moment the import was done, regardless of when the previous backup was made (so even when that was minutes ago). Now the schedule is kept, by copying over the timestamp of the last DB backup from the current DB to the imported DB.
This commit is contained in:
CasVT
2025-08-03 12:20:49 +02:00
parent 40473de47a
commit 1e09ce1510

View File

@@ -243,11 +243,16 @@ def import_db(
)
raise
if copy_hosting_settings:
hosting_settings = config_current.fetch_all()
for key, value in hosting_settings:
if key in ('host', 'port', 'url_prefix'):
config_new.update(key, value)
hosting_settings = config_current.fetch_all()
for key, value in hosting_settings:
if (
key == 'db_backup_last_run'
or (
copy_hosting_settings
and key in ('host', 'port', 'url_prefix')
)
):
config_new.update(key, value)
cursor_new.connection.commit()
cursor_new.connection.close()