WordPress.org

Make WordPress Core

Ticket #51849: 51849.2.diff

File 51849.2.diff, 11.7 KB (added by xkon, 5 months ago)
  • src/wp-admin/includes/privacy-tools.php

     
    2020        $request    = get_post( $request_id );
    2121
    2222        if ( ! $request || 'user_request' !== $request->post_type ) {
    23                 return new WP_Error( 'privacy_request_error', __( 'Invalid user privacy request.' ) );
     23                return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) );
    2424        }
    2525
    2626        $result = wp_send_user_request( $request_id );
     
    2828        if ( is_wp_error( $result ) ) {
    2929                return $result;
    3030        } elseif ( ! $result ) {
    31                 return new WP_Error( 'privacy_request_error', __( 'Unable to initiate user privacy confirmation request.' ) );
     31                return new WP_Error( 'privacy_request_error', __( 'Unable to initiate confirmation for personal data request.' ) );
    3232        }
    3333
    3434        return true;
     
    4949        $request    = wp_get_user_request( $request_id );
    5050
    5151        if ( ! $request ) {
    52                 return new WP_Error( 'privacy_request_error', __( 'Invalid user privacy request.' ) );
     52                return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) );
    5353        }
    5454
    5555        update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() );
     
    104104                                        add_settings_error(
    105105                                                'action_type',
    106106                                                'action_type',
    107                                                 __( 'Invalid user privacy action.' ),
     107                                                __( 'Invalid personal data action.' ),
    108108                                                'error'
    109109                                        );
    110110                                }
     
    116116                                        add_settings_error(
    117117                                                'action_type',
    118118                                                'action_type',
    119                                                 __( 'Invalid user privacy action.' ),
     119                                                __( 'Invalid personal data request action.' ),
    120120                                                'error'
    121121                                        );
    122122                                }
     
    297297 */
    298298function wp_privacy_generate_personal_data_export_file( $request_id ) {
    299299        if ( ! class_exists( 'ZipArchive' ) ) {
    300                 wp_send_json_error( __( 'Unable to generate user privacy export file. ZipArchive not available.' ) );
     300                wp_send_json_error( __( 'Unable to generate personal data export file. ZipArchive not available.' ) );
    301301        }
    302302
    303303        // Get the request.
     
    304304        $request = wp_get_user_request( $request_id );
    305305
    306306        if ( ! $request || 'export_personal_data' !== $request->action_name ) {
    307                 wp_send_json_error( __( 'Invalid request ID when generating user privacy export file.' ) );
     307                wp_send_json_error( __( 'Invalid request ID when generating personal data export file.' ) );
    308308        }
    309309
    310310        $email_address = $request->email;
    311311
    312312        if ( ! is_email( $email_address ) ) {
    313                 wp_send_json_error( __( 'Invalid email address when generating user privacy export file.' ) );
     313                wp_send_json_error( __( 'Invalid email address when generating personal data export file.' ) );
    314314        }
    315315
    316316        // Create the exports folder if needed.
     
    318318        $exports_url = wp_privacy_exports_url();
    319319
    320320        if ( ! wp_mkdir_p( $exports_dir ) ) {
    321                 wp_send_json_error( __( 'Unable to create user privacy export folder.' ) );
     321                wp_send_json_error( __( 'Unable to create personal data export folder.' ) );
    322322        }
    323323
    324324        // Protect export folder from browsing.
     
    326326        if ( ! file_exists( $index_pathname ) ) {
    327327                $file = fopen( $index_pathname, 'w' );
    328328                if ( false === $file ) {
    329                         wp_send_json_error( __( 'Unable to protect user privacy export folder from browsing.' ) );
     329                        wp_send_json_error( __( 'Unable to protect personal data export folder from browsing.' ) );
    330330                }
    331331                fwrite( $file, '<!-- Silence is golden. -->' );
    332332                fclose( $file );
     
    395395        $file = fopen( $json_report_pathname, 'w' );
    396396
    397397        if ( false === $file ) {
    398                 wp_send_json_error( __( 'Unable to open user privacy export file (JSON report) for writing.' ) );
     398                wp_send_json_error( __( 'Unable to open personal data export file (JSON report) for writing.' ) );
    399399        }
    400400
    401401        fwrite( $file, '{' );
     
    410410        $file = fopen( $html_report_pathname, 'w' );
    411411
    412412        if ( false === $file ) {
    413                 wp_send_json_error( __( 'Unable to open user privacy export file (HTML report) for writing.' ) );
     413                wp_send_json_error( __( 'Unable to open personal data export (HTML report) for writing.' ) );
    414414        }
    415415
    416416        fwrite( $file, "<!DOCTYPE html>\n" );
     
    504504        $zip = new ZipArchive;
    505505        if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
    506506                if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) {
    507                         $error = __( 'Unable to add data to user privacy export file (JSON format).' );
     507                        $error = __( 'Unable to archive the personal data export file (JSON format).' );
    508508                }
    509509
    510510                if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) {
    511                         $error = __( 'Unable to add data to user privacy export file (HTML format).' );
     511                        $error = __( 'Unable to archive the personal data export file (HTML format).' );
    512512                }
    513513
    514514                $zip->close();
     
    529529                        do_action( 'wp_privacy_personal_data_export_file_created', $archive_pathname, $archive_url, $html_report_pathname, $request_id, $json_report_pathname );
    530530                }
    531531        } else {
    532                 $error = __( 'Unable to open user privacy export file (archive) for writing.' );
     532                $error = __( 'Unable to open personal data export file (archive) for writing.' );
    533533        }
    534534
    535535        // Remove the JSON file.
     
    758758        $request = wp_get_user_request( $request_id );
    759759
    760760        if ( ! $request || 'export_personal_data' !== $request->action_name ) {
    761                 wp_send_json_error( __( 'Invalid request ID when merging user privacy exporter data.' ) );
     761                wp_send_json_error( __( 'Invalid request ID when merging the exporter personal data.' ) );
    762762        }
    763763
    764764        $export_data = array();
     
    909909        $request = wp_get_user_request( $request_id );
    910910
    911911        if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
    912                 wp_send_json_error( __( 'Invalid request ID when processing user privacy eraser data.' ) );
     912                wp_send_json_error( __( 'Invalid request ID when processing personal data to erase.' ) );
    913913        }
    914914
    915915        /** This filter is documented in wp-admin/includes/ajax-actions.php */
  • src/wp-includes/user.php

     
    31233123}
    31243124
    31253125/**
    3126  * Get all user privacy request types.
     3126 * Get all personal data request types.
    31273127 *
    31283128 * @since 4.9.6
    31293129 * @access private
     
    38053805        );
    38063806
    38073807        if ( $requests_query->found_posts ) {
    3808                 return new WP_Error( 'duplicate_request', __( 'An incomplete user privacy request for this email address already exists.' ) );
     3808                return new WP_Error( 'duplicate_request', __( 'An incomplete personal data request for this email address already exists.' ) );
    38093809        }
    38103810
    38113811        $request_id = wp_insert_post(
     
    38733873        $request    = wp_get_user_request( $request_id );
    38743874
    38753875        if ( ! $request ) {
    3876                 return new WP_Error( 'invalid_request', __( 'Invalid user privacy request.' ) );
     3876                return new WP_Error( 'invalid_request', __( 'Invalid personal data request.' ) );
    38773877        }
    38783878
    38793879        // Localize message content for user; fallback to site default for visitors.
     
    40614061        $key_request_time = $request->modified_timestamp;
    40624062
    40634063        if ( ! $request || ! $saved_key || ! $key_request_time ) {
    4064                 return new WP_Error( 'invalid_request', __( 'Invalid user privacy request.' ) );
     4064                return new WP_Error( 'invalid_request', __( 'Invalid personal data request.' ) );
    40654065        }
    40664066
    40674067        if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) {
    4068                 return new WP_Error( 'expired_request', __( 'This user privacy request has expired.' ) );
     4068                return new WP_Error( 'expired_request', __( 'This personal data request has expired.' ) );
    40694069        }
    40704070
    40714071        if ( empty( $key ) ) {
    4072                 return new WP_Error( 'missing_key', __( 'This user privacy request is missing the confirmation key.' ) );
     4072                return new WP_Error( 'missing_key', __( 'The confirmation key is missing from this personal data request.' ) );
    40734073        }
    40744074
    40754075        if ( empty( $wp_hasher ) ) {
     
    40884088        $expiration_time     = $key_request_time + $expiration_duration;
    40894089
    40904090        if ( ! $wp_hasher->CheckPassword( $key, $saved_key ) ) {
    4091                 return new WP_Error( 'invalid_key', __( 'This user privacy request confirmation key is invalid.' ) );
     4091                return new WP_Error( 'invalid_key', __( 'The confirmation key is invalid for this personal data request.' ) );
    40924092        }
    40934093
    40944094        if ( ! $expiration_time || time() > $expiration_time ) {
    4095                 return new WP_Error( 'expired_key', __( 'This user privacy request confirmation key has expired.' ) );
     4095                return new WP_Error( 'expired_key', __( 'The confirmation key has expired for this personal data request.' ) );
    40964096        }
    40974097
    40984098        return true;
  • tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php

     
    164164                $request_id = wp_create_user_request( 'removal-requester@example.com', 'remove_personal_data' );
    165165
    166166                $this->expectException( 'WPDieException' );
    167                 $this->expectOutputString( '{"success":false,"data":"Invalid request ID when generating user privacy export file."}' );
     167                $this->expectOutputString( '{"success":false,"data":"Invalid request ID when generating personal data export file."}' );
    168168                wp_privacy_generate_personal_data_export_file( $request_id );
    169169        }
    170170
     
    175175         */
    176176        public function test_invalid_request_id() {
    177177                $this->expectException( 'WPDieException' );
    178                 $this->expectOutputString( '{"success":false,"data":"Invalid request ID when generating user privacy export file."}' );
     178                $this->expectOutputString( '{"success":false,"data":"Invalid request ID when generating personal data export file."}' );
    179179                wp_privacy_generate_personal_data_export_file( 123456789 );
    180180        }
    181181
     
    195195                );
    196196
    197197                $this->expectException( 'WPDieException' );
    198                 $this->expectOutputString( '{"success":false,"data":"Invalid email address when generating user privacy export file."}' );
     198                $this->expectOutputString( '{"success":false,"data":"Invalid email address when generating personal data export file."}' );
    199199                wp_privacy_generate_personal_data_export_file( $request_id );
    200200        }
    201201
     
    209209                touch( untrailingslashit( self::$exports_dir ) );
    210210
    211211                $this->expectException( 'WPDieException' );
    212                 $this->expectOutputString( '{"success":false,"data":"Unable to create user privacy export folder."}' );
     212                $this->expectOutputString( '{"success":false,"data":"Unable to create personal data export folder."}' );
    213213                wp_privacy_generate_personal_data_export_file( self::$export_request_id );
    214214        }
    215215
  • tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php

     
    367367                $invalid_request_id = 0;
    368368
    369369                // Process data, given the last exporter, on the last page and send as email.
    370                 $this->_setup_expected_failure( '{"success":false,"data":"Invalid request ID when merging user privacy exporter data."}' );
     370                $this->_setup_expected_failure( '{"success":false,"data":"Invalid request ID when merging the exporter personal data."}' );
    371371
    372372                wp_privacy_process_personal_data_export_page(
    373373                        $response,
     
    399399                $request_id = wp_create_user_request( self::$requester_email, 'remove_personal_data' );
    400400
    401401                // Process data, given the last exporter, on the last page and send as email.
    402                 $this->_setup_expected_failure( '{"success":false,"data":"Invalid request ID when merging user privacy exporter data."}' );
     402                $this->_setup_expected_failure( '{"success":false,"data":"Invalid request ID when merging the exporter personal data."}' );
    403403
    404404                wp_privacy_process_personal_data_export_page(
    405405                        $response,