Privacy: Add `wp_privacy_personal_data_export_file_created` filter.
This runs immediately after the data export file has been successfully created, allowing plugins to introduce some workflow customizations. For example, a plugin could password-protect the export file, for peace of mind, even though the CSPRN in the filename makes brute force attacks nearly impossible. See #43546. Built from https://develop.svn.wordpress.org/trunk@43047 git-svn-id: http://core.svn.wordpress.org/trunk@42876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
23bf0c7535
commit
9abc0fe73e
|
@ -2122,22 +2122,42 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
|
|||
fclose( $file );
|
||||
|
||||
// Now, generate the ZIP.
|
||||
$error = false;
|
||||
$archive_filename = $file_basename . '.zip';
|
||||
$archive_pathname = $exports_dir . $archive_filename;
|
||||
$archive_url = $exports_url . $archive_filename;
|
||||
|
||||
$zip = new ZipArchive;
|
||||
if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
|
||||
if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) {
|
||||
$error = __( 'Unable to add data to export file.' );
|
||||
}
|
||||
|
||||
if ( TRUE === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
|
||||
$zip->addFile( $html_report_pathname, 'index.html' );
|
||||
$zip->close();
|
||||
|
||||
if ( ! $error ) {
|
||||
/**
|
||||
* Fires right after all personal data has been written to the export file.
|
||||
*
|
||||
* @since 4.9.6
|
||||
*
|
||||
* @param string $archive_pathname The full path to the export file on the filesystem.
|
||||
* @param string $archive_url The URL of the archive file.
|
||||
* @param string $html_report_pathname The full path to the personal data report on the filesystem.
|
||||
*/
|
||||
do_action( 'wp_privacy_personal_data_export_file_created', $archive_pathname, $archive_url, $html_report_pathname );
|
||||
}
|
||||
} else {
|
||||
wp_send_json_error( __( 'Unable to open export file (archive) for writing' ) );
|
||||
$error = __( 'Unable to open export file (archive) for writing.' );
|
||||
}
|
||||
|
||||
// And remove the HTML file.
|
||||
unlink( $html_report_pathname );
|
||||
|
||||
if ( $error ) {
|
||||
wp_send_json_error( $error );
|
||||
}
|
||||
|
||||
// Save the export file in the request.
|
||||
update_post_meta( $request_id, '_export_file_url', $archive_url );
|
||||
update_post_meta( $request_id, '_export_file_path', $archive_pathname );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.0-alpha-43046';
|
||||
$wp_version = '5.0-alpha-43047';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue