Fix: processes when post changed

This commit is contained in:
Cyrille L 2022-03-29 10:33:52 +02:00
parent 2965e066dc
commit fcfc576e85
1 changed files with 29 additions and 38 deletions

View File

@ -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" \