From 62b68a0175ae32753f40754840b32d715181a8fa Mon Sep 17 00:00:00 2001 From: Justin Frydman Date: Wed, 30 Sep 2026 16:32:22 -0600 Subject: [PATCH 1/2] Prepare 2.5.1 with deferred Composer cache container startup --- changelog.md | 4 ++++ slic.php | 2 +- src/slic.php | 25 +++++++++++++++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 37d63af..d72a681 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# [2.5.1] - TBD + +- Fixed - `slic composer-cache set` and `unset` save their settings without starting a stopped stack. When confirmed, only running PHP services are recreated to apply the cache mount, leaving stopped services and dependencies alone. CI can configure the cache before selecting a project's PHP version without starting containers prematurely. + # [2.5.0] - 2026-09-28 - Breaking Change - Playwright suites that launch browsers directly must use built-in fixtures or explicitly connect to the remote browser. Browser-facing `localhost` URLs and `download.path()` calls may also need changes. See the [migration guidance](docs/playwright.md#update-setup-code-that-launches-a-browser-directly) before upgrading. diff --git a/slic.php b/slic.php index fc05577..204c607 100644 --- a/slic.php +++ b/slic.php @@ -57,7 +57,7 @@ ] ); $cli_name = 'slic'; -const CLI_VERSION = '2.5.0'; +const CLI_VERSION = '2.5.1'; // If the run-time option `-q`, for "quiet", is specified, then do not print the header. if ( in_array( '-q', $argv, true ) || ( in_array( 'exec', $argv, true ) && ! in_array( 'help', $argv, true ) ) ) { diff --git a/src/slic.php b/src/slic.php index b541c75..208cbbc 100644 --- a/src/slic.php +++ b/src/slic.php @@ -1256,18 +1256,35 @@ function slic_handle_composer_cache( callable $args ) { echo PHP_EOL . PHP_EOL; + // Setting the cache before `slic use` must not start containers with the default PHP version. + $running_services = array_values( array_filter( array_keys( php_services() ), static function ( string $service ): bool { + return service_running( $service ); + } ) ); + + if ( ! $running_services ) { + echo 'The cache setting will apply when the PHP services next start.' . PHP_EOL; + + return; + } + $restart_services = ask( - 'Would you like to restart the WordPress (NOT the database) and Codeception services now?', + 'Would you like to recreate the running PHP services (' . implode( ', ', $running_services ) . ') to apply the cache setting now?', 'yes' ); + if ( $restart_services ) { putenv( "COMPOSER_CACHE_DIR={$value}" ); - // Call for a hard restart to make sure the web-server will restart its php-fpm connection. - restart_php_services( true ); + // Bind mount changes require recreation. Leave stopped services and dependencies alone. + $status = slic_realtime()( array_merge( [ 'up', '--wait', '--no-deps', '--force-recreate' ], $running_services ) ); + + if ( $status !== 0 ) { + echo magenta( 'Could not recreate the PHP services with the new Composer cache directory.' . PHP_EOL ); + exit( $status ); + } } else { echo colorize( - PHP_EOL . PHP_EOL . "Tear down the stack with down and restart it to apply the new settings!" . PHP_EOL + PHP_EOL . 'The cache setting is saved. Recreate the PHP services to apply it.' . PHP_EOL ); } } From b364d428a7693837594e2d885bf717206612f0d1 Mon Sep 17 00:00:00 2001 From: Justin Frydman Date: Fri, 2 Oct 2026 09:48:25 -0600 Subject: [PATCH 2/2] Set 2.5.1 release date --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index d72a681..f4aef1f 100644 --- a/changelog.md +++ b/changelog.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -# [2.5.1] - TBD +# [2.5.1] - 2026-10-02 - Fixed - `slic composer-cache set` and `unset` save their settings without starting a stopped stack. When confirmed, only running PHP services are recreated to apply the cache mount, leaving stopped services and dependencies alone. CI can configure the cache before selecting a project's PHP version without starting containers prematurely.