WordPress.org

Make WordPress Core

Changeset 47245


Ignore:
Timestamp:
02/10/2020 07:55:51 PM (6 months ago)
Author:
SergeyBiryukov
Message:

Privacy: Rename wp_get_user_request_data() to wp_get_user_request() for clarity; deprecate the old function.

The function returns an instance of the WP_User_Request object itself, not its $request_data property.

Follow-up to [44606].

Props garrett-eclipse.
Fixes #46302.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r47233 r47245  
    47114711    check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' );
    47124712
    4713     // Get the request data.
    4714     $request = wp_get_user_request_data( $request_id );
     4713    // Get the request.
     4714    $request = wp_get_user_request( $request_id );
    47154715
    47164716    if ( ! $request || 'export_personal_data' !== $request->action_name ) {
     
    49024902    check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' );
    49034903
    4904     // Get the request data.
    4905     $request = wp_get_user_request_data( $request_id );
     4904    // Get the request.
     4905    $request = wp_get_user_request( $request_id );
    49064906
    49074907    if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
  • trunk/src/wp-admin/includes/class-wp-privacy-requests-table.php

    r47148 r47245  
    303303
    304304        foreach ( $requests as $request ) {
    305             $this->items[] = wp_get_user_request_data( $request->ID );
     305            $this->items[] = wp_get_user_request( $request->ID );
    306306        }
    307307
  • trunk/src/wp-admin/includes/deprecated.php

    r47198 r47245  
    15651565    _deprecated_function( __FUNCTION__, '5.3.0' );
    15661566}
     1567
     1568/**
     1569 * Return the user request object for the specified request ID.
     1570 *
     1571 * @since 4.9.6
     1572 * @deprecated 5.4.0 Use wp_get_user_request()
     1573 * @see wp_get_user_request()
     1574 *
     1575 * @param int $request_id The ID of the user request.
     1576 * @return WP_User_Request|false
     1577 */
     1578function wp_get_user_request_data( $request_id ) {
     1579    _deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' );
     1580    return wp_get_user_request( $request_id );
     1581}
  • trunk/src/wp-admin/includes/privacy-tools.php

    r47219 r47245  
    4242 *
    4343 * @param  int          $request_id Request ID.
    44  * @return int|WP_Error $result Request ID on success or WP_Error.
     44 * @return int|WP_Error $result     Request ID on success or WP_Error.
    4545 */
    4646function _wp_privacy_completed_request( $request_id ) {
     47    // Get the request.
    4748    $request_id = absint( $request_id );
    48     $request    = wp_get_user_request_data( $request_id );
     49    $request    = wp_get_user_request( $request_id );
    4950
    5051    if ( ! $request ) {
     
    289290    }
    290291
    291     // Get the request data.
    292     $request = wp_get_user_request_data( $request_id );
     292    // Get the request.
     293    $request = wp_get_user_request( $request_id );
    293294
    294295    if ( ! $request || 'export_personal_data' !== $request->action_name ) {
     
    502503 */
    503504function wp_privacy_send_personal_data_export_email( $request_id ) {
    504     // Get the request data.
    505     $request = wp_get_user_request_data( $request_id );
     505    // Get the request.
     506    $request = wp_get_user_request( $request_id );
    506507
    507508    if ( ! $request || 'export_personal_data' !== $request->action_name ) {
     
    672673    }
    673674
    674     // Get the request data.
    675     $request = wp_get_user_request_data( $request_id );
     675    // Get the request.
     676    $request = wp_get_user_request( $request_id );
    676677
    677678    if ( ! $request || 'export_personal_data' !== $request->action_name ) {
     
    816817    }
    817818
    818     $request = wp_get_user_request_data( $request_id );
     819    // Get the request.
     820    $request = wp_get_user_request( $request_id );
    819821
    820822    if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
  • trunk/src/wp-includes/user.php

    r47237 r47245  
    30973097 */
    30983098function _wp_privacy_account_request_confirmed( $request_id ) {
    3099     $request = wp_get_user_request_data( $request_id );
     3099    $request = wp_get_user_request( $request_id );
    31003100
    31013101    if ( ! $request ) {
     
    31273127 */
    31283128function _wp_privacy_send_request_confirmation_notification( $request_id ) {
    3129     $request = wp_get_user_request_data( $request_id );
     3129    $request = wp_get_user_request( $request_id );
    31303130
    31313131    if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) {
     
    32663266 */
    32673267function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
    3268     $request = wp_get_user_request_data( $request_id );
     3268    $request = wp_get_user_request( $request_id );
    32693269
    32703270    if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) {
     
    34163416 */
    34173417function _wp_privacy_account_request_confirmed_message( $request_id ) {
    3418     $request = wp_get_user_request_data( $request_id );
     3418    $request = wp_get_user_request( $request_id );
    34193419
    34203420    $message  = '<p class="success">' . __( 'Action has been confirmed.' ) . '</p>';
     
    35523552function wp_send_user_request( $request_id ) {
    35533553    $request_id = absint( $request_id );
    3554     $request    = wp_get_user_request_data( $request_id );
     3554    $request    = wp_get_user_request( $request_id );
    35553555
    35563556    if ( ! $request ) {
     
    37143714
    37153715    $request_id = absint( $request_id );
    3716     $request    = wp_get_user_request_data( $request_id );
     3716    $request    = wp_get_user_request( $request_id );
    37173717
    37183718    if ( ! $request ) {
     
    37663766
    37673767/**
    3768  * Return data about a user request.
     3768 * Return the user request object for the specified request ID.
    37693769 *
    37703770 * @since 4.9.6
    37713771 *
    3772  * @param int $request_id Request ID to get data about.
     3772 * @param int $request_id The ID of the user request.
    37733773 * @return WP_User_Request|false
    37743774 */
    3775 function wp_get_user_request_data( $request_id ) {
     3775function wp_get_user_request( $request_id ) {
    37763776    $request_id = absint( $request_id );
    37773777    $post       = get_post( $request_id );
  • trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php

    r47146 r47245  
    259259
    260260        $report_contents = file_get_contents( $report_dir . 'index.html' );
    261         $request         = wp_get_user_request_data( self::$export_request_id );
     261        $request         = wp_get_user_request( self::$export_request_id );
    262262
    263263        $this->assertContains( '<h1>Personal Data Export</h1>', $report_contents );
     
    286286        $zip->close();
    287287
    288         $request = wp_get_user_request_data( self::$export_request_id );
     288        $request = wp_get_user_request( self::$export_request_id );
    289289
    290290        $this->assertTrue( file_exists( $report_dir . 'export.json' ) );
  • trunk/tests/phpunit/tests/privacy/wpPrivacySendRequestConfirmationNotification.php

    r46586 r47245  
    153153
    154154    /**
    155      * Filter callback that modifies the recipient of the data request confirmation notification.
     155     * Filter callback that modifies the recipient of the user request confirmation notification.
    156156     *
    157157     * @since 4.9.8
    158158     *
    159159     * @param string          $admin_email  The email address of the notification recipient.
    160      * @param WP_User_Request $request_data The request that is initiating the notification.
     160     * @param WP_User_Request $request The request that is initiating the notification.
    161161     * @return string Admin email address.
    162162     */
    163     public function modify_email_address( $admin_email, $request_data ) {
    164         $admin_email = $request_data->email;
     163    public function modify_email_address( $admin_email, $request ) {
     164        $admin_email = $request->email;
    165165        return $admin_email;
    166166    }
Note: See TracChangeset for help on using the changeset viewer.