Skip to content

Commit

Permalink
REST API: Site endpoint: Return last import engine used in options ar…
Browse files Browse the repository at this point in the history
…ray (#13753)

* REST API: Site endpoint: Return last import engine used in options array

Summary: This Diff adds `import_engine` to the response of the site endpoint. It returns the engine that was last used on the blog from the last `import_done` action.

Test Plan:
* Apply Diff and sandbox `public-api`
* Verify that after successfully completing an import ([which involves running async jobs when the api is sandboxed](https://fieldguide.automattic.com/imports-and-exports/running-imports-on-a-wpcom-sandbox/)) that you see the `import_engine` option set appropriately. This can be tested in coordination with Automattic/wp-calypso#36272

Reviewers: #samus_team, gn00n

Reviewed By: #samus_team, gn00n

Subscribers: gn00n, mattormeeple

Tags: #touches_jetpack_files

Differential Revision: D33115-code

This commit syncs r197917-wpcom.

* Add missing method to fix failing tests
  • Loading branch information
jonathansadowski authored and kraftbj committed Oct 15, 2019
1 parent 354af3d commit 253cef3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions json-endpoints/class.wpcom-json-api-get-site-endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
'design_type',
'site_goals',
'site_segment',
'import_engine',
);

protected static $jetpack_response_field_additions = array(
Expand Down Expand Up @@ -585,6 +586,9 @@ protected function render_option_keys( &$options_response_keys ) {
case 'site_segment':
$options[ $key ] = $site->get_site_segment();
break;
case 'import_engine':
$options[ $key ] = $site->get_import_engine();
break;
}
}

Expand Down
2 changes: 2 additions & 0 deletions sal/class.json-api-site-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ abstract public function get_ak_vp_bundle_enabled();

abstract public function get_podcasting_archive();

abstract public function get_import_engine();

abstract public function get_jetpack_seo_front_page_description();

abstract public function get_jetpack_seo_title_formats();
Expand Down
9 changes: 9 additions & 0 deletions sal/class.json-api-site-jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ function is_fse_active() {
return function_exists( '\A8C\FSE\is_full_site_editing_active' ) && \A8C\FSE\is_full_site_editing_active();
}

/**
* Return the last engine used for an import on the site.
*
* This option is not used in Jetpack.
*/
function get_import_engine() {
return null;
}

/**
* Post functions
*/
Expand Down

0 comments on commit 253cef3

Please sign in to comment.