Skip to content

Follow symlink directories for Jetpack backups #1448

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

Merged

Conversation

epeicher
Copy link
Contributor

@epeicher epeicher commented May 28, 2025

Related issues

Proposed Changes

  • Use archive.directory instead of archive.file for creating the Jetpack backup file so the symlinks can be followed. This works because of the following patch in archiver.

Testing Instructions

Export

  • Create a site that contains symlinks to external folders for example for plugins.
  • Ensure you create both symlinks pointing to directories and symlinks pointing to external files.
  • Navigate to the Import/Export tab and do an export of the site
  • Open the site in Finder, unzip it, and check that the symlinked folders and files contain the actual target folders and dirs and not the symlinks.
  • Repeat the export but ensure you add some symlinks that are pointing to non-existent folders
  • Check there are not unexpected errors.

Push

  • Navigate to the Sync tab
  • Connect a site to a WordPress.com or Pressable site
  • Run a Push
  • Check the pushed site contains the symlinked plugins

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@epeicher epeicher changed the title Follow symlink directories for Jetpack backup Follow symlink directories for Jetpack backups May 28, 2025
@epeicher epeicher force-pushed the stu-392-studio-sync-include-symlink-directories-to-the-jetpack branch from 2b17c53 to 7ea8ef6 Compare May 29, 2025 09:16
Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

This almost works as expected. I confirm the export includes/follow symlinks, but it's not excluding pathsToExclude and I see the sqlite-database-integration folder in the final zip.

Screenshot 2025-05-29 at 14 27 56

I think we should remove the getSiteFiles but we can tackle that in a separate issue. I created STU-536.

Comment on lines 169 to 171
if ( entry.name.includes( '.git' ) || entry.name.includes( 'node_modules' ) ) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

Let's also exclude the pathsToExclude.

Currently I see a regression where the sqlite-database-integration mu-plugin is being exported.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe if mu-plugins is empty we avoid adding it too 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I have excluded them as part of 51c1983.

Maybe if mu-plugins is empty we avoid adding it too 🤔

A nice side effect is that empty directories are automatically excluded, for example, now that pathsToExclude filtering is applied, I cannot see either mu-plugins or fonts because they are empty in my site
CleanShot 2025-05-29 at 17 55 18@2x

@epeicher
Copy link
Contributor Author

I think we should remove the getSiteFiles but we can tackle that in a separate issue. I created STU-536

I also thought about that and decided to suggest it as a follow-up, but you beat me to it 😄. Thank you very much for creating the task

Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

Thanks for the update. It works great! Now the pathsToExclude paths are excluded, and the symlinks are resolved and included in the zip 👍 .

Before

export-with-symlinks-before.mp4

After

export-with-symlinks-after.mp4

Base automatically changed from patch/archiver-to-follow-symlinks to trunk May 30, 2025 08:12
@epeicher epeicher merged commit b8c1ecb into trunk May 30, 2025
13 of 14 checks passed
@epeicher epeicher deleted the stu-392-studio-sync-include-symlink-directories-to-the-jetpack branch May 30, 2025 09:35
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

Successfully merging this pull request may close these issues.

2 participants