Make WordPress Core

Ticket #44133: 44133.4.diff

File 44133.4.diff, 5.1 KB (added by desrosj, 7 years ago)

Minor docblock fixes.

  • src/wp-admin/includes/file.php

     
    21832183}
    21842184
    21852185/**
    2186  * Send an email to the user with a link to the personal data export file
     2186 * Send an email to the user with a link to the personal data export file.
    21872187 *
     2188 * The link to the export file is only included in the content of the email,
     2189 * if any personal data is exported.
     2190 *
    21882191 * @since 4.9.6
     2192 * @since 4.9.7 The $has_export_data parameter was added.
    21892193 *
    2190  * @param int $request_id The request ID for this personal data export.
     2194 * @param int  $request_id      The request ID for this personal data export.
     2195 * @param bool $has_export_data Whether there is any personal data to export.
    21912196 * @return true|WP_Error True on success or `WP_Error` on failure.
    21922197 */
    2193 function wp_privacy_send_personal_data_export_email( $request_id ) {
     2198function wp_privacy_send_personal_data_export_email( $request_id, $has_export_data = true ) {
    21942199        // Get the request data.
    21952200        $request = wp_get_user_request_data( $request_id );
    21962201
     
    22022207        $expiration      = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
    22032208        $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration );
    22042209
    2205 /* translators: Do not translate EXPIRATION, LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */
    2206 $email_text = __(
    2207 'Howdy,
     2210        if ( $has_export_data ) {
    22082211
     2212                /* translators: Do not translate EXPIRATION, LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */
     2213                $email_text = __(
     2214                        'Howdy,
     2215
    22092216Your request for an export of personal data has been completed. You may
    22102217download your personal data by clicking on the link below. For privacy
    22112218and security, we will automatically delete the file on ###EXPIRATION###,
     
    22182225Regards,
    22192226All at ###SITENAME###
    22202227###SITEURL###'
    2221 );
     2228                );
    22222229
     2230        } else {
     2231
     2232                /* translators: Do not translate EMAIL, SITENAME, SITEURL: those are placeholders. */
     2233                $email_text = __(
     2234                        'Howdy,
     2235
     2236Your request for an export of personal data has been completed.
     2237
     2238No personal data was found.
     2239
     2240This email has been sent to ###EMAIL###.
     2241
     2242Regards,
     2243All at ###SITENAME###
     2244###SITEURL###'
     2245                );
     2246        }
     2247
    22232248        /**
    22242249         * Filters the text of the email sent with a personal data export file.
    22252250         *
     
    22322257         *
    22332258         * @since 4.9.6
    22342259         *
    2235          * @param string $email_text     Text in the email.
    2236          * @param int    $request_id     The request ID for this personal data export.
     2260         * @param string $email_text      Text in the email.
     2261         * @param int    $request_id      The request ID for this personal data export.
     2262         * @param bool   $has_export_data Whether there is any personal data to export.
    22372263         */
    2238         $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id );
     2264        $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id, $has_export_data );
    22392265
    2240         $email_address = $request->email;
     2266        $email_address   = $request->email;
    22412267        $export_file_url = get_post_meta( $request_id, '_export_file_url', true );
    2242         $site_name = is_multisite() ? get_site_option( 'site_name' ) : get_option( 'blogname' );
    2243         $site_url = network_home_url();
     2268        $site_name       = is_multisite() ? get_site_option( 'site_name' ) : get_option( 'blogname' );
     2269        $site_url        = network_home_url();
    22442270
    22452271        $content = str_replace( '###EXPIRATION###', $expiration_date, $content );
    22462272        $content = str_replace( '###LINK###', esc_url_raw( $export_file_url ), $content );
     
    22512277        $mail_success = wp_mail(
    22522278                $email_address,
    22532279                sprintf(
     2280                        /* translators: %s Site name. */
    22542281                        __( '[%s] Personal Data Export' ),
    22552282                        wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES )
    22562283                ),
     
    23562383        delete_post_meta( $request_id, '_export_data_raw' );
    23572384        update_post_meta( $request_id, '_export_data_grouped', $groups );
    23582385
    2359         /**
    2360          * Generate the export file from the collected, grouped personal data.
    2361          *
    2362          * @since 4.9.6
    2363          *
    2364          * @param int $request_id The export request ID.
    2365          */
    2366         do_action( 'wp_privacy_personal_data_export_file', $request_id );
     2386        $has_export_data = ! empty( $groups );
    23672387
     2388        if ( $has_export_data ) {
     2389
     2390                /**
     2391                * Generate the export file from the collected, grouped personal data.
     2392                *
     2393                * @since 4.9.6
     2394                *
     2395                * @param int $request_id The export request ID.
     2396                */
     2397                do_action( 'wp_privacy_personal_data_export_file', $request_id );
     2398        }
     2399
    23682400        // Clear the grouped data now that it is no longer needed.
    23692401        delete_post_meta( $request_id, '_export_data_grouped' );
    23702402
    23712403        // If the destination is email, send it now.
    23722404        if ( $send_as_email ) {
    2373                 $mail_success = wp_privacy_send_personal_data_export_email( $request_id );
     2405                $mail_success = wp_privacy_send_personal_data_export_email( $request_id, $has_export_data );
    23742406                if ( is_wp_error( $mail_success ) ) {
    23752407                        wp_send_json_error( $mail_success->get_error_message() );
    23762408                }
    2377         } else {
     2409        } elseif ( $has_export_data ) {
    23782410                // Modify the response to include the URL of the export file so the browser can fetch it.
    23792411                $export_file_url = get_post_meta( $request_id, '_export_file_url', true );
    23802412                if ( ! empty( $export_file_url ) ) {