diff --git a/CHANGELOG.md b/CHANGELOG.md index d42a07b2e..a7005c635 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Switch result filter column 'task' from task ID to name task name [#1317](https://github.com/greenbone/gvmd/pull/1317) - Correct check of get_certificate_info return [#1318](https://github.com/greenbone/gvmd/pull/1318) - Fix GMP doc text of `active` elem for notes and overrides [#1323](https://github.com/greenbone/gvmd/pull/1323) +- Move feed object in trash checks to startup [#1325](https://github.com/greenbone/gvmd/pull/1325) ### Removed - Remove DROP from vulns creation [#1281](http://github.com/greenbone/gvmd/pull/1281) diff --git a/src/manage_configs.c b/src/manage_configs.c index 18c70d88e..c0c948404 100644 --- a/src/manage_configs.c +++ b/src/manage_configs.c @@ -349,15 +349,6 @@ sync_config_with_feed (const gchar *path) if (find_trash_config_no_acl (uuid, &config) == 0 && config) { - static int warned = 0; - - if (warned == 0) - { - warned = 1; - g_warning ("%s: ignoring a config ('%s'), as it is in the trashcan" - " (will not warn again)", - __func__, uuid); - } g_free (uuid); return; } diff --git a/src/manage_port_lists.c b/src/manage_port_lists.c index 735db19bb..e27be8ef7 100644 --- a/src/manage_port_lists.c +++ b/src/manage_port_lists.c @@ -283,15 +283,6 @@ sync_port_list_with_feed (const gchar *path) if (find_trash_port_list_no_acl (uuid, &port_list) == 0 && port_list) { - static int warned = 0; - - if (warned == 0) - { - warned = 1; - g_warning ("%s: ignoring a port list ('%s'), as it is in the trashcan" - " (will not warn again)", - __func__, uuid); - } g_free (uuid); return; } diff --git a/src/manage_report_formats.c b/src/manage_report_formats.c index 962835bdc..1bf0f59da 100644 --- a/src/manage_report_formats.c +++ b/src/manage_report_formats.c @@ -643,15 +643,6 @@ sync_report_format_with_feed (const gchar *path) if (find_trash_report_format_no_acl (uuid, &report_format) == 0 && report_format) { - static int warned = 0; - - if (warned == 0) - { - warned = 1; - g_warning ("%s: ignoring a report format ('%s'), as it is in the trashcan" - " (will not warn again)", - __func__, uuid); - } g_free (uuid); return; } diff --git a/src/manage_sql_configs.c b/src/manage_sql_configs.c index 9f071bf91..f92feaf62 100644 --- a/src/manage_sql_configs.c +++ b/src/manage_sql_configs.c @@ -4818,4 +4818,13 @@ check_db_configs () if (sync_configs_with_feed ()) g_warning ("%s: Failed to sync configs with feed", __func__); + + /* Warn about feed resources in the trash. */ + if (sql_int ("SELECT EXISTS (SELECT * FROM configs_trash" + " WHERE predefined = 1);")) + { + g_warning ("%s: There are feed configs/policies in the trash." + " These will be excluded from the sync.", + __func__); + } } diff --git a/src/manage_sql_port_lists.c b/src/manage_sql_port_lists.c index 9ffc5647e..303534687 100644 --- a/src/manage_sql_port_lists.c +++ b/src/manage_sql_port_lists.c @@ -2607,4 +2607,13 @@ check_db_port_lists () * This should be a migrator, but this way is easier to backport. */ sql ("UPDATE port_ranges SET \"end\" = 65535 WHERE \"end\" = 65536;"); sql ("UPDATE port_ranges SET start = 65535 WHERE start = 65536;"); + + /* Warn about feed resources in the trash. */ + if (sql_int ("SELECT EXISTS (SELECT * FROM port_lists_trash" + " WHERE predefined = 1);")) + { + g_warning ("%s: There are feed port lists in the trash." + " These will be excluded from the sync.", + __func__); + } } diff --git a/src/manage_sql_report_formats.c b/src/manage_sql_report_formats.c index 529f6f430..b5897628e 100644 --- a/src/manage_sql_report_formats.c +++ b/src/manage_sql_report_formats.c @@ -4558,6 +4558,15 @@ check_db_report_formats () if (make_report_format_uuids_unique ()) return -1; + /* Warn about feed resources in the trash. */ + if (sql_int ("SELECT EXISTS (SELECT * FROM report_formats_trash" + " WHERE predefined = 1);")) + { + g_warning ("%s: There are feed report formats in the trash." + " These will be excluded from the sync.", + __func__); + } + return 0; }