Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing regression fix – support old exported Playground ZIPs #1569

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Jul 3, 2024

Motivation for the change, related issues

Closes #1543

Fixes importing older Playground exports via the importWordPressFiles step.

Playground exports before changes from the Boot Protocol (#1398) contained platform-level WordPress plugins and mu-plugins. The importer, then, removed them and replaced them with the latest version freshly sourced from the /wordpress directory.

However, after the Boot Protocol changes, Playground no longer includes any platform-level plugins in the /wordpress directory. This means that things like SQLite database integration were being removed from the imported ZIP bundle but they were not restored.

This PR ensures the 0-sqlite.php mu-plugin file will not be imported. This way, we won't try to require files that the old export assumes to exist but that do not exist anymore.

Other ideas

I've initially tried removing the entire "remove & restore" files mechanism, but that resulted in the following error:

CleanShot 2024-07-03 at 11 28 37@2x

It turned out every platform-level file but 0-sqlite.php was listed for removal. Eventually I would still like to adjust the import flow to remove this "remove & restore" dynamics and allow import bundles to ship their own SQLite database integration plugin, but this PR will have to do for now.

Testing instructions

  1. Export Playground as zip and import it again. Confirm this worked.
  2. Run this Blueprint that imports an older ZIP bundle and confirm it works

CC @vyskoczilova

Closes #1543

Playground exports before changes from the Boot Protocol (#1398)
contained platform-level WordPress plugins and mu-plugins. The importer,
then, removed them and replaced them with the latest version freshly sourced
from the /wordpress directory.

However, after the Boot Protocol changes, Playground no longer includes any
platform-level plugins in the /wordpress directory. This means that
things like SQLite database integration were being removed from the
imported ZIP bundle but they were not restored.

This PR removes this "remove & restore" mechanism. If the ZIP comes with
its own SQLite database integration, that one will be used. If it
doesn't, then Playground will fall back to the platform-level plugin.

 ## Testing instructions

1. Export Playground as zip and import it again. Confirm this worked.
2. Run [this Blueprint that imports an older ZIP bundle](https://playground.wordpress.net/builder/builder.html#{%22landingPage%22:%22/%22,%22preferredVersions%22:{%22php%22:%228.0%22,%22wp%22:%22latest%22},%22phpExtensionBundles%22:[%22kitchen-sink%22],%22features%22:{%22networking%22:true},%22steps%22:[{%22step%22:%22importWordPressFiles%22,%22wordPressFilesZip%22:{%22resource%22:%22url%22,%22url%22:%22https://kybernaut.cz/blueprints/pay-for-payment-playground.zip%22}},{%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22},{%22step%22:%22installPlugin%22,%22pluginZipFile%22:{%22resource%22:%22wordpress.org/plugins%22,%22slug%22:%22woocommerce-pay-for-payment%22},%22options%22:{%22activate%22:true}}]}) and confirm it works

CC @vyskoczilova
@adamziel
Copy link
Collaborator Author

adamziel commented Jul 3, 2024

One last problem to fix here is this message in wp-admin:

CleanShot 2024-07-03 at 11 28 37@2x

It seems like the export ships the SQLite database integration mu-plugin but not the db.php file. In this case we might need to retain the "omit specific files from the imported ZIP bundle" mechanics.

@adamziel adamziel merged commit 34ad7c7 into trunk Jul 3, 2024
4 of 5 checks passed
@adamziel adamziel deleted the fix-import-old-export-files branch July 3, 2024 14:32
@adamziel adamziel self-assigned this Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 participant