diff --git a/packages/playground/remote/src/lib/worker-thread.ts b/packages/playground/remote/src/lib/worker-thread.ts index 949a6551a8..30c6184034 100644 --- a/packages/playground/remote/src/lib/worker-thread.ts +++ b/packages/playground/remote/src/lib/worker-thread.ts @@ -63,11 +63,13 @@ if ( wordPressAvailableInOPFS = await playgroundAvailableInOpfs(virtualOpfsDir!); } +// The SQLite integration must always be downloaded, even when using OPFS or Native FS. +// This is because it's stored in the /internal directory, not in WordPress document root. +const sqliteIntegrationRequest = monitoredFetch(sqliteIntegrationUrl); + // Start downloading WordPress if needed let wordPressRequest = null; -let sqliteIntegrationRequest = null; if (!wordPressAvailableInOPFS) { - sqliteIntegrationRequest = monitoredFetch(sqliteIntegrationUrl); if ( requestedWPVersion.startsWith('http://') || requestedWPVersion.startsWith('https://') || @@ -225,13 +227,11 @@ try { ) { const sqliteIntegrationZip = await ( await sqliteIntegrationRequest - )?.blob(); - if (sqliteIntegrationZip) { - await preloadSqliteIntegration( - primaryPhp, - new File([sqliteIntegrationZip], 'sqlite.zip') - ); - } + ).blob(); + await preloadSqliteIntegration( + primaryPhp, + new File([sqliteIntegrationZip], 'sqlite.zip') + ); } // Install WordPress if it isn't installed yet diff --git a/packages/playground/wordpress/src/index.ts b/packages/playground/wordpress/src/index.ts index 6c11ca249c..792f696f8c 100644 --- a/packages/playground/wordpress/src/index.ts +++ b/packages/playground/wordpress/src/index.ts @@ -232,7 +232,6 @@ export async function preloadSqliteIntegration( */ class Playground_SQLite_Integration_Loader { public function __call($name, $arguments) { - die("Loading"); $this->load_sqlite_integration(); if($GLOBALS['wpdb'] === $this) { throw new Exception('Infinite loop detected in $wpdb – SQLite integration plugin could not be loaded'); @@ -243,7 +242,6 @@ class Playground_SQLite_Integration_Loader { ); } public function __get($name) { - die("Loading"); $this->load_sqlite_integration(); if($GLOBALS['wpdb'] === $this) { throw new Exception('Infinite loop detected in $wpdb – SQLite integration plugin could not be loaded'); @@ -331,10 +329,10 @@ export async function unzipWordPress(php: BasePHP, wpZip: File) { ? '/tmp/unzipped-wordpress/build' : '/tmp/unzipped-wordpress'; - php.mv(wpPath, '/wordpress'); + php.mv(wpPath, php.documentRoot); php.writeFile( '/wp-config.php', - php.readFileAsText('/wordpress/wp-config-sample.php') + php.readFileAsText(php.documentRoot + '/wp-config-sample.php') ); }