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
10 changes: 5 additions & 5 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"license": "GPL-2.0-or-later",
"main": "index.js",
"dependencies": {
"@php-wasm/universal": "3.1.1",
"@php-wasm/universal": "3.1.2",
"@studio/common": "file:../../tools/common",
"@vscode/sudo-prompt": "^9.3.2",
"@wp-playground/blueprints": "3.1.1",
"@wp-playground/cli": "3.1.1",
"@wp-playground/common": "3.1.1",
"@wp-playground/storage": "3.1.1",
"@wp-playground/blueprints": "3.1.2",
"@wp-playground/cli": "3.1.2",
"@wp-playground/common": "3.1.2",
"@wp-playground/storage": "3.1.2",
"cli-table3": "^0.6.5",
"http-proxy": "^1.18.1",
"node-forge": "^1.3.3",
Expand Down
51 changes: 0 additions & 51 deletions apps/cli/patches/@wp-playground+wordpress+3.1.1.patch

This file was deleted.

54 changes: 54 additions & 0 deletions apps/cli/patches/@wp-playground+wordpress+3.1.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/node_modules/@wp-playground/wordpress/index.cjs b/node_modules/@wp-playground/wordpress/index.cjs
index 5a74c51..9cf6092 100644
--- a/node_modules/@wp-playground/wordpress/index.cjs
+++ b/node_modules/@wp-playground/wordpress/index.cjs
@@ -469,7 +469,7 @@ class WP_Config_Transformer {
&& ( T_WHITESPACE === $token[0] || T_COMMENT === $token[0] || T_DOC_COMMENT === $token[0] );
}
}
-`;async function g(t,e){const n=r.joinPaths(e,"wp-config.php"),i={DB_NAME:"wordpress"};if(!t.fileExists(n)&&t.fileExists(r.joinPaths(e,"wp-config-sample.php"))&&await t.writeFile(n,await t.readFileAsBuffer(r.joinPaths(e,"wp-config-sample.php"))),!t.fileExists(n))return;const a=r.phpVars({wpConfigPath:n,constants:i});if((await t.run({code:`${$}
+`;async function g(t,e){const n=r.joinPaths(e,"wp-config.php"),i={};if(!t.fileExists(n)&&t.fileExists(r.joinPaths(e,"wp-config-sample.php"))&&await t.writeFile(n,await t.readFileAsBuffer(r.joinPaths(e,"wp-config-sample.php"))),!t.fileExists(n))return;const a=r.phpVars({wpConfigPath:n,constants:i});if((await t.run({code:`${$}
$wp_config_path = ${a.wpConfigPath};
$transformer = WP_Config_Transformer::from_file($wp_config_path);
foreach ( ${a.constants} as $name => $value ) {
@@ -750,7 +750,11 @@ class WP_Config_Transformer {

$log_file = WP_CONTENT_DIR . '/debug.log';
define('ERROR_LOG_FILE', $log_file);
- ini_set('error_log', $log_file);
+ if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
+ ini_set('error_log', $log_file);
+ } else {
+ ini_set('log_errors', '0');
+ }
?>`),await t.writeFile("/internal/shared/mu-plugins/sitemap-redirect.php",`<?php
/**
* Redirect sitemap.xml to wp-sitemap.xml for non-root installations.
diff --git a/node_modules/@wp-playground/wordpress/index.js b/node_modules/@wp-playground/wordpress/index.js
index aaaa30d..80ce495 100644
--- a/node_modules/@wp-playground/wordpress/index.js
+++ b/node_modules/@wp-playground/wordpress/index.js
@@ -475,9 +475,7 @@ class WP_Config_Transformer {
}
`;
async function I(t, e) {
- const n = s(e, "wp-config.php"), i = {
- DB_NAME: "wordpress"
- };
+ const n = s(e, "wp-config.php"), i = {};
if (!t.fileExists(n) && t.fileExists(s(e, "wp-config-sample.php")) && await t.writeFile(
n,
await t.readFileAsBuffer(
@@ -1010,7 +1008,11 @@ async function U(t) {

$log_file = WP_CONTENT_DIR . '/debug.log';
define('ERROR_LOG_FILE', $log_file);
- ini_set('error_log', $log_file);
+ if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
+ ini_set('error_log', $log_file);
+ } else {
+ ini_set('log_errors', '0');
+ }
?>`
), await t.writeFile(
"/internal/shared/mu-plugins/sitemap-redirect.php",
9 changes: 8 additions & 1 deletion apps/studio/e2e/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
export function getUrlWithAutoLogin( destinationUrl: string ): string {
const parsedUrl = new URL( destinationUrl );
const baseUrl = `${ parsedUrl.protocol }//${ parsedUrl.hostname }:${ parsedUrl.port }`;
return `${ baseUrl }/studio-auto-login?redirect_to=${ encodeURIComponent( destinationUrl ) }`;
// Ensure directory-like paths have a trailing slash to avoid an extra redirect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes E2E tests, but it seems like the issue that should be fixed on the Playground side.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a suggested fix on the Playground side WordPress/wordpress-playground#3301

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I will merge the PR with this change, as it may speed up tests slightly if it avoids a redirect here and there.

// through WordPress's index.php which can produce empty responses.
let pathname = parsedUrl.pathname;
if ( ! pathname.endsWith( '/' ) && ! pathname.includes( '.' ) ) {
pathname += '/';
}
const relativePath = pathname + parsedUrl.search + parsedUrl.hash;
return `${ baseUrl }/studio-auto-login?redirect_to=${ encodeURIComponent( relativePath ) }`;
}
2 changes: 1 addition & 1 deletion apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@types/winreg": "^1.2.36",
"@types/yauzl": "^2.10.3",
"@vitejs/plugin-react": "^5.1.4",
"@wp-playground/blueprints": "3.1.1",
"@wp-playground/blueprints": "3.1.2",
"electron": "^40.6.0",
"electron-devtools-installer": "^4.0.0",
"electron-vite": "^5.0.0",
Expand Down
Loading