diff --git a/projects/packages/jitm/changelog/add-jitm-sideload-backup-plugin b/projects/packages/jitm/changelog/add-jitm-sideload-backup-plugin new file mode 100644 index 000000000000..cff1da4a8e0b --- /dev/null +++ b/projects/packages/jitm/changelog/add-jitm-sideload-backup-plugin @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Adds filters to allow sideloading of the Jetpack Backup plugin through JITMs. diff --git a/projects/packages/jitm/composer.json b/projects/packages/jitm/composer.json index 7970580b3afc..05f75e7f3273 100644 --- a/projects/packages/jitm/composer.json +++ b/projects/packages/jitm/composer.json @@ -67,7 +67,7 @@ "link-template": "https://github.com/Automattic/jetpack-jitm/compare/v${old}...v${new}" }, "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.1.x-dev" } } } diff --git a/projects/packages/jitm/src/class-jitm.php b/projects/packages/jitm/src/class-jitm.php index d77cc3aae6a6..7f7f6333ea77 100644 --- a/projects/packages/jitm/src/class-jitm.php +++ b/projects/packages/jitm/src/class-jitm.php @@ -20,7 +20,7 @@ */ class JITM { - const PACKAGE_VERSION = '2.0.8'; + const PACKAGE_VERSION = '2.1.0-alpha'; /** * The configuration method that is called from the jetpack-config package. diff --git a/projects/packages/jitm/src/class-post-connection-jitm.php b/projects/packages/jitm/src/class-post-connection-jitm.php index 3d2bbc60f194..8a2d1a2684f8 100644 --- a/projects/packages/jitm/src/class-post-connection-jitm.php +++ b/projects/packages/jitm/src/class-post-connection-jitm.php @@ -161,6 +161,40 @@ public static function jitm_jetpack_creative_mail_activate() { ); } + /** + * A special filter used in the CTA of a JITM offering to install the Jetpack Backup plugin. + * + * @return string The new CTA + */ + public static function jitm_jetpack_backup_install() { + return wp_nonce_url( + add_query_arg( + array( + 'jetpack-backup-action' => 'install', + ), + admin_url( 'admin.php?page=jetpack' ) + ), + 'jetpack-backup-install' + ); + } + + /** + * A special filter used in the CTA of a JITM offering to activate the Jetpack Backup plugin. + * + * @return string The new CTA + */ + public static function jitm_jetpack_backup_activate() { + return wp_nonce_url( + add_query_arg( + array( + 'jetpack-backup-action' => 'activate', + ), + admin_url( 'admin.php?page=jetpack' ) + ), + 'jetpack-backup-install' + ); + } + /** * This is an entire admin notice dedicated to messaging and handling of the case where a user is trying to delete * the connection owner. @@ -366,6 +400,10 @@ public function get_messages( $message_path, $query, $full_jp_logo_exists ) { add_filter( 'jitm_jetpack_creative_mail_install', array( $this, 'jitm_jetpack_creative_mail_install' ) ); add_filter( 'jitm_jetpack_creative_mail_activate', array( $this, 'jitm_jetpack_creative_mail_activate' ) ); + // Jetpack Backup. + add_filter( 'jitm_jetpack_backup_install', array( $this, 'jitm_jetpack_backup_install' ) ); + add_filter( 'jitm_jetpack_backup_activate', array( $this, 'jitm_jetpack_backup_activate' ) ); + $user = wp_get_current_user(); // Unauthenticated or invalid requests just bail. diff --git a/projects/plugins/jetpack/3rd-party/3rd-party.php b/projects/plugins/jetpack/3rd-party/3rd-party.php index dc84bba3d41b..c8c6dd8d768a 100644 --- a/projects/plugins/jetpack/3rd-party/3rd-party.php +++ b/projects/plugins/jetpack/3rd-party/3rd-party.php @@ -24,6 +24,7 @@ function load_3rd_party() { 'class-jetpack-crm-data.php', 'class-jetpack-modules-overrides.php', // Special case. Tools to be used to override module settings. 'creative-mail.php', + 'jetpack-backup.php', 'debug-bar.php', 'class-domain-mapping.php', 'crowdsignal.php', diff --git a/projects/plugins/jetpack/3rd-party/jetpack-backup.php b/projects/plugins/jetpack/3rd-party/jetpack-backup.php new file mode 100644 index 000000000000..ec1880b3a181 --- /dev/null +++ b/projects/plugins/jetpack/3rd-party/jetpack-backup.php @@ -0,0 +1,105 @@ + +
+

+
+