Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Create backups of all patterns in case a theme update wipes them out #101

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

johnstonphilip
Copy link
Contributor

@johnstonphilip johnstonphilip commented Mar 8, 2023

Just in case we have a user who uses this in production without understanding the dangers, we can create backups of the generated pattern files for them, which they can use to recover any pattern files they wiped out out by updating their theme.

How to test

  1. Update/Create a pattern.
  2. Notice a duplicate copy was created at /wp-content/pattern-backups/the-theme-name/
  3. Delete a pattern.
  4. Notice it also gets deleted from the backups.
  5. Rename a pattern. Notice the backed-up version also gets renamed.

Suggested changelog entry

  • Added pattern backups.

Copy link
Contributor

@kienstra kienstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @johnstonphilip,
Good response to feedback, but having 2 sources of truth isn't great.

Update: Not really 2 sources of truth, as 1 is only a backup.

If a theme update wipes out the patterns, maybe they're not the ideal user.

They're probably not using GIT, which might defeat the purpose of PM.

@johnstonphilip
Copy link
Contributor Author

johnstonphilip commented Mar 8, 2023

Another idea: search for a .git directory in the theme root. If none exists, put a big (dismissable?) warning?

@kienstra
Copy link
Contributor

kienstra commented Mar 8, 2023

Interesting, I like that more

@johnstonphilip
Copy link
Contributor Author

Another possible replacement for this in #104

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants