Fix deleting paths before the import to support directories - #657
Conversation
| } | ||
|
|
||
| protected async safelyDeleteFile( filePath: string ): Promise< void > { | ||
| protected async safelyDeletePath( path: string ): Promise< void > { |
There was a problem hiding this comment.
I renamed the method and parameter to show better what it does.
| protected async safelyDeletePath( path: string ): Promise< void > { | ||
| try { | ||
| await fsPromises.unlink( filePath ); | ||
| await fsPromises.rm( path, { recursive: true, force: true } ); |
There was a problem hiding this comment.
It supports deleting file and directory recursively.
|
Should I install the 2020 theme and then assert that it's reverted to some default theme and two default plugins were removed? Also I tried to install it and can't find 2020 theme, hm. Sorry, I didn't work with exporting/importing before, and actually I worked with plugins just a little bit. So such short testing steps are very difficult for me to understand. |
It seems we haven't documented all formats in docs yet. We support:
Create a vanilla WordPress site in Studio and see what plugins and themes are included by default. Then, when you add a new site by importing it from the file, confirm that those default plugins and themes are not included in that site, if they were not a part of export file. Also see related issue for more context on use case reported by user. |
katinthehatsite
left a comment
There was a problem hiding this comment.
It works as expected for me and the default plugins get deleted 👍
Please note that I tested only with the wpress file and the Jetpack backup so perhaps we can wait for another review.
@nightnei in most straightforward words:
|
@wojtekn got it, thanks you. It's really much more straightforward and clear to understand what we are actually doing.
All-in-One WP Migration and BackupTested All-in-One WP Migration and Backup - all good, the same result as with "Jetpack Backup". LocalLocal export - all good, the same result what I have in local - no plugins installed at all: PlaygroundPlayground .zip file - the same result as for Local - no plugins installed It's really good PR/fix - if we are importing a site, we should replace all plugins too 👍 |
nightnei
left a comment
There was a problem hiding this comment.
Looks good and test well (look previous comment ^) 👍
|
Thanks for detailed testing @nightnei and @katinthehatsite ! |






Related issues
Proposed Changes
I propose fixing deleting paths before the import to ensure default plugins and themes are deleted before we import the site content.
Testing Instructions
Pre-merge Checklist