Site Editor: Stabilize export endpoint#36559
Conversation
Restore 'gutenberg_generate_edit_site_export_file'
|
Size Change: -226 B (0%) Total Size: 1.1 MB
ℹ️ View Unchanged
|
|
I've not added endpoint unit tests yet. Do we have any existing tests for "download" response types in WP Core that I can use as a base? |
lib/compat/wordpress-5.9/class-wp-rest-edit-site-export-controller.php
Outdated
Show resolved
Hide resolved
walbo
left a comment
There was a problem hiding this comment.
LGTM 👍
Tested with TT2 and a custom block based theme and the export function works as expected.
|
One last thing. Should |
I think it's preferable that it is a global function. That means it can be used by other developers in things like WP CLI commands. |
|
Thanks for testing, @walbo
That was my initial thought, but then I realized we'd lose all unit tests for this feature. @TimothyBJacobs, that's also a good point for keeping it global. Any suggestions regarding my previous comments - #36559 (comment)? |
|
In an ideal world we'd be able to return a response object, but for now the REST server will always try to encode the response data as JSON. In the future, we could make this optional if there is a So for now, as long as it has been tested manually, I think it's probably fine to leave the REST API endpoint itself without unit tests. It could be a good candidate for e2e tests perhaps? |
|
Thanks for the clarification, @TimothyBJacobs. We already have E2E tests for the Export feature. |
|
Great! |
|
@noisysocks I'm adding the "Backport" label, but I will follow up with the core path myself. |
|
@noisysocks, ignore my previous comment 😅 We need to backport this because of a small change in the JS file. |
* Site Editor: Stabilize export endpoint * Move '_remove_theme_attribute_from_content' in block template utils Restore 'gutenberg_generate_edit_site_export_file' * Delete temp file after export * Use ZipArchive::open to create export file * Move gutenberg_generate_edit_site_export_file into 5.9 compat dir
Description
Stabilizes site editor export endpoint and updates to use
WP_REST_Controller.PR also moves
_remove_theme_attribute_in_block_template_contentintoblock-template-utils.php.Fixes #36515.
How has this been tested?
All tests are passing.
Types of changes
Bugfix
Checklist:
*.native.jsfiles for terms that need renaming or removal).