Skip to content

Commit 4ff8c90

Browse files
authored
Fix DIY migration failing to fetch migration key and throwing 403 on 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
1 parent 0ca1919 commit 4ff8c90

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Fix migration key fetch failing when DIY migration page is reloaded

projects/packages/jetpack-mu-wpcom/src/features/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-site-migration-wpcom-migration-key.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
* @hide-in-jetpack
1313
*/
1414
class WPCOM_REST_API_V2_Endpoint_Site_Migration_WPCOM_Migration_Key extends WP_REST_Controller {
15-
/**
16-
* Option name that tracks wether the key has been read or not.
17-
* The only possible value for the option is 'read'.
18-
*
19-
* @var string
20-
*/
21-
protected $key_is_read_option_name = 'wpcom_site_migration_wpcom_migration_key_read';
2215

2316
/**
2417
* Class constructor
@@ -73,10 +66,6 @@ public function can_access() {
7366
return false;
7467
}
7568

76-
if ( 'read' === get_option( $this->key_is_read_option_name, false ) ) {
77-
return false;
78-
}
79-
8069
return true;
8170
}
8271

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

92-
update_option( $this->key_is_read_option_name, 'read' );
93-
9481
return $wpcom_migration_info->getConnectionKey();
9582
}
9683

0 commit comments

Comments
 (0)