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

Include mu-plugins in Studio site import #852

Merged
merged 4 commits into from
Jan 30, 2025
Merged

Conversation

bgrgicak
Copy link
Contributor

@bgrgicak bgrgicak commented Jan 28, 2025

Related issues

Proposed Changes

  • Don't delete the mu-plugins/sqlite-integration-plugin folder during import
  • Include mu-plugins in Playground, Jetpack, Wpress, and Local imports
  • Prevent import from failing if an empty folder wasn't extracted

Testing Instructions

Jetpack Import

  • Import the Jetpack import file
  • Confirm that the site name is updated to Jetpack
  • Confirm that the mu-plugins/sqlite-integration-plugin folder is present
  • Confirm that a mu-plugins/jetpack.php file is present

Playground Import

  • Import the Playground import file
  • Confirm that the site name is updated to Playground
  • Confirm that the mu-plugins/sqlite-integration-plugin folder is present
  • Confirm that a mu-plugins/playground.php file is present

Wpress Import

  • Import the Wpress import file
  • Confirm that the site name is updated to Wpress
  • Confirm that the mu-plugins/sqlite-integration-plugin folder is present
  • Confirm that a mu-plugins/wpress.php file is present

Local Import

  • Import the Local import file
  • Confirm that the site name is updated to Local
  • Confirm that the mu-plugins/sqlite-integration-plugin folder is present
  • Confirm that a mu-plugins/local.php file is present

Pre-merge Checklist

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

@bgrgicak bgrgicak self-assigned this Jan 28, 2025
@bgrgicak bgrgicak added the [Type] Enhancement Improvement upon an existing feature label Jan 28, 2025
@wojtekn wojtekn removed the [Type] Enhancement Improvement upon an existing feature label Jan 28, 2025
Base automatically changed from update/move-mu-plugin-ployfills-to-internals to trunk January 29, 2025 06:02
TODO:
- support mu-plugins in other importers
@bgrgicak bgrgicak force-pushed the update/import-mu-plugins branch from 2b87a69 to 21f86e3 Compare January 29, 2025 06:38
@bgrgicak bgrgicak requested a review from a team January 29, 2025 11:47
@bgrgicak bgrgicak added the [Type] Enhancement Improvement upon an existing feature label Jan 29, 2025
@bgrgicak bgrgicak marked this pull request as ready for review January 29, 2025 11:48
Comment on lines +228 to +232
/**
* If the file does not exist, skip it.
* This can happen if a empty directory is included in the backup
* because the empty directory won't be included in the extraction.
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I discovered this issue in a Local export.
The uploads/2025/01 folder was empty on the site and the 01 folder is missing from the extracted ZIP.
This caused lstat to fail because the directory didn't exist.

@@ -12,6 +12,7 @@ export interface WpContent {
uploads: string[];
plugins: string[];
themes: string[];
muPlugins?: string[];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I make muPlugins mandatory?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it optional, as none of the supported backup formats includes it by default.

@wojtekn
Copy link
Contributor

wojtekn commented Jan 29, 2025

@bgrgicak the code change looks good and works as expected for the packages you provided.

However, it doesn't work for my Playground import file, which works fine in Studio 1.3.2.

Also, we should include mu-plugins/ to export for completeness, so the site exported from Studio and imported again would have the same set of plugins. We can add a separate issue for that, though.

@wojtekn
Copy link
Contributor

wojtekn commented Jan 29, 2025

However, it doesn't work for my Playground import file, which works fine in Studio 1.3.2.

It seems it happens in the trunk, too. I've added https://github.com/Automattic/dotcom-forge/issues/10369

@@ -12,6 +12,7 @@ export interface WpContent {
uploads: string[];
plugins: string[];
themes: string[];
muPlugins?: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it optional, as none of the supported backup formats includes it by default.

@bgrgicak bgrgicak merged commit 00f614b into trunk Jan 30, 2025
9 checks passed
@bgrgicak bgrgicak deleted the update/import-mu-plugins branch January 30, 2025 05:07
@wojtekn
Copy link
Contributor

wojtekn commented Jan 30, 2025

Also, we should include mu-plugins/ to export for completeness, so the site exported from Studio and imported again would have the same set of plugins. We can add a separate issue for that, though.

I've opened https://github.com/Automattic/dotcom-forge/issues/10373 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement Improvement upon an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider importing mu-plugins directories
2 participants