Skip to content

Commit

Permalink
Fix DIY migration failing to fetch migration key and throwing 403 on …
Browse files Browse the repository at this point in the history
…page reload (#40270)

* Remove check for read flag from migration key get api checks

* Changelog - Remove read check from migration key access checks

* Remove key_is_read_option_name altogether

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12319607093

Upstream-Ref: Automattic/jetpack@4ff8c90
  • Loading branch information
Imran92 authored and matticbot committed Dec 13, 2024
1 parent 3703bdc commit 06216a7
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 98 deletions.
58 changes: 29 additions & 29 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/automattic/jetpack-mu-wpcom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This is an alpha version! The changes listed here are not final.
### Fixed
- Code: Clean up JSDoc comments.
- Comments: add cookie consent input and fix console error
- Fix migration key fetch failing when DIY migration page is reloaded
- Holiday Snow: do not display on p2s.
- Load WPCOM sidebar notice async
- Restore visited button color in themes.php to Core's default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
* @hide-in-jetpack
*/
class WPCOM_REST_API_V2_Endpoint_Site_Migration_WPCOM_Migration_Key extends WP_REST_Controller {
/**
* Option name that tracks wether the key has been read or not.
* The only possible value for the option is 'read'.
*
* @var string
*/
protected $key_is_read_option_name = 'wpcom_site_migration_wpcom_migration_key_read';

/**
* Class constructor
Expand Down Expand Up @@ -73,10 +66,6 @@ public function can_access() {
return false;
}

if ( 'read' === get_option( $this->key_is_read_option_name, false ) ) {
return false;
}

return true;
}

Expand All @@ -89,8 +78,6 @@ private function get_migration_key() {
$wpcom_migration_settings = new WPCOMWPSettings();
$wpcom_migration_info = new WPCOMInfo( $wpcom_migration_settings );

update_option( $this->key_is_read_option_name, 'read' );

return $wpcom_migration_info->getConnectionKey();
}

Expand Down
Loading

0 comments on commit 06216a7

Please sign in to comment.