Changeset 43047
- Timestamp:
- 04/30/2018 09:03:31 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/file.php
r43046 r43047 2123 2123 2124 2124 // Now, generate the ZIP. 2125 $error = false; 2125 2126 $archive_filename = $file_basename . '.zip'; 2126 2127 $archive_pathname = $exports_dir . $archive_filename; … … 2128 2129 2129 2130 $zip = new ZipArchive; 2130 2131 if ( TRUE === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) { 2132 $zip->addFile( $html_report_pathname, 'index.html' ); 2131 if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) { 2132 if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) { 2133 $error = __( 'Unable to add data to export file.' ); 2134 } 2135 2133 2136 $zip->close(); 2137 2138 if ( ! $error ) { 2139 /** 2140 * Fires right after all personal data has been written to the export file. 2141 * 2142 * @since 4.9.6 2143 * 2144 * @param string $archive_pathname The full path to the export file on the filesystem. 2145 * @param string $archive_url The URL of the archive file. 2146 * @param string $html_report_pathname The full path to the personal data report on the filesystem. 2147 */ 2148 do_action( 'wp_privacy_personal_data_export_file_created', $archive_pathname, $archive_url, $html_report_pathname ); 2149 } 2134 2150 } else { 2135 wp_send_json_error( __( 'Unable to open export file (archive) for writing' ));2151 $error = __( 'Unable to open export file (archive) for writing.' ); 2136 2152 } 2137 2153 2138 2154 // And remove the HTML file. 2139 2155 unlink( $html_report_pathname ); 2156 2157 if ( $error ) { 2158 wp_send_json_error( $error ); 2159 } 2140 2160 2141 2161 // Save the export file in the request.
Note: See TracChangeset
for help on using the changeset viewer.