wordpress-playground
wordpress-playground copied to clipboard
Sync Protocol
Let's use this core trac issue for discussion:
https://core.trac.wordpress.org/ticket/60375
Let's formalize a protocol for two Playgrounds (and, later on, WordPresses) to exchange updates with each other.
Technically, this would involve:
- Using disjoint numerical space for autoincrement IDs to avoid conflicts
- A network transport
- A local transport (for apps using "Headless Playground" as a storage backend)
- Bits from the Transfer Protocol:
- Replacing host-specific data like site URLs with placeholders
- Providing “export” and “import” extension points for plugins
- Restoring the site URL and other host specific data from placeholders
- Communicate any issues like missing PHP extensions, mismatched PHP version etc
- A hosting connector to publish the changes
- ...more, for sure
Related issues
- https://github.com/WordPress/wordpress-playground/issues/1544
- https://github.com/WordPress/wordpress-playground/issues/1028
- https://github.com/WordPress/wordpress-playground/issues/1563
- https://github.com/WordPress/wordpress-playground/issues/482
- https://github.com/WordPress/wordpress-playground/issues/771
- https://github.com/WordPress/wordpress-playground/pull/727
Open questions
- How to reconcile two plugins writing serialized data to the same database record?
Related reading
cc @dmsnell
@bgrgicak came up with an idea to try https://pouchdb.com/:
The backend can run in the browser and in Node. Technically we should be able to sync two browsers, it uses local storage and some node storage so it’s persistent. This would also resolve some offline support issues. Because when Playground would get back online. Sync would start and all instances would get updates.
For reference, here's an in-depth article about how WP Migrate handles syncing data across sites.
Syncing WordPress Database Changes Between Environments
They discuss the challenge of merging data and conflict resolution, in particular with custom post types and tables created by third-party plugins such as ACF, EDD, WooCommerce.