Changeset 43046 for trunk/src/wp-admin/includes/file.php
- Timestamp:
- 04/30/2018 08:08:37 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/file.php
r43045 r43046 2000 2000 */ 2001 2001 function wp_privacy_generate_personal_data_export_file( $request_id ) { 2002 // Maybe make this a cron job instead.2003 wp_privacy_delete_old_export_files();2004 2005 2002 if ( ! class_exists( 'ZipArchive' ) ) { 2006 2003 wp_send_json_error( __( 'Unable to generate export file. ZipArchive not available.' ) ); … … 2163 2160 } 2164 2161 2165 /* translators: Do not translate LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2162 /** This filter is documented in wp-admin/includes/file.php */ 2163 $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); 2164 $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration ); 2165 2166 /* translators: Do not translate EXPIRATION, LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2166 2167 $email_text = __( 2167 2168 'Howdy, 2168 2169 2169 2170 Your request for an export of personal data has been completed. You may 2170 download your personal data by clicking on the link below. This link is 2171 good for the next 3 days. 2171 download your personal data by clicking on the link below. For privacy 2172 and security, we will automatically delete the file on ###EXPIRATION###, 2173 so please download it before then. 2172 2174 2173 2175 ###LINK### … … 2184 2186 * 2185 2187 * The following strings have a special meaning and will get replaced dynamically: 2188 * ###EXPIRATION### The date when the URL will be automatically deleted. 2186 2189 * ###LINK### URL of the personal data export file for the user. 2187 2190 * ###EMAIL### The email we are sending to. … … 2201 2204 $site_url = network_home_url(); 2202 2205 2206 $content = str_replace( '###EXPIRATION###', $expiration_date, $content ); 2203 2207 $content = str_replace( '###LINK###', esc_url_raw( $export_file_url ), $content ); 2204 2208 $content = str_replace( '###EMAIL###', $email_address, $content ); … … 2345 2349 return $response; 2346 2350 } 2347 2348 /**2349 * Cleans up export files older than three days old.2350 *2351 * @since 4.9.62352 */2353 function wp_privacy_delete_old_export_files() {2354 $upload_dir = wp_upload_dir();2355 $exports_dir = trailingslashit( $upload_dir['basedir'] . '/exports' );2356 $export_files = list_files( $exports_dir );2357 2358 foreach( (array) $export_files as $export_file ) {2359 $file_age_in_seconds = time() - filemtime( $export_file );2360 2361 if ( 3 * DAY_IN_SECONDS < $file_age_in_seconds ) {2362 @unlink( $export_file );2363 }2364 }2365 }
Note: See TracChangeset
for help on using the changeset viewer.