3 # @todo add 'query' action
4 # @todo avoid reloading php-fpm if config did not change
6 # Note: we have php set up either via phpenv (TRAVIS=true), Ubuntu packages (PHP_VERSION=default) or Sury packages.
7 # xdebug comes either at version 2 or 3
11 if [ "$TRAVIS" != true ]; then
12 PHPCONFDIR_CLI=$(php -i | grep 'Scan this dir for additional .ini files' | sed 's|Scan this dir for additional .ini files => ||')
13 PHPCONFDIR_FPM=$(echo "$PHPCONFDIR_CLI" | sed 's|/cli/|/fpm/|')
17 if [ "$TRAVIS" = true ]; then
18 phpenv config-add tests/ci/config/codecoverage_xdebug.ini
21 ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
23 if [ -L "${PHPCONFDIR_CLI}/99-codecoverage_xdebug.ini" ]; then sudo rm "${PHPCONFDIR_CLI}/99-codecoverage_xdebug.ini"; fi
24 sudo ln -s $(realpath tests/ci/config/codecoverage_xdebug.ini) "${PHPCONFDIR_CLI}/99-codecoverage_xdebug.ini"
25 if [ -L "${PHPCONFDIR_FPM}/99-codecoverage_xdebug.ini" ]; then sudo rm "${PHPCONFDIR_FPM}/99-codecoverage_xdebug.ini"; fi
26 sudo ln -s $(realpath tests/ci/config/codecoverage_xdebug.ini) "${PHPCONFDIR_FPM}/99-codecoverage_xdebug.ini"
28 sudo service php-fpm restart
33 if [ "$TRAVIS" = true ]; then
34 phpenv config-rm tests/ci/config/codecoverage_xdebug.ini
37 ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
39 if [ -L "${PHPCONFDIR_CLI}/99-codecoverage_xdebug.ini" ]; then sudo rm "${PHPCONFDIR_CLI}/99-codecoverage_xdebug.ini"; fi
40 if [ -L "${PHPCONFDIR_FPM}/99-codecoverage_xdebug.ini" ]; then sudo rm "${PHPCONFDIR_FPM}/99-codecoverage_xdebug.ini"; fi
42 sudo service php-fpm restart
54 echo "ERROR: unknown action '${1}', please use 'enable' or 'disable'" >&2