From b55e4509d16d684b6d4b147257e8ea8b44310edf Mon Sep 17 00:00:00 2001 From: Thomas Metois Date: Fri, 17 Mar 2017 11:38:37 +0100 Subject: [PATCH] EVO: script update-all > add param for bypasse migrate database (-b) & force to exec clear cache (-c) --- scripts/update-all.sh | 79 ++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/scripts/update-all.sh b/scripts/update-all.sh index 5a12465..d5ba36f 100755 --- a/scripts/update-all.sh +++ b/scripts/update-all.sh @@ -1,4 +1,26 @@ -#!/bin/bash +#!/usr/bin/env bash + +bypass=0 +forceClearCache=0 +while getopts "hbc" option +do + case $option in + h) + echo -e "Update or install all Monarc modules, frontend views and migrate database." + echo -e "\t-b\tbypass migrate database" + echo -e "\t-c\tforce clear cache" + echo -e "\t-h\tdisplay this message" + exit 1 + ;; + b) + bypass=1 + echo "Migrate database don't execute !!!" + ;; + c) + forceClearCache=1 + ;; + esac +done pull_if_exists() { if [ -d $1 ]; then @@ -81,37 +103,10 @@ else npm install fi - -if [ -d $pathCore ]; then - $phpcommand ./vendor/robmorgan/phinx/bin/phinx migrate -c ./$pathCore/migrations/phinx.php - if [ -d "${pathCore}/hooks" ]; then - cd $pathCore/.git/hooks - ln -s ../../hooks/pre-commit.sh pre-commit 2>/dev/null - chmod u+x pre-commit - cd $currentPath - fi -fi - -if [ -d $pathBO ]; then - $phpcommand ./vendor/robmorgan/phinx/bin/phinx migrate -c ./$pathBO/migrations/phinx.php - - if [ -d "${pathBO}/hooks" ]; then - cd $pathBO/.git/hooks - ln -s ../../hooks/pre-commit.sh pre-commit 2>/dev/null - chmod u+x pre-commit - cd $currentPath - fi -fi - -if [ -d $pathFO ]; then - $phpcommand ./vendor/robmorgan/phinx/bin/phinx migrate -c ./$pathFO/migrations/phinx.php - - if [ -d "$pathFO/hooks" ]; then - cd $pathFO/.git/hooks - ln -s ../../hooks/pre-commit.sh pre-commit 2>/dev/null - chmod u+x pre-commit - cd $currentPath - fi +if [[ $bypass -eq 0 ]]; then + migrate_module $phpcommand $pathCore + migrate_module $phpcommand $pathBO + migrate_module $phpcommand $pathFO fi if [ -d node_modules/ng_backoffice ]; then @@ -129,10 +124,18 @@ fi ./scripts/link_modules_resources.sh ./scripts/compile_translations.sh -# Clear doctrine cache -$phpcommand ./public/index.php orm:clear-cache:metadata -$phpcommand ./public/index.php orm:clear-cache:query -$phpcommand ./public/index.php orm:clear-cache:result +if [[ $forceClearCache -eq 1 ]]; then + # Clear doctrine cache + # Move to MonarcCore Module.php + $phpcommand ./public/index.php orm:clear-cache:metadata + $phpcommand ./public/index.php orm:clear-cache:query + $phpcommand ./public/index.php orm:clear-cache:result -# Clear ZF2 cache -touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade + # Clear ZF2 cache + touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade +fi + +if [[ $forceClearCache -eq 0 && $bypass -eq 0 ]]; then + # Clear ZF2 cache + touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade +fi