Full-site Export / Import Format
Opened this issue · 1 comments
adamziel commented
Let's standardize the site export format used by Playground to:
- Provide users with a reliable, useful export that will continue to work in the future
- Explore a format we'll eventually propose for WordPress core
- Unlock integrating Playground with webhosts
With #1398, no platform-level files live in the WordPress site directory – this makes Playground so much more portable.
Technical implementation
I propose the following format:
- The export is a ZIP file
- In the archive root, there’s
wp-admin,wp-content,wp-includes, other WordPress fileswp-config.phpis shipped and contains all the data it did contain in Playground
- No "storage optimization" is done
- All the WordPress static assets are included in the export, even if Playground was booted from a minified build.
- All the exported
.phpfiles are unminified, even if Playground was booted from a minified build. - The default WordPress theme is present in
wp-content/themes.
- In
wp-content, two non-standard artifacts are shipped:- A series of
.sqlfiles containing the full database dump (to stream-write, e.g. up to 500KB in each) - The SQLite database dump to enable fast loading in Playground (importing .sql can take noticeable time)
- A series of
- No other non-standard artifacts are present in the ZIP. In particular:
- The SQLite integration plugin is not shipped
- Drop-in plugins like
db.phpare not shipped - Playground mu-plugins are not shipped
This would enable:
- Booting Playground directly from the zip file (both in CLI and in the browser)
- Importing both into Playground and with regular PHP
- Importing both into MySQL and SQLite
- Streamed download
Related work
Let's reuse as much of the work already done as possible:
- PHP lib: SQL -> ZIP exporter (needs refactor to stream instead of buffering). Related: wp-cli/ideas#188
- PHP lib: files -> ZIP streaming exporter
- Blueprint libraries including native PHP ZIP support
- URL rewriter: https://github.com/adamziel/site-transfer-protocol
- https://github.com/adamziel/playground-docs-workflow/
- Site Transfer Protocol – Trac discussion with many relevant resources
Outside of scope
- Rewriting links and assets URLs. This will need to land soon after the format, but is not strictly required for the format itself. The URLs would be stream-rewritten on export from the stored site URL to
https://wordpress.internalURL using the rewriting flow we'll need for markdown importing. The importer would stream-rewrite them before inserting each post into the database. - Support for non-standard wp-content path
- Support for exporting env variables or server-provided constants
- Partial export ("I want just these three plugins")
adamziel commented
Related discussions: