From 50ddffbac37fdae9298d1f11fe1dd7b8535fc839 Mon Sep 17 00:00:00 2001 From: desrosj Date: Tue, 15 Jan 2019 22:35:52 +0000 Subject: [PATCH] Privacy: Use consistent variable naming when working with privacy requests. Throughout the core privacy functions, `WP_User_Request` instances were stored in variables named both `$request`, and `$request_data`. This changes all occurrences of `$request_data` to `$request` for better consistency. Props nateallen, bruceallen, garrett-eclipse. Fixes #44708. Built from https://develop.svn.wordpress.org/trunk@44606 git-svn-id: http://core.svn.wordpress.org/trunk@44437 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/user.php | 12 ++++++------ wp-includes/user.php | 36 ++++++++++++++++++------------------ wp-includes/version.php | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 4e454c6a7f..16ea6eddbc 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -618,26 +618,26 @@ function _wp_privacy_resend_request( $request_id ) { * @access private * * @param int $request_id Request ID. - * @return int|WP_Error $request Request ID on success or WP_Error. + * @return int|WP_Error $result Request ID on success or WP_Error. */ function _wp_privacy_completed_request( $request_id ) { - $request_id = absint( $request_id ); - $request_data = wp_get_user_request_data( $request_id ); + $request_id = absint( $request_id ); + $request = wp_get_user_request_data( $request_id ); - if ( ! $request_data ) { + if ( ! $request ) { return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) ); } update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); - $request = wp_update_post( + $result = wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-completed', ) ); - return $request; + return $result; } /** diff --git a/wp-includes/user.php b/wp-includes/user.php index f30d77cbe8..064f5144f3 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -2962,13 +2962,13 @@ function wp_user_personal_data_exporter( $email_address ) { * @param int $request_id ID of the request. */ function _wp_privacy_account_request_confirmed( $request_id ) { - $request_data = wp_get_user_request_data( $request_id ); + $request = wp_get_user_request_data( $request_id ); - if ( ! $request_data ) { + if ( ! $request ) { return; } - if ( ! in_array( $request_data->status, array( 'request-pending', 'request-failed' ), true ) ) { + if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) { return; } @@ -2992,9 +2992,9 @@ function _wp_privacy_account_request_confirmed( $request_id ) { * @param int $request_id The ID of the request. */ function _wp_privacy_send_request_confirmation_notification( $request_id ) { - $request_data = wp_get_user_request_data( $request_id ); + $request = wp_get_user_request_data( $request_id ); - if ( ! is_a( $request_data, 'WP_User_Request' ) || 'request-confirmed' !== $request_data->status ) { + if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) { return; } @@ -3004,8 +3004,8 @@ function _wp_privacy_send_request_confirmation_notification( $request_id ) { return; } - $manage_url = add_query_arg( 'page', $request_data->action_name, admin_url( 'tools.php' ) ); - $action_description = wp_user_request_action_description( $request_data->action_name ); + $manage_url = add_query_arg( 'page', $request->action_name, admin_url( 'tools.php' ) ); + $action_description = wp_user_request_action_description( $request->action_name ); /** * Filters the recipient of the data request confirmation notification. @@ -3018,14 +3018,14 @@ function _wp_privacy_send_request_confirmation_notification( $request_id ) { * * @since 4.9.6 * - * @param string $admin_email The email address of the notification recipient. - * @param WP_User_Request $request_data The request that is initiating the notification. + * @param string $admin_email The email address of the notification recipient. + * @param WP_User_Request $request The request that is initiating the notification. */ - $admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request_data ); + $admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request ); $email_data = array( - 'request' => $request_data, - 'user_email' => $request_data->email, + 'request' => $request, + 'user_email' => $request->email, 'description' => $action_description, 'manage_url' => $manage_url, 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), @@ -3131,9 +3131,9 @@ All at ###SITENAME### * @param int $request_id The privacy request post ID associated with this request. */ function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) { - $request_data = wp_get_user_request_data( $request_id ); + $request = wp_get_user_request_data( $request_id ); - if ( ! is_a( $request_data, 'WP_User_Request' ) || 'request-completed' !== $request_data->status ) { + if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) { return; } @@ -3148,13 +3148,13 @@ function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) { * * @since 4.9.6 * - * @param string $user_email The email address of the notification recipient. - * @param WP_User_Request $request_data The request that is initiating the notification. + * @param string $user_email The email address of the notification recipient. + * @param WP_User_Request $request The request that is initiating the notification. */ - $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request_data->email, $request_data ); + $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request ); $email_data = array( - 'request' => $request_data, + 'request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), diff --git a/wp-includes/version.php b/wp-includes/version.php index 6995b9f6f7..14d3370988 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta1-44605'; +$wp_version = '5.1-beta1-44606'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.