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

importWordPressFiles should leave directories untouched that are not in the ZIP file #1992

Open
akirk opened this issue Nov 11, 2024 · 4 comments

Comments

@akirk
Copy link
Member

akirk commented Nov 11, 2024

In the docs it says:

Any files that Playground recognizes as “excluded from the export” will carry over from the existing document root into the imported directories. For example, the sqlite-database-integration plugin.

I read this as: if a ZIP file specificed doesn't include a wp-content directory, it should be left untouched.

@bgrgicak
Copy link
Collaborator

By looking at the code it looks intentional that we overwrite the wp-content folder.
The documentation part you shared is confusing to me. It's not clear what “excluded from the export” means (It's this list).

How could we phrase this differently?

Technical details

This is happening because we overwrite the entire wp-content folder.

Even if the ZIP doesn't contain a wp-content folder the importWordPressFiles step will create it because it copies Playground related files from the live site into the imported site.

@bgrgicak bgrgicak moved this from Inbox to Needs Author's Reply in Playground Board Nov 13, 2024
@adamziel
Copy link
Collaborator

adamziel commented Nov 13, 2024

I don't like how that step works today. It was through way too many iterations without proper importing tools. Luckily, we have more tooling now (URL rewriter, block markup parser, internal Playground directory). Let's take a step back, forget about any existing assumptions, and discuss the most useful possible version of a ZIP import.

First, I don't like having a special list of files excluded from the export. Initially, it was just a way to exclude the platform-level mu-plugins from the export. These days we don't ship them anymore, so that's a solved problem. Removing that list would break a few export files that are 12+ months old – I think that's okay. Once we remove that list, we can get rid of that confusing part of the documentation.

Thinking forward, I wonder what kinds of ZIP files would be useful to support? The snapshots support explores that question.

  • For this discussion, let's assume there's no Blueprint inside the ZIP.
  • A minimal archive seems to be wp-config.php, wp-content, and a runtime.json file with the default PHP and WordPress versions.
  • Challenge: What if there are relevant content files outside of the wp-content directory – right at the root level of the site? To capture them, we'd need to zip up everything except of the files bundled with the current WordPress release. It seems fuzzy but perhaps there's a way to make it reliable.
  • Without the runtime.json, we need to include the WordPress release in the zip.

So we'd either import wp-content plus some top-level files, or a full WordPress site. I don't see a scenario where there's no wp-content in the archive.

By the way! This is the same problem space as @brandonpayton is exploring in WordPress/blueprints-library#117.

@adamziel
Copy link
Collaborator

Also, I don't want to make any further adjustments in the TypeScript "import site" step. Everything I said, I meant for the PHP importer.

@adamziel adamziel moved this from Needs Author's Reply to Inbox in Playground Board Nov 13, 2024
@brandonpayton
Copy link
Member

Challenge: What if there are relevant content files outside of the wp-content directory – right at the root level of the site? To capture them, we'd need to zip up everything except of the files bundled with the current WordPress release. It seems fuzzy but perhaps there's a way to make it reliable.

Maybe content outside of wp-content should be considered Doing It Wrong. We could support some kind of escape hatch (like an option to grab other specific dirs if present), but isn't the purpose of wp-content to contain all the content?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Inbox
Development

No branches or pull requests

4 participants