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

Import attachment posts from staging #93

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

tellyworth
Copy link
Contributor

This imports attachment posts to the local env. Possible solution to the different image behaviour we've been seeing on local vs production.

WIP.

@tellyworth tellyworth added the [Component] Tools Build tools, packages, etc label Aug 17, 2022
@tellyworth
Copy link
Contributor Author

@dd32 got a sec for an opinion here?

The main reason for doing this is so that we have attachment posts with matching IDs, so there's (hopefully) identical behaviour from blocks running locally as from prod.

With respect to the files themselves, I'm undecided whether it should:

  • Also download the media files and store them locally, with local attachment post metadata pointing to the local files (easy but doesn't quite match prod); or
  • Don't download the files, and have the local attachment post metadata point to the remote file URLs (not sure if this easy or reliable)

What's your take?

@dd32
Copy link
Member

dd32 commented Aug 22, 2022

Also download the media files and store them locally, with local attachment post metadata pointing to the local files (easy but doesn't quite match prod); or

Assuming that the IDs match between local and prod, this doesn't seem like a terrible idea. It would also allow for image-editing functions (and others) to be used on the local copy.. It would not necessarily require updating the post contents to use the local image URLs though, from my understanding it should just work if it's got the remote urls in the post content still?

Don't download the files, and have the local attachment post metadata point to the remote file URLs (not sure if this easy or reliable)

But this also sounds like a potential solution, but it would probably require a plugin to filter the URLs, that would then require ongoing maintenance, as I believe WordPress has moved away from storing absolute paths (on disk, and http urls) as part of the media metadata. That would make this a potentially more complicated and more likely to have side-effects. One thing that comes to mind here, is that there's some work being done around webp's in core that would expect the source-files to exist on disk for on-the-fly/background-processing conversion.

@tellyworth tellyworth requested a review from dd32 August 22, 2022 07:12
@tellyworth tellyworth marked this pull request as ready for review August 22, 2022 07:13
@tellyworth tellyworth requested a review from ryelle August 22, 2022 07:14
@tellyworth
Copy link
Contributor Author

I went with the first option, thanks for the advice.

@ryelle this seems to work ok but isn't thoroughly tested. I'm not entirely clear on whether or not it solves the issue of (for ex) different lazy loading behaviour on local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Tools Build tools, packages, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants