mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
chore: Update Database.py to set custom_configs_changed flag and last_custom_configs_change timestamp when saving config and services were removed to avoid deleted custom configs still hanging
This commit is contained in:
parent
774f239eed
commit
9b2805afb5
2 changed files with 3 additions and 8 deletions
|
|
@ -1272,6 +1272,9 @@ class Database:
|
|||
session.query(Services_settings).filter(Services_settings.service_id.in_(missing_ids)).delete()
|
||||
session.query(Custom_configs).filter(Custom_configs.service_id.in_(missing_ids)).delete()
|
||||
session.query(Jobs_cache).filter(Jobs_cache.service_id.in_(missing_ids)).delete()
|
||||
session.query(Metadata).filter_by(id=1).update(
|
||||
{Metadata.custom_configs_changed: True, Metadata.last_custom_configs_change: datetime.now()}
|
||||
)
|
||||
changed_services = True
|
||||
|
||||
drafts = {service for service in services if config.pop(f"{service}_IS_DRAFT", "no") == "yes"}
|
||||
|
|
|
|||
|
|
@ -212,14 +212,6 @@ def manage_bunkerweb(method: str, *args, operation: str = "reloads", is_draft: b
|
|||
operation, error = app.config["CONFIG"].edit_service(args[1], args[0], check_changes=(was_draft != is_draft or not is_draft), is_draft=is_draft)
|
||||
elif operation == "delete":
|
||||
operation, error = app.config["CONFIG"].delete_service(args[2], check_changes=(was_draft != is_draft or not is_draft))
|
||||
|
||||
if not error:
|
||||
if was_draft != is_draft or not is_draft:
|
||||
# update changes in db
|
||||
ret = app.config["DB"].checked_changes(["config", "custom_configs"], value=True)
|
||||
if ret:
|
||||
app.logger.error(f"Couldn't set the changes to checked in the database: {ret}")
|
||||
ui_data["TO_FLASH"].append({"content": f"An error occurred when setting the changes to checked in the database : {ret}", "type": "error"})
|
||||
elif method == "global_config":
|
||||
operation, error = app.config["CONFIG"].edit_global_conf(args[0])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue