From 2febb50a92adb91e88825a7839c1f055c10ba6cf Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Wed, 30 Oct 2024 11:53:10 +0100 Subject: rest: do not remove image on center delete if center is removed, leave images in place, image belongs to repository, not to center. This comes from b4870733 ('#942 Add REST POST /center/delete method') --- src/rest.c | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'src') diff --git a/src/rest.c b/src/rest.c index 167f88f..b96cf49 100644 --- a/src/rest.c +++ b/src/rest.c @@ -4704,7 +4704,6 @@ static int og_cmd_post_center_delete(json_t *element, const char *key, *msglog; struct og_dbi *dbi; dbi_result result; - uint32_t image_id; json_t *value; int err = 0; @@ -4749,32 +4748,6 @@ static int og_cmd_post_center_delete(json_t *element, dbi_result_free(result); - result = dbi_conn_queryf(dbi->conn, - "SELECT idimagen FROM imagenes WHERE idcentro=%s", - params->id); - - if (!result) { - dbi_conn_error(dbi->conn, &msglog); - syslog(LOG_ERR, "failed to query database (%s:%d) %s\n", - __func__, __LINE__, msglog); - og_dbi_close(dbi); - return -1; - } - - while (dbi_result_next_row(result)) { - image_id = dbi_result_get_uint(result, "idimagen"); - - err = og_dbi_delete_image(dbi, image_id); - if (err < 0) { - dbi_result_free(result); - og_dbi_close(dbi); - return err; - } - } - - dbi_result_free(result); - og_dbi_close(dbi); - return 0; } -- cgit v1.2.3-18-g5258