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
  • Loading branch information
Imran92 authored Dec 13, 2024
1 parent 0ca1919 commit 4ff8c90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix migration key fetch failing when DIY migration page is reloaded
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

0 comments on commit 4ff8c90

Please sign in to comment.