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
This commit is contained in:
desrosj 2019-01-15 22:35:52 +00:00
parent c062e39ac8
commit 50ddffbac3
3 changed files with 25 additions and 25 deletions

View File

@ -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 = 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;
}
/**

View File

@ -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.
@ -3019,13 +3019,13 @@ 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 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;
}
@ -3149,12 +3149,12 @@ 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 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 ),

View File

@ -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.