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 * @access private
* *
* @param int $request_id Request ID. * @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 ) { function _wp_privacy_completed_request( $request_id ) {
$request_id = absint( $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.' ) ); return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) );
} }
update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() );
$request = wp_update_post( $result = wp_update_post(
array( array(
'ID' => $request_id, 'ID' => $request_id,
'post_status' => 'request-completed', '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. * @param int $request_id ID of the request.
*/ */
function _wp_privacy_account_request_confirmed( $request_id ) { 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; 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; return;
} }
@ -2992,9 +2992,9 @@ function _wp_privacy_account_request_confirmed( $request_id ) {
* @param int $request_id The ID of the request. * @param int $request_id The ID of the request.
*/ */
function _wp_privacy_send_request_confirmation_notification( $request_id ) { 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; return;
} }
@ -3004,8 +3004,8 @@ function _wp_privacy_send_request_confirmation_notification( $request_id ) {
return; return;
} }
$manage_url = add_query_arg( 'page', $request_data->action_name, admin_url( 'tools.php' ) ); $manage_url = add_query_arg( 'page', $request->action_name, admin_url( 'tools.php' ) );
$action_description = wp_user_request_action_description( $request_data->action_name ); $action_description = wp_user_request_action_description( $request->action_name );
/** /**
* Filters the recipient of the data request confirmation notification. * 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 * @since 4.9.6
* *
* @param string $admin_email The email address of the notification recipient. * @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( $email_data = array(
'request' => $request_data, 'request' => $request,
'user_email' => $request_data->email, 'user_email' => $request->email,
'description' => $action_description, 'description' => $action_description,
'manage_url' => $manage_url, 'manage_url' => $manage_url,
'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), '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. * @param int $request_id The privacy request post ID associated with this request.
*/ */
function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) { 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; return;
} }
@ -3148,13 +3148,13 @@ function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
* *
* @since 4.9.6 * @since 4.9.6
* *
* @param string $user_email The email address of the notification recipient. * @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( $email_data = array(
'request' => $request_data, 'request' => $request,
'message_recipient' => $user_email, 'message_recipient' => $user_email,
'privacy_policy_url' => get_privacy_policy_url(), 'privacy_policy_url' => get_privacy_policy_url(),
'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.