Skip to content

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented May 18, 2024

Moves the WordPress.zip extraction logic to a common utility function called unzipWordPress and living in the @wp-playground/wordpress package. This allows both remote.html and Playground CI to boot consistently.

This and #1425 unlocks providing WordPress ZIP bundles in Blueprints via { "preferredVersion": { "wp": "<URL>" } }.

Implementation details and follow-up work

The goal of unzipWordPress() is to extract a zipped WordPress installation at a specified location in VFS. This isn't a trivial task as WordPress might exist at a root of the zip file, at a nested /wordpress directory, in another wordpress.zip file living inside the initial wp.zip archive, or in any subdirectory of the above. The current implementation covers a few basic cases, but nothing beyond that.

Looking forward, we should:

  • Move that logic to the PHP Blueprints library
  • Either:
    • Make it "just work", e.g. by traversing nested zips and directories in search for WordPress
    • Don't guess anything and allow the developer to specify the exact "coordinates" of their zipped WordPress
    • Only accept a few variations, throw an error when an unsupported zip is provided, document it thoroughly and provide a very informative error message

Testing instructions

Confirm the E2E tests pass

…ility TODO: Rewrite it in PHP using Zip Streams from the PHP Blueprints library, find nested WordPress whether it's in a doubly compressed zip archive or a "build" directory. Give the developer some control over it, too, in case there are multiple zipped WordPresses. Or don't and document that.
adamziel added a commit that referenced this pull request May 18, 2024
Replaces a series of custom steps meant to unzip and configure WordPress with passinf the build zip as a preferredVersion. To test, go to the WordPress PR previewer locally and try previewing one of the recent PRs. Confirm the installed WordPress versions is indeed not the latest stable. Do not merge until these PRs are merged: * #1423 * #1424 * #1425 * #1426 * #1427
@adamziel adamziel merged commit 33249d7 into trunk May 20, 2024
@adamziel adamziel deleted the unzip-wordpress-utility branch May 20, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment