|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -if [ -f "${WORK_DIRECTORY}/bin/console" ]; then |
| 3 | +if has_composer_package 'symfony/symfony'; then |
| 4 | + SYMFONY_MAJOR_VERSION_GUESS="$(composer_package_version 'symfony/symfony' | cut -d '.' -f 1)" |
| 5 | +elif has_composer_package 'symfony/framework-bundle'; then |
| 6 | + SYMFONY_MAJOR_VERSION_GUESS="$(composer_package_version 'symfony/framework-bundle' | cut -d '.' -f 1)" |
| 7 | +elif [ -f "${WORK_DIRECTORY}/bin/console" ]; then |
4 | 8 | SYMFONY_MAJOR_VERSION_GUESS=3 |
5 | | - SYMFONY_CONSOLE_DEFAULT=${WORK_DIRECTORY}/bin/console |
6 | 9 | else |
7 | 10 | SYMFONY_MAJOR_VERSION_GUESS=2 |
8 | | - SYMFONY_CONSOLE_DEFAULT=${WORK_DIRECTORY}/app/console |
9 | 11 | fi |
10 | 12 |
|
11 | 13 | export SYMFONY_MAJOR_VERSION=${SYMFONY_MAJOR_VERSION:-${SYMFONY_MAJOR_VERSION_GUESS}} |
| 14 | + |
| 15 | +if has_composer_package 'symfony/flex'; then |
| 16 | + SYMFONY_FLEX="$(convert_to_boolean_string "${SYMFONY_FLEX:-true}")" |
| 17 | +else |
| 18 | + SYMFONY_FLEX="$(convert_to_boolean_string "${SYMFONY_FLEX:-false}")" |
| 19 | +fi |
| 20 | +export SYMFONY_FLEX |
| 21 | + |
| 22 | +if is_true "${SYMFONY_FLEX}"; then |
| 23 | + DEFAULT_APP_ENDPOINT=/index.php |
| 24 | + export WEB_DIRECTORY=${WEB_DIRECTORY:-public} |
| 25 | + |
| 26 | + if is_true "$SYMFONY_WEB_APP_ENV_REWRITE"; then |
| 27 | + echo 'warning: SYMFONY_WEB_APP_ENV_REWRITE is ignored when using Symfony 4+ folder structure' >&2 |
| 28 | + fi |
| 29 | +elif [ "$SYMFONY_ENV" == "prod" ] || is_false "$SYMFONY_WEB_APP_ENV_REWRITE"; then |
| 30 | + DEFAULT_APP_ENDPOINT=/app.php |
| 31 | +else |
| 32 | + DEFAULT_APP_ENDPOINT=/app_${SYMFONY_ENV}.php |
| 33 | +fi |
| 34 | + |
| 35 | +export APP_ENDPOINT_STRICT=${APP_ENDPOINT_STRICT:-true} |
| 36 | +export APP_ENDPOINT=${SYMFONY_APP_ENDPOINT:-${APP_ENDPOINT:-${DEFAULT_APP_ENDPOINT}}} |
| 37 | + |
| 38 | +if [ "${SYMFONY_MAJOR_VERSION}" -ge 3 ]; then |
| 39 | + SYMFONY_CONSOLE_DEFAULT=${WORK_DIRECTORY}/bin/console |
| 40 | +else |
| 41 | + SYMFONY_CONSOLE_DEFAULT=${WORK_DIRECTORY}/app/console |
| 42 | +fi |
| 43 | + |
12 | 44 | export SYMFONY_CONSOLE=${SYMFONY_CONSOLE:-${SYMFONY_CONSOLE_DEFAULT}} |
13 | | -export SYMFONY_DOCTRINE_MODE=auto |
|
0 commit comments