rename hook functions

This commit is contained in:
Jérémy Lecour 2019-03-07 23:04:19 +01:00
parent e528a27048
commit 6b70d2416c

View file

@ -88,7 +88,7 @@ get_repository_status() {
echo "${RESULT}"
}
commit_repositories() {
hook_commit() {
GIT_COMMITS=""
if test -x "${GIT_BIN}"; then
@ -118,7 +118,7 @@ commit_repositories() {
fi
}
save_db() {
hook_db() {
# SQL_TEXTE=`echo "${TEXTE}" | sed "s/'/\\\\\\'/g ; s@/@\\\\\/@g ; s@\\&@et@g"`
SQL_TEXTE=`echo "${TEXTE}" | sed "s/'/''/g"`
@ -126,7 +126,7 @@ save_db() {
echo "${PG_QUERY}" | psql ${PGDB} ${PGTABLE} -h ${PGHOST}
}
send_mail() {
hook_mail() {
MAIL_TEXTE=$(echo "${TEXTE}" | sed -e "s@/@\\\\\/@g ; s@&@\\\\&@")
MAIL_GIT_COMMITS=$(echo "${GIT_COMMITS}" | sed -e "s@/@\\\\\/@g ; s@&@\\\\&@")
@ -253,12 +253,12 @@ echo "----------- $(get_now) ---------------" >> "${LOGFILE}"
echo "${BLOB}" >> "${LOGFILE}"
# git commit
[ "${OPT_COMMIT}" = "1" ] && commit_repositories
[ "${OPT_COMMIT}" = "1" ] && hook_commit
# insert into PG
[ "${OPT_DB}" = "1" ] && save_db
[ "${OPT_DB}" = "1" ] && hook_db
# send mail
[ "${OPT_MAIL}" = "1" ] && send_mail
[ "${OPT_MAIL}" = "1" ] && hook_mail
exit 0