Open akirk opened 6 days ago
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?
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.
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.
wp-config.php
, wp-content
, and a runtime.json
file with the default PHP and WordPress versions.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.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 https://github.com/WordPress/blueprints-library/issues/117.
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.
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?
In the docs it says:
I read this as: if a ZIP file specificed doesn't include a
wp-content
directory, it should be left untouched.