From fcfc576e85f054b64e387c8530b59d12e45ac938 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Tue, 29 Mar 2022 10:33:52 +0200 Subject: [PATCH] Fix: processes when post changed --- var/lib/gsl/scripts/gsl__post_manager | 67 ++++++++++++--------------- 1 file changed, 29 insertions(+), 38 deletions(-) diff --git a/var/lib/gsl/scripts/gsl__post_manager b/var/lib/gsl/scripts/gsl__post_manager index 4fdb24c..ee2c7ff 100644 --- a/var/lib/gsl/scripts/gsl__post_manager +++ b/var/lib/gsl/scripts/gsl__post_manager @@ -44,7 +44,33 @@ do gsl_file_db_post="$gsl_dir_db/$gsl_post.db" gsl__db_get_post_datas "$1" gsl__db_compare_post_hash - + + gsl__post_begin + gsl__get_needed_headers + gsl__page_prepare_datas + + if [[ "$gsl_post_new_hash" ]];then + unset gsl_db_post_status + if [[ -f "$gsl_srv_wip_page" ]];then + rm -f "$gsl_srv_wip_page" && \ + gsl__logs_print \ + "$gsl_log_w" \ + "wip" \ + "Delete" \ + "$gsl_post_type ; $gsl_post has changed" \ + "$gsl_srv_wip_page" + fi + if [[ -f "$gsl_file_db_post" ]];then + rm -f "$gsl_file_db_post" && \ + gsl__logs_print \ + "$gsl_log_w" \ + "DB" \ + "Delete" \ + "file ; $gsl_post has changed" \ + "$gsl_file_db_post" + fi + fi + # From COMMAND [OPT] case "$1" in check) @@ -62,36 +88,13 @@ do ;; make) - gsl__post_begin - gsl__get_needed_headers - gsl__page_prepare_datas - case "$gsl_db_post_status" in chk) gsl__all_makers ;; *) - if [[ "$gsl_post_new_hash" ]];then - if [[ -f "$gsl_srv_wip_page" ]];then - rm -f "$gsl_srv_wip_page" && \ - gsl__logs_print \ - "$gsl_log_w" \ - "wip" \ - "Delete" \ - "$gsl_post_type ; $gsl_post has changed" \ - "$gsl_srv_wip_page" - fi - if [[ -f "$gsl_file_db_post" ]];then - rm -f "$gsl_file_db_post" && \ - gsl__logs_print \ - "$gsl_log_w" \ - "DB" \ - "Delete" \ - "file ; $gsl_post has changed" \ - "$gsl_file_db_post" - fi - else + if ! [[ "$gsl_post_new_hash" ]];then # Should not be used... [[ "$gsl_force_make" ]] \ && gsl__all_makers \ @@ -134,15 +137,11 @@ do ;; www) - gsl__post_begin - gsl__get_needed_headers - gsl__page_prepare_datas - gsl_checker_war=true case "$2" in add) case "$gsl_db_post_status" in - wip) + wip|www) rsync -a --delete \ "$gsl_srv_wip_page" "$gsl_srv_www_page" && \ gsl__logs_print \ @@ -153,14 +152,6 @@ do "$gsl_srv_www_page" gsl__db_set_post_status www ;; - www) - gsl__logs_print \ - "$gsl_log_w" \ - "SRV" \ - "www" \ - "$gsl_post_type $gsl_post already synced" \ - "$gsl_srv_www_page" - ;; *) gsl__logs_print \ "$gsl_log_e" \