From ab72dbb8a3dd0ebd9003a09d68aa06d9f5691bbf Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 17 Jun 2019 14:02:31 +0200 Subject: [PATCH] upgradeFromGit.sh : add gettext MO file change detection --- config.local/local.sh.example | 3 +++ upgradeFromGit.sh | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/config.local/local.sh.example b/config.local/local.sh.example index c765a9e5..ed8827c0 100644 --- a/config.local/local.sh.example +++ b/config.local/local.sh.example @@ -14,6 +14,9 @@ THEME_TPL_REF="default" THEME_CSS_REF="default" THEME_IMG_REF="default" +# Webserver service reload command to run on gettext MO files changed +#WEBSERVER_RELOAD_CMD='sudo service apache2 force-reload' + # Do doc export ? BUILD_DOC=1 diff --git a/upgradeFromGit.sh b/upgradeFromGit.sh index 46e5f962..977e99db 100755 --- a/upgradeFromGit.sh +++ b/upgradeFromGit.sh @@ -29,6 +29,10 @@ function check_file_or_symlink() { cd $ROOT_DIR +msg "-> Store gettext MO files state : " +MO_STATE_BEFORE=$( find $ROOT_DIR/public_html/lang/ -type f -name '*.mo'|sort -u|xargs md5sum ) +msg "done." + msg "-> Clean git repos : " for i in $LOCAL_FILES do @@ -242,6 +246,25 @@ then fi fi +msg "-> Check for gettext MO files changes : " +MO_STATE_AFTER=$( find $ROOT_DIR/public_html/lang/ -type f -name '*.mo'|sort -u|xargs md5sum ) +if [ "$MO_STATE_AFTER" == "$MO_STATE_BEFORE" ] +then + msg "No change detected." +elif [ -n "$WEBSERVER_RELOAD_CMD" ] +then + msg "Changed detected : try to webserver to handle changes..." + $WEBSERVER_RELOAD_CMD + if [ $? -eq 0 ] + then + msg "done." + else + msg "ERROR" + fi +else + msg "Changed detected :\n\n/!\\ You have to force-reload your webserver to handle it ! /!\\\n\n" +fi + if [ $BUILD_DOC -eq 1 ] then [ -n "$LAST_UPDATE_FILE" ] && [ "`$ROOT_DIR/checkDocExportsNecessity.sh`" == "" ] && echo "Export documentation is not necessary. Pass." && exit