diff --git a/bootstrap.php b/bootstrap.php index 50f51dc..fd2877c 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -3,6 +3,7 @@ use NewfoldLabs\WP\Module\Migration\Migration; use NewfoldLabs\WP\Module\Migration\Services\UtilityService; use NewfoldLabs\WP\ModuleLoader\Container; +use function NewfoldLabs\WP\Context\getContext; use function NewfoldLabs\WP\ModuleLoader\register; @@ -24,12 +25,15 @@ function () { if ( ! defined( 'NFD_MIGRATION_MODULE_VERSION' ) ) { define( 'NFD_MIGRATION_MODULE_VERSION', '1.0.0' ); } - + $brand = $container->plugin()->id; + if ( 'atomic' === getContext( 'platform' ) ) { + $brand = 'bh-cloud'; + } defined( 'NFD_PROXY_ACCESS_WORKER' ) || define( 'NFD_PROXY_ACCESS_WORKER', 'https://hiive.cloud/workers/migration-token-proxy' ); - $response = UtilityService::get_insta_api_key(); + $response = UtilityService::get_insta_api_key( $brand ); defined( 'INSTAWP_API_KEY' ) || define( 'INSTAWP_API_KEY', $response ); defined( 'INSTAWP_API_DOMAIN' ) || define( 'INSTAWP_API_DOMAIN', 'https://app.instawp.io' ); - defined( 'INSTAWP_MIGRATE_ENDPOINT' ) || define( 'INSTAWP_MIGRATE_ENDPOINT', 'migrate/bluehost' ); + defined( 'INSTAWP_MIGRATE_ENDPOINT' ) || define( 'INSTAWP_MIGRATE_ENDPOINT', 'migrate/' . $brand ); new Migration( $container ); }, diff --git a/emailtemplates/bluehost_cloud_transfer_failed .html b/emailtemplates/bluehost_cloud_transfer_failed .html new file mode 100644 index 0000000..490a813 --- /dev/null +++ b/emailtemplates/bluehost_cloud_transfer_failed .html @@ -0,0 +1,87 @@ + + + + + + + + + + + Email title + + + + + +
+ + + + +
+ + + + +
+
+
+
+ + + + + +
+ Bluehost Logo + + Account Login +
+
+
+

Site Transfer Failed

+

Thanks for choosing Bluehost to support your online needs.

+

Unfortunately, we were unable to successfully complete the transfer of your site.

+

Please contact our support team for more details and for additional migration assistance as we work to resolve this issue.

+

Sincerely,

+

Bluehost Customer Support

+
+
+

Get help with your transfer

+

Our team of experts is available 24/7.

+
+

Call 844-206-2096

+
+
+

Copyright ©️ 2024 All Right Reserved. Bluehost, 5335 Gate Pkwy, Jacksonville, FL 32256

+

Terms of Service | Privacy Notice

+
+
+ +
+
+
+ + + diff --git a/emailtemplates/bluehost_site_transfer_completed.html b/emailtemplates/bluehost_site_transfer_completed.html new file mode 100644 index 0000000..37c7145 --- /dev/null +++ b/emailtemplates/bluehost_site_transfer_completed.html @@ -0,0 +1,85 @@ + + + + + + + + + + + Email title + + + + +
+ + + + +
+ + + + +
+
+ +
+
+ + + + + +
+ Bluehost Logo + + Account Login +
+
+
+

Site Transfer Complete

+

Thanks for choosing Bluehost to support your online needs.

+

Your site has been successfully transferred!

+

Click on the button the below to view your site and double-check that everything is how it should be.

+

Sincerely,

+

Bluehost Customer Support

+
+
+

View your new website

+

{{destination_url}}

+
+ Go to your site +
+
+

Copyright ©️ 2024 All Right Reserved. Bluehost, 5335 Gate Pkwy, Jacksonville, FL 32256

+

Terms of Service | Privacy Notice

+
+
+
+
+
+
+ + diff --git a/emailtemplates/bluehost_site_transfer_failed.html b/emailtemplates/bluehost_site_transfer_failed.html new file mode 100644 index 0000000..87bf2ff --- /dev/null +++ b/emailtemplates/bluehost_site_transfer_failed.html @@ -0,0 +1,87 @@ + + + + + + + + + + + Email title + + + + + +
+ + + + +
+ + + + +
+
+
+
+ + + + + +
+ Bluehost Logo + + Account Login +
+
+
+

Site Transfer Failed

+

Thanks for choosing Bluehost to support your online needs.

+

Unfortunately, we were unable to successfully complete the transfer of your site.

+

Please contact our support team for more details and for additional migration assistance as we work to resolve this issue.

+

Sincerely,

+

Bluehost Customer Support

+
+
+

Get help with your transfer

+

Our team of experts is available 24/7.

+
+

Call 888-401-4678

+
+
+

Copyright ©️ 2024 All Right Reserved. Bluehost, 5335 Gate Pkwy, Jacksonville, FL 32256

+

Terms of Service | Privacy Notice

+
+
+ +
+
+
+ + + diff --git a/emailtemplates/bluehost_site_transfer_started.html b/emailtemplates/bluehost_site_transfer_started.html new file mode 100644 index 0000000..07934d4 --- /dev/null +++ b/emailtemplates/bluehost_site_transfer_started.html @@ -0,0 +1,84 @@ + + + + + + + + + + + Email title + + + + +
+ + + + +
+ + + + +
+
+ +
+
+ + + + + +
+ Bluehost Logo + + Account Login +
+
+
+

Site Transfer Started

+

Thanks for choosing Bluehost to support your online needs.

+

We are writing to let you know that your site transfer has begun!

+

We are currently copying all of your files, content and data to your Bluehost account. You may check the progress of the transfer by clicking the button below.

+

Sincerely,

+

Bluehost Customer Support

+
+
+

View the progress of your site transfer

+
+ Site Transfer Progress +
+
+

Copyright ©️ 2024 All Right Reserved. Bluehost, 5335 Gate Pkwy, Jacksonville, FL 32256

+

Terms of Service | Privacy Notice

+
+
+
+
+
+
+ + diff --git a/emailtemplates/hostgator_site_transfer_completed.html b/emailtemplates/hostgator_site_transfer_completed.html new file mode 100644 index 0000000..088c797 --- /dev/null +++ b/emailtemplates/hostgator_site_transfer_completed.html @@ -0,0 +1,87 @@ + + + + + + + + + + + Email title + + + + +
+ + + + +
+ + + + +
+
+ +
+
+ + + + + +
+ Hostgator Logo + + Account Login +
+
+
+

Site Transfer Complete

+

Thanks for choosing Hostgator to support your online needs.

+

Your site has been successfully transferred!

+

Click on the button the below to view your site and double-check that everything is how it should be.

+

Sincerely,

+

Hostgator Customer Support

+
+
+

View your new website

+

{{destination_url}}

+
+ Go to your site +
+
+

Copyright ©️ 2024 All Right Reserved. Hostgator, 5335 Gate Pkwy, Jacksonville, FL 32256

+

+ Terms of Service | Privacy Notice +

+
+
+
+
+
+
+ + diff --git a/emailtemplates/hostgator_site_transfer_failed.html b/emailtemplates/hostgator_site_transfer_failed.html new file mode 100644 index 0000000..b2de546 --- /dev/null +++ b/emailtemplates/hostgator_site_transfer_failed.html @@ -0,0 +1,87 @@ + + + + + + + + + + + Email title + + + + +
+ + + + +
+ + + + +
+
+ +
+
+ + + + + +
+ Hostgator Logo + + Account Login +
+
+
+

Site Transfer Failed

+

Thanks for choosing Hostgator to support your online needs.

+

Unfortunately, we were unable to successfully complete the transfer of your site.

+

Please contact our support team for more details and for additional migration assistance as we work to resolve this issue.

+

Sincerely,

+

Hostgator Customer Support

+
+
+

Get help with your transfer

+

Our team of experts is available 24/7.

+
+

Call 866-964-2867

+
+
+

Copyright ©️ 2024 All Right Reserved. Hostgator, 5335 Gate Pkwy, Jacksonville, FL 32256

+

+ Terms of Service | Privacy Notice +

+
+
+
+
+
+
+ + diff --git a/emailtemplates/hostgator_site_transfer_started.html b/emailtemplates/hostgator_site_transfer_started.html new file mode 100644 index 0000000..3bec601 --- /dev/null +++ b/emailtemplates/hostgator_site_transfer_started.html @@ -0,0 +1,86 @@ + + + + + + + + + + + Email title + + + + +
+ + + + +
+ + + + +
+
+ +
+
+ + + + + +
+ Hostgator Logo + + Account Login +
+
+
+

Site Transfer Started

+

Thanks for choosing Hostgator to support your online needs.

+

We are writing to let you know that your site transfer has begun!

+

We are currently copying all of your files, content and data to your Hostgator account. You may check the progress of the transfer by clicking the button below.

+

Sincerely,

+

Hostgator Customer Support

+
+
+

View the progress of your site transfer

+
+ Site Transfer Progress +
+
+

Copyright ©️ 2024 All Right Reserved. Hostgator, 5335 Gate Pkwy, Jacksonville, FL 32256

+

+ Terms of Service | Privacy Notice +

+
+
+
+
+
+
+ + diff --git a/includes/Migration.php b/includes/Migration.php index 6312023..751df2d 100644 --- a/includes/Migration.php +++ b/includes/Migration.php @@ -45,7 +45,8 @@ public function __construct( Container $container ) { add_action( 'rest_api_init', array( $this, 'register_routes' ) ); add_action( 'pre_update_option_nfd_migrate_site', array( $this, 'on_update_nfd_migrate_site' ) ); - add_action( 'deleted_plugin', array( $this, 'delete_plugin' ), 10, 2 ); + add_action( 'deleted_plugin', array( $this, 'delete_plugin' ), 10, 1 ); + add_action( 'pre_update_option_instawp_last_migration_details', array( $this, 'on_update_instawp_last_migration_details' ), 10, 1 ); } /** @@ -65,27 +66,43 @@ public function on_update_nfd_migrate_site() { $response = $this->insta_service->install_instawp_connect(); } - public function delete_plugin( $file, $deleted ) { - $migrationDetails = (array) get_option( 'instawp_last_migration_details', array() ); + /** + * Updates showMigrationSteps option based on instawp_last_migration_details + * + * @param string $file path of plugin installed + */ + public function delete_plugin( $file ) { + $migrationDetails = (array) get_option( 'instawp_last_migration_details', array() ); $isMigrationCompleted = $migrationDetails['status']; if ( 'instawp-connect/instawp-connect.php' === $file ) { - if ( $isMigrationCompleted === 'completed') - { - $event = [ - "category" => "wonder_start", - "action" => "migration_completed", - "data" => [] - ]; + if ( 'completed' === $isMigrationCompleted ) { + $event = array( + 'category' => 'wonder_start', + 'action' => 'migration_completed', + 'data' => array(), + ); EventService::send( $event ); } else { - $event = [ - "category" => "wonder_start", - "action" => "migration_failed", - "data" => [] - ]; + $event = array( + 'category' => 'wonder_start', + 'action' => 'migration_failed', + 'data' => array(), + ); EventService::send( $event ); } - - } + } + } + + /** + * Updates showMigrationSteps option based on instawp_last_migration_details + * + * @param array $new_option status of migration + */ + public function on_update_instawp_last_migration_details( $new_option ) { + $value_updated = $new_option['status']; + if ( 'completed' === $value_updated ) { + update_option( 'showMigrationSteps', true ); + } + return $new_option; } } diff --git a/includes/Services/EventService.php b/includes/Services/EventService.php index 5c46e22..7a25fe4 100644 --- a/includes/Services/EventService.php +++ b/includes/Services/EventService.php @@ -1,6 +1,6 @@