Skip to content

Include mu-plugins in Studio site import - #852

Merged
bgrgicak merged 4 commits into
trunkfrom
update/import-mu-plugins
Jan 30, 2025
Merged

Include mu-plugins in Studio site import#852
bgrgicak merged 4 commits into
trunkfrom
update/import-mu-plugins

Conversation

@bgrgicak

@bgrgicak bgrgicak commented Jan 28, 2025

Copy link
Copy Markdown
Contributor

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
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 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
Copy Markdown
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.

uploads: string[];
plugins: string[];
themes: string[];
muPlugins?: string[];

Copy link
Copy Markdown
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
Copy Markdown
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

wojtekn commented Jan 29, 2025

Copy link
Copy Markdown
Contributor

@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

wojtekn commented Jan 29, 2025

Copy link
Copy Markdown
Contributor

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

uploads: string[];
plugins: string[];
themes: string[];
muPlugins?: string[];

Copy link
Copy Markdown
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
@bgrgicak
bgrgicak deleted the update/import-mu-plugins branch January 30, 2025 05:07
@wojtekn

wojtekn commented Jan 30, 2025

Copy link
Copy Markdown
Contributor

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

None yet

2 participants