Skip to content

Commit fcb4944

Browse files
Copilotswissspidy
andcommitted
Fix cache directory check for version-specific downloads
Co-authored-by: swissspidy <[email protected]>
1 parent e7d467f commit fcb4944

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Context/FeatureContext.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,9 +1288,14 @@ public function add_line_to_wp_config( &$wp_config_code, $line ): void {
12881288

12891289
/**
12901290
* @param string $subdir
1291+
* @param string $version
12911292
*/
12921293
public function download_wp( $subdir = '', $version = '' ): void {
1293-
if ( ! self::$cache_dir ) {
1294+
$wp_version = $version ?: getenv( 'WP_VERSION' );
1295+
$wp_version_suffix = ( false !== $wp_version && '' !== $wp_version ) ? "-$wp_version" : '';
1296+
$expected_cache_dir = sys_get_temp_dir() . '/wp-cli-test-core-download-cache' . $wp_version_suffix;
1297+
1298+
if ( ! self::$cache_dir || self::$cache_dir !== $expected_cache_dir ) {
12941299
self::cache_wp_files( $version );
12951300

12961301
$result = Process::create( Utils\esc_cmd( 'wp core version --debug --path=%s', self::$cache_dir ), null, self::get_process_env_variables() )->run_check();

0 commit comments

Comments
 (0)