diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-ssl-provisioned-task b/projects/packages/jetpack-mu-wpcom/changelog/add-ssl-provisioned-task new file mode 100644 index 0000000000000..6a120468bd1ad --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-ssl-provisioned-task @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +adding a WPCOM task diff --git a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php index d1e2fb1b392f4..352d3d2932d7d 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php @@ -852,6 +852,17 @@ function wpcom_launchpad_get_task_definitions() { 'is_complete_callback' => 'wpcom_launchpad_is_task_option_completed', 'is_visible_callback' => '__return_true', ), + 'check_ssl_status' => array( + 'get_title' => function () { + return __( 'Provision SSL certificate', 'jetpack-mu-wpcom' ); + }, + 'is_complete_callback' => 'wpcom_launchpad_is_task_option_completed', + 'is_disabled_callback' => 'wpcom_launchpad_is_primary_domain_wpcom', + 'get_calypso_path' => function ( $task, $default, $data ) { + $domain = $data['site_slug_encoded']; + return '/domains/manage/' . $domain . '/edit/' . $domain; + }, + ), ); $extended_task_definitions = apply_filters( 'wpcom_launchpad_extended_task_definitions', array() ); @@ -2803,3 +2814,20 @@ function wpcom_launchpad_get_latest_draft_id() { return $cached_draft_id; } + +/** + * Checks if the current site primary domain is a WPCOM domain. + * + * @return bool Will return true if the primary domain is a WPCOM domain. + */ +function wpcom_launchpad_is_primary_domain_wpcom() { + if ( ! ( new Automattic\Jetpack\Status\Host() )->is_wpcom_platform() ) { + return false; + } + + $url = home_url(); + $host = wp_parse_url( $url, PHP_URL_HOST ); + + // If site_slug ends with .wpcomstaging.com return true + return str_ends_with( $host, '.wpcomstaging.com' ); +} diff --git a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php index d8e2ceb64e2e5..8c4a999899b69 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php @@ -325,6 +325,7 @@ function wpcom_launchpad_get_task_list_definitions() { 'review_plugins', 'connect_migration_domain', 'domain_dns_mapped', + 'check_ssl_status', ), ), );