Skip to content

Commit

Permalink
Janitorial: clean up deprecated code
Browse files Browse the repository at this point in the history
Following #16433, let's remove all code that was deprecated more than 6 months ago.
This commit also standardizes some of the version numbers so they can start getting the proper notices, and we can then remove the deprecations in the future.

Note that "6 months" here refers to 6 months as of the last time this PR was updated, in December 2020.
  • Loading branch information
jeherve committed Jun 25, 2021
1 parent d16ebc0 commit 9aaef68
Show file tree
Hide file tree
Showing 25 changed files with 59 additions and 1,460 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Automattic\Jetpack\Connection\Tokens;
use Automattic\Jetpack\Connection\Urls;
use Automattic\Jetpack\Roles;
use Automattic\Jetpack\Sync\Sender;

/**
* Just a sack of functions. Not actually an IXR_Server
Expand Down Expand Up @@ -739,20 +738,6 @@ public function unlink_user( $user_id = array() ) {
);
}

/**
* Returns any object that is able to be synced.
*
* @deprecated since 7.8.0
* @see Automattic\Jetpack\Sync\Sender::sync_object()
*
* @param array $args the synchronized object parameters.
* @return string Encoded sync object.
*/
public function sync_object( $args ) {
_deprecated_function( __METHOD__, 'jetpack-7.8', 'Automattic\\Jetpack\\Sync\\Sender::sync_object' );
return Sender::get_instance()->sync_object( $args );
}

/**
* Returns the home URL and site URL for the current site which can be used on the WPCOM side for
* IDC mitigation to decide whether sync should be allowed if the home and siteurl values differ between WPCOM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,11 @@ public static function is_opera_mini_dumb() {
*
* Opera Mini 5 Beta: Opera/9.80 (J2ME/MIDP; Opera Mini/5.0.15650/756; U; en) Presto/2.2.0
* Opera Mini 8: Opera/8.01 (J2ME/MIDP; Opera Mini/3.0.6306/1528; en; U; ssr)
*
* @deprecated use is_opera_mobile or is_opera_mini
*/
public static function is_OperaMobile() {
_deprecated_function( __FUNCTION__, 'always', 'is_opera_mini() or is_opera_mobile()' );
_deprecated_function( __FUNCTION__, 'jetpack-8.8.0', 'is_opera_mini() or is_opera_mobile()' );

if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/lazy-images/src/lazy-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public static function should_skip_image_with_blocked_class( $classes ) {
*
* @param array An array of strings where each string is a class.
*/
$blocked_classes = apply_filters_deprecated( 'jetpack_lazy_images_blacklisted_classes', array( $blocked_classes ), 'Jetpack 8.7.0', 'jetpack_lazy_images_blocked_classes' );
$blocked_classes = apply_filters_deprecated( 'jetpack_lazy_images_blacklisted_classes', array( $blocked_classes ), 'jetpack-8.7.0', 'jetpack_lazy_images_blocked_classes' );

/**
* Allow plugins and themes to tell lazy images to skip an image with a given class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3678,105 +3678,6 @@ public static function get_plugin_update_count() {
return new WP_Error( 'not_found', esc_html__( 'Could not check updates for plugins on this site.', 'jetpack' ), array( 'status' => 404 ) );
}

/**
* Deprecated - Get third party plugin API keys.
*
* @deprecated
*
* @param WP_REST_Request $request {
* Array of parameters received by request.
*
* @type string $slug Plugin slug with the syntax 'plugin-directory/plugin-main-file.php'.
* }
*/
public static function get_service_api_key( $request ) {
_deprecated_function( __METHOD__, 'jetpack-6.9.0', 'WPCOM_REST_API_V2_Endpoint_Service_API_Keys::get_service_api_key' );
return WPCOM_REST_API_V2_Endpoint_Service_API_Keys::get_service_api_key( $request );
}

/**
* Deprecated - Update third party plugin API keys.
*
* @deprecated
*
* @param WP_REST_Request $request {
* Array of parameters received by request.
*
* @type string $slug Plugin slug with the syntax 'plugin-directory/plugin-main-file.php'.
* }
*/
public static function update_service_api_key( $request ) {
_deprecated_function( __METHOD__, 'jetpack-6.9.0', 'WPCOM_REST_API_V2_Endpoint_Service_API_Keys::update_service_api_key' );
return WPCOM_REST_API_V2_Endpoint_Service_API_Keys::update_service_api_key( $request );
}

/**
* Deprecated - Delete a third party plugin API key.
*
* @deprecated
*
* @param WP_REST_Request $request {
* Array of parameters received by request.
*
* @type string $slug Plugin slug with the syntax 'plugin-directory/plugin-main-file.php'.
* }
*/
public static function delete_service_api_key( $request ) {
_deprecated_function( __METHOD__, 'jetpack-6.9.0', 'WPCOM_REST_API_V2_Endpoint_Service_API_Keys::delete_service_api_key' );
return WPCOM_REST_API_V2_Endpoint_Service_API_Keys::delete_service_api_key( $request );
}

/**
* Deprecated - Validate the service provided in /service-api-keys/ endpoints.
* To add a service to these endpoints, add the service name to $valid_services
* and add '{service name}_api_key' to the non-compact return array in get_option_names(),
* in class-jetpack-options.php
*
* @deprecated
*
* @param string $service The service the API key is for.
* @return string Returns the service name if valid, null if invalid.
*/
public static function validate_service_api_service( $service = null ) {
_deprecated_function( __METHOD__, 'jetpack-6.9.0', 'WPCOM_REST_API_V2_Endpoint_Service_API_Keys::validate_service_api_service' );
return WPCOM_REST_API_V2_Endpoint_Service_API_Keys::validate_service_api_service( $service );
}

/**
* Error response for invalid service API key requests with an invalid service.
*/
public static function service_api_invalid_service_response() {
_deprecated_function( __METHOD__, 'jetpack-6.9.0', 'WPCOM_REST_API_V2_Endpoint_Service_API_Keys::service_api_invalid_service_response' );
return WPCOM_REST_API_V2_Endpoint_Service_API_Keys::service_api_invalid_service_response();
}

/**
* Deprecated - Validate API Key
*
* @deprecated
*
* @param string $key The API key to be validated.
* @param string $service The service the API key is for.
*/
public static function validate_service_api_key( $key = null, $service = null ) {
_deprecated_function( __METHOD__, 'jetpack-6.9.0', 'WPCOM_REST_API_V2_Endpoint_Service_API_Keys::validate_service_api_key' );
return WPCOM_REST_API_V2_Endpoint_Service_API_Keys::validate_service_api_key( $key, $service );
}

/**
* Deprecated - Validate Mapbox API key
* Based loosely on https://github.com/mapbox/geocoding-example/blob/master/php/MapboxTest.php
*
* @deprecated
*
* @param string $key The API key to be validated.
*/
public static function validate_service_api_key_mapbox( $key ) {
_deprecated_function( __METHOD__, 'jetpack-6.9.0', 'WPCOM_REST_API_V2_Endpoint_Service_API_Keys::validate_service_api_key' );
return WPCOM_REST_API_V2_Endpoint_Service_API_Keys::validate_service_api_key_mapbox( $key );

}

/**
* Get plugins data in site.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,6 @@
* A namespacing class for functionality related to the legacy in-plugin diagnostic tooling.
*/
class Jetpack_Debugger {
/**
* Returns 30 for use with a filter.
*
* To allow time for WP.com to run upstream testing, this function exists to increase the http_request_timeout value
* to 30.
*
* @deprecated 8.0.0
*
* @return int 30
*/
public static function jetpack_increase_timeout() {
_deprecated_function( __METHOD__, 'jetpack-8.0', 'Jetpack_Cxn_Tests::increase_timeout' );
return 30; // seconds.
}

/**
* Disconnect Jetpack and redirect user to connection flow.
*
Expand Down
62 changes: 0 additions & 62 deletions projects/plugins/jetpack/class.jetpack-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,6 @@ function jetpack_register_block( $slug, $args = array() ) {
return Blocks::jetpack_register_block( $slug, $args );
}

/**
* Helper function to register a Jetpack Gutenberg plugin
*
* @deprecated 7.1.0 Use Jetpack_Gutenberg::set_extension_available() instead
*
* @param string $slug Slug of the plugin.
*
* @since 6.9.0
*
* @return void
*/
function jetpack_register_plugin( $slug ) {
_deprecated_function( __FUNCTION__, '7.1', 'Jetpack_Gutenberg::set_extension_available' );

Jetpack_Gutenberg::register_plugin( $slug );
}

/**
* Set the reason why an extension (block or plugin) is unavailable
*
* @deprecated 7.1.0 Use Jetpack_Gutenberg::set_extension_unavailable() instead
*
* @param string $slug Slug of the block.
* @param string $reason A string representation of why the extension is unavailable.
*
* @since 7.0.0
*
* @return void
*/
function jetpack_set_extension_unavailability_reason( $slug, $reason ) {
_deprecated_function( __FUNCTION__, '7.1', 'Jetpack_Gutenberg::set_extension_unavailable' );

Jetpack_Gutenberg::set_extension_unavailability_reason( $slug, $reason );
}

/**
* General Gutenberg editor specific functionality
*/
Expand Down Expand Up @@ -182,19 +147,6 @@ protected static function share_items( $a, $b ) {
return count( array_intersect( $a, $b ) ) > 0;
}

/**
* Register a plugin
*
* @deprecated 7.1.0 Use Jetpack_Gutenberg::set_extension_available() instead
*
* @param string $slug Slug of the plugin.
*/
public static function register_plugin( $slug ) {
_deprecated_function( __METHOD__, '7.1', 'Jetpack_Gutenberg::set_extension_available' );

self::set_extension_available( $slug );
}

/**
* Set a (non-block) extension as available
*
Expand Down Expand Up @@ -243,20 +195,6 @@ public static function set_extension_unavailable( $slug, $reason, $details = arr
);
}

/**
* Set the reason why an extension (block or plugin) is unavailable
*
* @deprecated 7.1.0 Use set_extension_unavailable() instead
*
* @param string $slug Slug of the extension.
* @param string $reason A string representation of why the extension is unavailable.
*/
public static function set_extension_unavailability_reason( $slug, $reason ) {
_deprecated_function( __METHOD__, '7.1', 'Jetpack_Gutenberg::set_extension_unavailable' );

self::set_extension_unavailable( $slug, $reason );
}

/**
* Set up a list of allowed block editor extensions
*
Expand Down
10 changes: 0 additions & 10 deletions projects/plugins/jetpack/class.jetpack-ixr-client.php

This file was deleted.

13 changes: 0 additions & 13 deletions projects/plugins/jetpack/class.jetpack-network.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,6 @@ public function set_connection( Manager $connection ) {
$this->connection = $connection;
}

/**
* Sets which modules get activated by default on subsite connection.
* Modules can be set in Network Admin > Jetpack > Settings
*
* @since 2.9
* @deprecated since 7.7.0
*
* @param array $modules List of modules.
*/
public function set_auto_activated_modules( $modules ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
_deprecated_function( __METHOD__, 'jetpack-7.7' );
}

/**
* Registers new sites upon creation
*
Expand Down
Loading

0 comments on commit 9aaef68

Please sign in to comment.