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

Full Site Editing: Templates sync doesn't reconcile deleted files #27304

Closed
Copons opened this issue Nov 26, 2020 · 3 comments
Closed

Full Site Editing: Templates sync doesn't reconcile deleted files #27304

Copons opened this issue Nov 26, 2020 · 3 comments

Comments

@Copons
Copy link
Contributor

Copons commented Nov 26, 2020

Props to @bobbingwide for reporting!

Quick recap

Full Site Editing themes provide templates and template parts as HTML files.
Whenever needed, the site converts those files into wp_template and wp_template_part posts.
At every load, the site checks if there are differences between the files and the posts, and update the posts whenever needed (e.g. if the file content changed, and the post wasn't customized by the user).

The sync process matches file name with post slug.
If the site is missing a post with a given name, the sync will create it.
If the site has that post, and its content is different than the file content, the sync will update it.

The Issue

This sync logic doesn't take into account deleted or renamed files, as it never deletes any posts.

This could happen if, for example, a theme introduced a template file for a specific post misspelling its slug, and renamed it in the following update.

A Possible Fix

I don't think we have many options here. 🤔

Currently the sync loops through the theme files.
We'll need to also loop through the posts — those that are based upon theme files, and have never been customized by the user — check if the corresponding file still exists, and delete the post if needed.

If a user customized a file-based post, we should not delete it — exactly like we don't update its content if the file changed.

@bobbingwide
Copy link
Contributor

If a user customized a file-based post, we should not delete it — exactly like we don't update its content if the file changed.

It would be nice if the user could get some feedback reporting the fact that updates / deletions have occurred but not been applied. Maybe that something for the Site Editor or the wp-template and wp-template part admin pages.

That would be a good place to initiate reconciliation.

@mtias
Copy link
Member

mtias commented Nov 27, 2020

This highlights another important aspect of this issue #27321 (which would be largely solved by it).

@Copons
Copy link
Contributor Author

Copons commented Feb 10, 2021

Closing as not relevant anymore.

@Copons Copons closed this as completed Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants