Skip to content

Commit

Permalink
Always install the playground mu-plugin
Browse files Browse the repository at this point in the history
Installs the Playground mu-plugin even when WordPress is loaded
from the OPFS to ensure:

* The mu-plugin is always there, even when a custom WordPress directory
  is mounted.
* The mu-plugin is always up to date.
  • Loading branch information
adamziel committed Feb 6, 2024
1 parent 5e0508f commit bb81a7a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions packages/playground/remote/src/lib/worker-thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,19 @@ try {
NONCE_SALT: randomString(40),
},
});

/**
* Patch WordPress when it's not restored from OPFS.
* The stored version, presumably, has all the patches
* already applied.
*/

// Install the playground mu-plugin
await writeFiles(php, joinPaths(docroot, '/wp-content/mu-plugins'), {
'0-playground.php': playgroundMuPlugin,
'playground-includes/wp_http_dummy.php': transportDummy,
'playground-includes/wp_http_fetch.php': transportFetch,
});
}

// Always install the playground mu-plugin, even if WordPress is loaded
// from the OPFS. This ensures:
// * The mu-plugin is always there, even when a custom WordPress directory
// is mounted.
// * The mu-plugin is always up to date.
await writeFiles(php, joinPaths(docroot, '/wp-content/mu-plugins'), {
'0-playground.php': playgroundMuPlugin,
'playground-includes/wp_http_dummy.php': transportDummy,
'playground-includes/wp_http_fetch.php': transportFetch,
});

if (virtualOpfsDir) {
await bindOpfs({
php,
Expand Down

0 comments on commit bb81a7a

Please sign in to comment.