Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] - 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.

# [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.
Expand Down
2 changes: 1 addition & 1 deletion slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) ) {
Expand Down
25 changes: 21 additions & 4 deletions src/slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <light_cyan>down</light_cyan> 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
);
}
}
Expand Down
Loading