您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

init_benchmark.sh 919B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. function clearCacheAndLogs() {
  3. sudo /bin/rm -rf var/cache/*
  4. [ "$?" != "0" ] && exit 1
  5. sudo /bin/chmod -R 777 var/cache
  6. [ "$?" != "0" ] && exit 1
  7. sudo /bin/rm -rf var/log/*
  8. [ "$?" != "0" ] && exit 1
  9. sudo /bin/chmod -R 777 var/log
  10. [ "$?" != "0" ] && exit 1
  11. php bin/console cache:warmup
  12. }
  13. function init() {
  14. local type=$1
  15. if [ "$type" == "1" ]; then
  16. env="helloworld";
  17. elif [ "$type" == "2" ]; then
  18. env="news";
  19. else
  20. env="rest"
  21. fi
  22. clearCacheAndLogs
  23. export APP_ENV=$env
  24. composer install --no-dev --classmap-authoritative
  25. [ "$?" != "0" ] && exit 1
  26. if [ "$env" == "news" ]; then
  27. php bin/console assets:install --symlink --env=$env
  28. [ "$?" != "0" ] && exit 1
  29. php bin/console assetic:dump --env=$env
  30. [ "$?" != "0" ] && exit 1
  31. fi
  32. clearCacheAndLogs
  33. return 0
  34. }