~canonical-sysadmins/wordpress/5.0

« back to all changes in this revision

Viewing changes to wp-admin/includes/file.php

  • Committer: Barry Price
  • Date: 2018-07-06 10:06:19 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: barry.price@canonical.com-20180706100619-g8mbdb7wvr0aamb5
Merge WP4.9.7 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1803
1803
 *
1804
1804
 * @since 4.9.6
1805
1805
 *
1806
 
 * @param array  $group_data {
 
1806
 * @param array $group_data {
1807
1807
 *     The group data to render.
1808
1808
 *
1809
1809
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
1865
1865
 *
1866
1866
 * @since 4.9.6
1867
1867
 *
1868
 
 * @param int  $request_id  The export request ID.
 
1868
 * @param int $request_id The export request ID.
1869
1869
 */
1870
1870
function wp_privacy_generate_personal_data_export_file( $request_id ) {
1871
1871
        if ( ! class_exists( 'ZipArchive' ) ) {
1889
1889
        $exports_dir = wp_privacy_exports_dir();
1890
1890
        $exports_url = wp_privacy_exports_url();
1891
1891
 
1892
 
        $result = wp_mkdir_p( $exports_dir );
1893
 
        if ( is_wp_error( $result ) ) {
1894
 
                wp_send_json_error( $result->get_error_message() );
 
1892
        if ( ! wp_mkdir_p( $exports_dir ) ) {
 
1893
                wp_send_json_error( __( 'Unable to create export folder.' ) );
1895
1894
        }
1896
1895
 
1897
1896
        // Protect export folder from browsing.
2030
2029
                         * @param string $archive_pathname     The full path to the export file on the filesystem.
2031
2030
                         * @param string $archive_url          The URL of the archive file.
2032
2031
                         * @param string $html_report_pathname The full path to the personal data report on the filesystem.
2033
 
                         * @param string $request_id           The export request ID.
 
2032
                         * @param int    $request_id           The export request ID.
2034
2033
                         */
2035
2034
                        do_action( 'wp_privacy_personal_data_export_file_created', $archive_pathname, $archive_url, $html_report_pathname, $request_id );
2036
2035
                }
2051
2050
 *
2052
2051
 * @since 4.9.6
2053
2052
 *
2054
 
 * @param int  $request_id  The request ID for this personal data export.
2055
 
 * @return true|WP_Error    True on success or `WP_Error` on failure.
 
2053
 * @param int $request_id The request ID for this personal data export.
 
2054
 * @return true|WP_Error True on success or `WP_Error` on failure.
2056
2055
 */
2057
2056
function wp_privacy_send_personal_data_export_email( $request_id ) {
2058
2057
        // Get the request data.
2062
2061
                return new WP_Error( 'invalid', __( 'Invalid request ID when sending personal data export email.' ) );
2063
2062
        }
2064
2063
 
2065
 
        /** This filter is documented in wp-admin/includes/file.php */
 
2064
        /** This filter is documented in wp-includes/functions.php */
2066
2065
        $expiration      = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
2067
2066
        $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration );
2068
2067
 
2069
 
/* translators: Do not translate EXPIRATION, LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */
 
2068
/* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */
2070
2069
$email_text = __(
2071
2070
'Howdy,
2072
2071
 
2077
2076
 
2078
2077
###LINK###
2079
2078
 
2080
 
This email has been sent to ###EMAIL###.
2081
 
 
2082
2079
Regards,
2083
2080
All at ###SITENAME###
2084
2081
###SITEURL###'
2090
2087
         * The following strings have a special meaning and will get replaced dynamically:
2091
2088
         * ###EXPIRATION###         The date when the URL will be automatically deleted.
2092
2089
         * ###LINK###               URL of the personal data export file for the user.
2093
 
         * ###EMAIL###              The email we are sending to.
2094
2090
         * ###SITENAME###           The name of the site.
2095
2091
         * ###SITEURL###            The URL to the site.
2096
2092
         *
2184
2180
        update_post_meta( $request_id, '_export_data_raw', $export_data );
2185
2181
 
2186
2182
        // If we are not yet on the last page of the last exporter, return now.
 
2183
        /** This filter is documented in wp-admin/includes/ajax-actions.php */
2187
2184
        $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
2188
2185
        $is_last_exporter = $exporter_index === count( $exporters );
2189
2186
        $exporter_done = $response['done'];
2219
2216
        delete_post_meta( $request_id, '_export_data_raw' );
2220
2217
        update_post_meta( $request_id, '_export_data_grouped', $groups );
2221
2218
 
2222
 
        // Generate the export file from the collected, grouped personal data.
 
2219
        /**
 
2220
         * Generate the export file from the collected, grouped personal data.
 
2221
         *
 
2222
         * @since 4.9.6
 
2223
         *
 
2224
         * @param int $request_id The export request ID.
 
2225
         */
2223
2226
        do_action( 'wp_privacy_personal_data_export_file', $request_id );
2224
2227
 
2225
2228
        // Clear the grouped data now that it is no longer needed.