diff --git a/.lando.yml b/.lando.yml index b14f6b7b..c3ac6876 100644 --- a/.lando.yml +++ b/.lando.yml @@ -5,10 +5,14 @@ config: php: 8.3 webroot: backdrop database: mysql + # Set Xdebug off by default. We use the tooling below to turn it on as needed. + xdebug: false # Need to disable bee so can use the version in the repo. bee: false services: appserver: + config: + php: .lando/php.ini build_as_root: # As bee is now added by default, we need to remove any existing versions # of bee if you tested a versioned install of bee by adding in the config @@ -31,6 +35,10 @@ services: run: # Run setup tasks. - /app/.lando/setup.sh setup + overrides: + environment: + XDEBUG-CONFIG: "start_with_request=yes" + XDEBUG_MODE: 'debug,develop' database: healthcheck: mysql --defaults-extra-file=/app/.lando/mysql.cnf --silent --execute "SHOW DATABASES;" multisite: @@ -62,6 +70,20 @@ tooling: cmd: - cd /app/backdrop && /app/phpunit --testsuite backdrop --configuration /app/tests - cd /app/multisite && /app/phpunit --testsuite multisite --configuration /app/tests + xdebug-on: + service: appserver + description: Enable Xdebug. + user: root + cmd: + - docker-php-ext-enable xdebug && kill -USR2 $(pgrep -o php-fpm) 2>/dev/null || /etc/init.d/apache2 reload + - tput setaf 2 && echo "Xdebug On" && tput sgr 0 && echo + xdebug-off: + service: appserver + description: Disable Xdebug. + user: root + cmd: + - rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && kill -USR2 $(pgrep -o php-fpm) 2>/dev/null || /etc/init.d/apache2 reload + - tput setaf 1 && echo "Xdebug Off" && tput sgr 0 && echo proxy: multisite: - multi-1.lndo.site diff --git a/.lando/php.ini b/.lando/php.ini new file mode 100644 index 00000000..c6dee6e3 --- /dev/null +++ b/.lando/php.ini @@ -0,0 +1,6 @@ +xdebug.mode = coverage,develop,debug +xdebug.idekey = docker +xdebug.client_host = ${LANDO_HOST_IP} +xdebug.client_port = 9003 +xdebug.start_with_request = yes +xdebug.log = /tmp/xdebug.log \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..fff226cb --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Listen for XDebug", + "type": "php", + "request": "launch", + "port": 9003, + "pathMappings": { + "/app/": "${workspaceFolder}/", + } + } + ] + } + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fcd3e01..688ba5d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,13 @@ and this project follows the which is based on the major version of Backdrop CMS with a semantic version system for each contributed module, theme and layout. -## [Unreleased] - 2024-09-19 +## [Unreleased] - 2024-09-25 ### Added - An option for the `db-import` command to allow import from newer MariaDB servers with the enable sandbox command in the dump file if the destination database or client does not support it. +- Tooling for the lando recipe to support Xdebug with VS Code. ### Fixed - Unhandled errors and warnings if commands run outside Backdrop root and/or