From 295ae2c51fe9b8e504e085e87a1b12d1d907c3c4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 12:01:45 -0400 Subject: [PATCH 1/2] Pin Importer plugin with old PHP support --- tools/local-env/scripts/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 96c4143bbed97..4702f4d4ebde5 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -55,5 +55,5 @@ function install_wp_importer() { const testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer'; execSync( `docker compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } ); - execSync( `docker compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); + execSync( `docker compose exec -T php git clone --branch 0.9.0 https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); } From 32f6b16203ae8bc3c6047139dac090ebd3452e50 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 12:32:06 -0400 Subject: [PATCH 2/2] Dynamically load the correct WP Importer version --- tools/local-env/scripts/install.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 4702f4d4ebde5..4d59350f8b39e 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -54,6 +54,10 @@ function wp_cli( cmd ) { function install_wp_importer() { const testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer'; + // The final version of the WordPress Importer plugin with support for PHP < 7.2 is 0.9.0. + const phpVersion = parseFloat(process.env.LOCAL_PHP.split('-')[0]); + const branchFlag = phpVersion < 7.2 ? '--branch 0.9.0' : ''; + execSync( `docker compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } ); - execSync( `docker compose exec -T php git clone --branch 0.9.0 https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); + execSync( `docker compose exec -T php git clone ${branchFlag} https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); }