Skip to content

Commit

Permalink
Post migration tasklist: Add/ssl provisioned task (#39776)
Browse files Browse the repository at this point in the history
* add SSL provisioned task

* changelog

* check for slug ending to enable/disable the task

* add . to domain check

* add a better way to get the url

* remove is_visible_callback, since it defaults to true and add default check for task completion

---------

Co-authored-by: Andrés Blanco <[email protected]>
  • Loading branch information
andres-blanco and Andrés Blanco authored Oct 16, 2024
1 parent 5b688b8 commit f62e160
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

adding a WPCOM task
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down Expand Up @@ -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' );
}
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ function wpcom_launchpad_get_task_list_definitions() {
'review_plugins',
'connect_migration_domain',
'domain_dns_mapped',
'check_ssl_status',
),
),
);
Expand Down

0 comments on commit f62e160

Please sign in to comment.