EVO: script update-all > add param for bypasse migrate database (-b) & force to exec clear cache (-c)

pull/8/head
Thomas Metois 2017-03-17 11:38:37 +01:00
parent c9fd58f0d4
commit b55e4509d1
1 changed files with 41 additions and 38 deletions

View File

@ -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
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
fi
if [[ $forceClearCache -eq 0 && $bypass -eq 0 ]]; then
# Clear ZF2 cache
touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade
fi