From de343184e4c422d6d450ef3abf306b89c686d290 Mon Sep 17 00:00:00 2001 From: David Stone Date: Wed, 25 Mar 2026 00:14:38 -0600 Subject: [PATCH 1/6] fix: bypass enableMultisite port check in WP Performance blueprint The swissspidy/wp-performance-action runs WP Playground on port 9400 (127.0.0.1:9400). The WP Playground enableMultisite blueprint step explicitly throws an error when the site URL contains a custom port: 'The current host is 127.0.0.1:9400, but WordPress multisites do not support custom ports.' This causes the blueprint execution to crash, leaving the server unresponsive. Playwright then fails with ECONNREFUSED 127.0.0.1:9400 because the server never finished starting. Fix: replace the enableMultisite step with equivalent wp-cli steps that bypass the port check: 1. defineWpConfigConsts sets WP_ALLOW_MULTISITE=1 2. wp core multisite-convert converts the site to multisite 3. wp plugin activate --network activates the network-only plugin Also add extraLibraries: ["wp-cli"] so wp-cli.phar is available during blueprint execution. The plugin has Network: true (network-only) so multisite must be enabled and the plugin must be network-activated for the performance test to measure meaningful metrics. Closes #445 --- .github/performance-blueprint.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/performance-blueprint.json b/.github/performance-blueprint.json index 4d8c53e08..898c281bb 100644 --- a/.github/performance-blueprint.json +++ b/.github/performance-blueprint.json @@ -1,7 +1,19 @@ { + "extraLibraries": ["wp-cli"], "steps": [ { - "step": "enableMultisite" + "step": "defineWpConfigConsts", + "consts": { + "WP_ALLOW_MULTISITE": 1 + } + }, + { + "step": "wp-cli", + "command": "wp core multisite-convert --base=/" + }, + { + "step": "wp-cli", + "command": "wp plugin activate ultimate-multisite --network" } ] } From 928425ceaccb39bdf84b832c8b7ebee7c171db5b Mon Sep 17 00:00:00 2001 From: David Stone Date: Wed, 25 Mar 2026 01:07:52 -0600 Subject: [PATCH 2/6] fix: set HTTP_HOST in wp-config.php before multisite-convert The wp core multisite-convert command requires $_SERVER['HTTP_HOST'] to be set in wp-config.php. Without it, the command fails with a non-zero exit code, which causes the WP Playground blueprint executor to throw an exception and crash the server process, resulting in ECONNREFUSED. This mirrors what the enableMultisite blueprint step does internally: it prepends $_SERVER['HTTP_HOST'] to wp-config.php before running wp core multisite-convert. The runPHP step replicates this behaviour without the port check that blocked the original enableMultisite step. Closes #445 --- .github/performance-blueprint.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/performance-blueprint.json b/.github/performance-blueprint.json index 898c281bb..7e54526b1 100644 --- a/.github/performance-blueprint.json +++ b/.github/performance-blueprint.json @@ -7,6 +7,10 @@ "WP_ALLOW_MULTISITE": 1 } }, + { + "step": "runPHP", + "code": " Date: Wed, 25 Mar 2026 01:21:03 -0600 Subject: [PATCH 3/6] fix: replace wp core multisite-convert with direct PHP calls wp core multisite-convert takes too long in WP Playground (WASM PHP is slower than native), causing the Playwright global-setup to time out after 60 seconds before the blueprint finishes executing. Replace the wp-cli step with direct PHP calls to install_network() and populate_network(), which are faster and avoid loading the full wp-cli bootstrap. Also set MULTISITE constants via defineWpConfigConsts instead of relying on wp-cli to write them to wp-config.php. Steps: 1. defineWpConfigConsts: WP_ALLOW_MULTISITE=1 2. runPHP: add $_SERVER['HTTP_HOST'] to wp-config.php 3. runPHP: call install_network() + populate_network() directly 4. defineWpConfigConsts: set MULTISITE, DOMAIN_CURRENT_SITE, etc. 5. wp-cli: activate plugin network-wide --- .github/performance-blueprint.json | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/performance-blueprint.json b/.github/performance-blueprint.json index 7e54526b1..92b0c6921 100644 --- a/.github/performance-blueprint.json +++ b/.github/performance-blueprint.json @@ -9,11 +9,22 @@ }, { "step": "runPHP", - "code": "get_error_message():'Multisite network created';" + }, + { + "step": "defineWpConfigConsts", + "consts": { + "MULTISITE": true, + "SUBDOMAIN_INSTALL": false, + "DOMAIN_CURRENT_SITE": "127.0.0.1", + "PATH_CURRENT_SITE": "/", + "SITE_ID_CURRENT_SITE": 1, + "BLOG_ID_CURRENT_SITE": 1 + } }, { "step": "wp-cli", From 0517ef8c6d5e1706e9b426cce4ddbdc1aabc29f8 Mon Sep 17 00:00:00 2001 From: David Stone Date: Wed, 25 Mar 2026 01:30:21 -0600 Subject: [PATCH 4/6] fix: consolidate multisite setup into single runPHP step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduce blueprint execution time by doing all multisite setup in a single PHP execution instead of multiple wp-cli and runPHP steps. The previous approach (wp core multisite-convert + wp plugin activate) was too slow — the combined blueprint execution time exceeded the 60s Playwright global-setup timeout, causing ECONNREFUSED. The new single runPHP step: 1. Loads WordPress as single-site (MULTISITE not yet defined) 2. Creates multisite tables via install_network() + populate_network() 3. Activates the plugin directly in wp_sitemeta (no wp-cli overhead) 4. Appends MULTISITE constants to wp-config.php for subsequent requests This avoids loading WordPress twice (once for table creation, once for plugin activation) and eliminates the wp-cli bootstrap overhead. --- .github/performance-blueprint.json | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/.github/performance-blueprint.json b/.github/performance-blueprint.json index 92b0c6921..c7e431848 100644 --- a/.github/performance-blueprint.json +++ b/.github/performance-blueprint.json @@ -1,34 +1,8 @@ { - "extraLibraries": ["wp-cli"], "steps": [ - { - "step": "defineWpConfigConsts", - "consts": { - "WP_ALLOW_MULTISITE": 1 - } - }, - { - "step": "runPHP", - "code": "get_error_message():'Multisite network created';" - }, - { - "step": "defineWpConfigConsts", - "consts": { - "MULTISITE": true, - "SUBDOMAIN_INSTALL": false, - "DOMAIN_CURRENT_SITE": "127.0.0.1", - "PATH_CURRENT_SITE": "/", - "SITE_ID_CURRENT_SITE": 1, - "BLOG_ID_CURRENT_SITE": 1 - } - }, - { - "step": "wp-cli", - "command": "wp plugin activate ultimate-multisite --network" + "code": "get_var(\"SELECT meta_value FROM {$wpdb->sitemeta} WHERE meta_key='active_sitewide_plugins' AND site_id=1\")); if(!is_array($active))$active=[]; $active['ultimate-multisite/ultimate-multisite.php']=time(); $wpdb->replace($wpdb->sitemeta,['site_id'=>1,'meta_key'=>'active_sitewide_plugins','meta_value'=>serialize($active)]); $p='/wordpress/wp-config.php'; $c=file_get_contents($p); if(strpos($c,'MULTISITE')===false){$c.=\"\\ndefine('MULTISITE',true);\\ndefine('SUBDOMAIN_INSTALL',false);\\ndefine('DOMAIN_CURRENT_SITE','127.0.0.1');\\ndefine('PATH_CURRENT_SITE','/');\\ndefine('SITE_ID_CURRENT_SITE',1);\\ndefine('BLOG_ID_CURRENT_SITE',1);\\n\\$_SERVER['HTTP_HOST']='127.0.0.1';\\n\";file_put_contents($p,$c);} echo 'Multisite setup complete';" } ] } From 9a10e58dee70c1a4a8b070aeb457ed85a08101b2 Mon Sep 17 00:00:00 2001 From: David Stone Date: Wed, 25 Mar 2026 01:52:36 -0600 Subject: [PATCH 5/6] fix: use --skip-plugins --skip-themes to speed up wp-cli steps The combined blueprint execution time was exceeding the 60s Playwright global-setup timeout. The base blueprint (importWxr + installTheme steps) takes ~50s, and our wp-cli steps were adding another 15-20s. Using --skip-plugins and --skip-themes reduces the WordPress bootstrap time for each wp-cli invocation by skipping plugin/theme loading, which is the main overhead. This should bring the total under 60s. Also adds HTTP_HOST to wp-config.php via runPHP (required for wp core multisite-convert to succeed in WP Playground). --- .github/performance-blueprint.json | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/performance-blueprint.json b/.github/performance-blueprint.json index c7e431848..34ceab5d5 100644 --- a/.github/performance-blueprint.json +++ b/.github/performance-blueprint.json @@ -1,8 +1,23 @@ { + "extraLibraries": ["wp-cli"], "steps": [ + { + "step": "defineWpConfigConsts", + "consts": { + "WP_ALLOW_MULTISITE": 1 + } + }, { "step": "runPHP", - "code": "get_var(\"SELECT meta_value FROM {$wpdb->sitemeta} WHERE meta_key='active_sitewide_plugins' AND site_id=1\")); if(!is_array($active))$active=[]; $active['ultimate-multisite/ultimate-multisite.php']=time(); $wpdb->replace($wpdb->sitemeta,['site_id'=>1,'meta_key'=>'active_sitewide_plugins','meta_value'=>serialize($active)]); $p='/wordpress/wp-config.php'; $c=file_get_contents($p); if(strpos($c,'MULTISITE')===false){$c.=\"\\ndefine('MULTISITE',true);\\ndefine('SUBDOMAIN_INSTALL',false);\\ndefine('DOMAIN_CURRENT_SITE','127.0.0.1');\\ndefine('PATH_CURRENT_SITE','/');\\ndefine('SITE_ID_CURRENT_SITE',1);\\ndefine('BLOG_ID_CURRENT_SITE',1);\\n\\$_SERVER['HTTP_HOST']='127.0.0.1';\\n\";file_put_contents($p,$c);} echo 'Multisite setup complete';" + "code": " Date: Wed, 25 Mar 2026 01:59:36 -0600 Subject: [PATCH 6/6] fix: remove HTTP_HOST override that caused redirect loop The runPHP step was setting $_SERVER['HTTP_HOST']='127.0.0.1' (without port) in wp-config.php. This caused a redirect loop: 1. wp core multisite-convert stores domain as '127.0.0.1:9400' (from siteurl) 2. DOMAIN_CURRENT_SITE is set to '127.0.0.1:9400' 3. Our override sets HTTP_HOST to '127.0.0.1' (without port) 4. WordPress looks for blog with domain '127.0.0.1' but finds none 5. WordPress redirects to http://127.0.0.1:9400/ (the network URL) 6. Infinite redirect loop Without the override, WP Playground sets HTTP_HOST='127.0.0.1:9400' which matches DOMAIN_CURRENT_SITE and the stored blog domain. No redirect. --- .github/performance-blueprint.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/performance-blueprint.json b/.github/performance-blueprint.json index 34ceab5d5..d045f070e 100644 --- a/.github/performance-blueprint.json +++ b/.github/performance-blueprint.json @@ -7,10 +7,6 @@ "WP_ALLOW_MULTISITE": 1 } }, - { - "step": "runPHP", - "code": "