Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDC: deprecate unused methods #35444

Merged
merged 7 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: deprecated

Deprecating unused methods for IDC handling
2 changes: 1 addition & 1 deletion projects/packages/identity-crisis/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"link-template": "https://github.com/Automattic/jetpack-identity-crisis/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "0.16.x-dev"
"dev-trunk": "0.17.x-dev"
}
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/identity-crisis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jetpack-identity-crisis",
"version": "0.16.1-alpha",
"version": "0.17.0-alpha",
"description": "Jetpack Identity Crisis",
"main": "_inc/admin.jsx",
"repository": {
Expand Down
47 changes: 40 additions & 7 deletions projects/packages/identity-crisis/src/class-identity-crisis.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Identity_Crisis {
/**
* Package Version
*/
const PACKAGE_VERSION = '0.16.1-alpha';
const PACKAGE_VERSION = '0.17.0-alpha';

/**
* Persistent WPCOM blog ID that stays in the options after disconnect.
Expand Down Expand Up @@ -141,9 +141,11 @@ public static function jetpack_connection_disconnect_site_wpcom_filter() {
/**
* Gets the link to the support document used to explain Safe Mode to users.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public static function get_safe_mod_doc_url() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
return Redirect::get_url( 'jetpack-support-safe-mode' );
}

Expand Down Expand Up @@ -355,11 +357,13 @@ public function check_response_for_idc( $response ) {
/**
* Prepare URL for display.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @param string $url URL to display.
*
* @return string
*/
public static function prepare_url_for_display( $url ) {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
return untrailingslashit( self::normalize_url_protocol_agnostic( $url ) );
}

Expand Down Expand Up @@ -542,19 +546,15 @@ public static function get_sync_error_idc_option( $response = array() ) {
* Returns the value of the jetpack_should_handle_idc filter or constant.
* If set to true, the site will be put into staging mode.
*
* This method uses both the current jetpack_should_handle_idc filter and constant and the
* legacy jetpack_sync_idc_optin filter and constant to determine whether an IDC should be
* handled.
* This method uses both the current jetpack_should_handle_idc filter
* and constant to determine whether an IDC should be handled.
*
* @return bool
* @since 0.2.6
*/
public static function should_handle_idc() {
if ( Constants::is_defined( 'JETPACK_SHOULD_HANDLE_IDC' ) ) {
$default = Constants::get_constant( 'JETPACK_SHOULD_HANDLE_IDC' );
} elseif ( Constants::is_defined( 'JETPACK_SYNC_IDC_OPTIN' ) ) {
// Check the legacy constant. This constant should be considered deprecated as of version 0.2.6.
$default = Constants::get_constant( 'JETPACK_SYNC_IDC_OPTIN' );
} else {
$default = ! Constants::is_defined( 'SUNRISE' ) && ! is_multisite();
}
Expand All @@ -575,9 +575,11 @@ public static function should_handle_idc() {
* Is a container for the error notices.
* Will be shown/controlled by jQuery in idc-notice.js.
*
* @deprecated $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return void
*/
public function render_error_notice() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
?>
<div class="jp-idc-error__notice dops-notice is-error">
<svg class="gridicon gridicons-notice dops-notice__icon" height="24" width="24" viewBox="0 0 24 24">
Expand All @@ -603,9 +605,11 @@ public function render_error_notice() {
/**
* Renders the first step notice.
*
* @deprecated $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return void
*/
public function render_notice_first_step() {
_deprecated_function( __METHOD__, ' $$next-version$$' );
?>
<div class="jp-idc-notice__first-step">
<div class="jp-idc-notice__content-header">
Expand Down Expand Up @@ -646,9 +650,12 @@ public function render_notice_first_step() {
/**
* Renders the second step notice.
*
* @deprecated $$next-version$$ Use `@automattic/jetpack-idc` instead.
*
* @return void
*/
public function render_notice_second_step() {
_deprecated_function( __METHOD__, ' $$next-version$$' );
?>
<div class="jp-idc-notice__second-step">
<div class="jp-idc-notice__content-header">
Expand Down Expand Up @@ -690,9 +697,12 @@ public function render_notice_second_step() {
/**
* Returns the first step header lead.
*
* @deprecated $$next-version$$ Use `@automattic/jetpack-idc` instead.
*
* @return string
*/
public function get_first_step_header_lead() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$html = wp_kses(
sprintf(
/* translators: %s: Safe mode docs URL and site URL. */
Expand All @@ -718,9 +728,12 @@ public function get_first_step_header_lead() {
/**
* Returns the first step header explanation.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
*
* @return string
*/
public function get_first_step_header_explanation() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$html = wp_kses(
sprintf(
/* translators: %s: Safe mode docs URL. */
Expand All @@ -744,9 +757,11 @@ public function get_first_step_header_explanation() {
/**
* Returns the confirm safe mode explanation.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_confirm_safe_mode_action_explanation() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$html = wp_kses(
sprintf(
/* translators: %s: Site URL. */
Expand All @@ -771,9 +786,11 @@ public function get_confirm_safe_mode_action_explanation() {
/**
* Returns the confirm safe mode button text.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_confirm_safe_mode_button_text() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$string = esc_html__( 'Confirm Safe Mode', 'jetpack-idc' );

/**
Expand All @@ -790,9 +807,11 @@ public function get_confirm_safe_mode_button_text() {
/**
* Returns the first step fix connection action explanation.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_first_step_fix_connection_action_explanation() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$html = wp_kses(
sprintf(
/* translators: %s: Site URL. */
Expand All @@ -817,9 +836,11 @@ public function get_first_step_fix_connection_action_explanation() {
/**
* Returns the first step fix connection button text.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_first_step_fix_connection_button_text() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$string = esc_html__( "Fix Jetpack's Connection", 'jetpack-idc' );

/**
Expand All @@ -836,9 +857,11 @@ public function get_first_step_fix_connection_button_text() {
/**
* Returns the second step header lead.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_second_step_header_lead() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$string = sprintf(
/* translators: %s: Site URL. */
esc_html__( 'Is %1$s the new home of %2$s?', 'jetpack-idc' ),
Expand All @@ -860,9 +883,11 @@ public function get_second_step_header_lead() {
/**
* Returns the site action explanation.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_migrate_site_action_explanation() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$html = wp_kses(
sprintf(
/* translators: %s: Site URL. */
Expand All @@ -889,9 +914,11 @@ public function get_migrate_site_action_explanation() {
/**
* Returns the migrate site button text.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_migrate_site_button_text() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$string = esc_html__( 'Migrate Stats &amp; Subscribers', 'jetpack-idc' );

/**
Expand All @@ -908,9 +935,11 @@ public function get_migrate_site_button_text() {
/**
* Returns the start fresh explanation.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_start_fresh_action_explanation() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$html = wp_kses(
sprintf(
/* translators: %s: Site URL. */
Expand All @@ -937,9 +966,11 @@ public function get_start_fresh_action_explanation() {
/**
* Returns the start fresh button text.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_start_fresh_button_text() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$string = esc_html__( 'Start Fresh &amp; Create New Connection', 'jetpack-idc' );

/**
Expand All @@ -956,9 +987,11 @@ public function get_start_fresh_button_text() {
/**
* Returns the unsure prompt text.
*
* @deprecated since $$next-version$$ Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_unsure_prompt() {
_deprecated_function( __METHOD__, 'package-$$next-version$$' );
$html = wp_kses(
sprintf(
/* translators: %s: Safe mode docs URL. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,31 +140,6 @@ public function test_jetpack_should_handle_idc_filter_overrides_constant() {
$this->assertFalse( $result );
}

/**
* Test that should_handle_idc returns true when the legacy JETPACK_SYNC_IDC_OPTIN constant is true.
*/
public function test_should_handle_idc_true_when_legacy_constant_true() {
Constants::set_constant( 'JETPACK_SYNC_IDC_OPTIN', true );
$this->assertTrue( Identity_Crisis::should_handle_idc() );
}

/**
* Test that should_handle_idc returns false when the legacy JETPACK_SYNC_IDC_OPTIN constant is false.
*/
public function test_should_handle_idc_false_when_legacy_constant_false() {
Constants::set_constant( 'JETPACK_SYNC_IDC_OPTIN', false );
$this->assertFalse( Identity_Crisis::should_handle_idc() );
}

/**
* Test that current JETPACK_SHOULD_HANDLE_IDC constant overrides the legacy JETPACK_SYNC_IDC_OPTIN constant.
*/
public function test_should_handle_idc_current_constant_overrides_legacy_constant() {
Constants::set_constant( 'JETPACK_SHOULD_HANDLE_IDC', true );
Constants::set_constant( 'JETPACK_SYNC_IDC_OPTIN', false );
$this->assertTrue( Identity_Crisis::should_handle_idc() );
}

/**
* Test that validate_sync_error_idc_option returns false if the sync_error_idc error doesn't exist.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/backup/composer.lock

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/boost/composer.lock

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/jetpack/composer.lock

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Loading
Loading