Changeset 43095 for branches/4.9/src/wp-admin/includes/file.php
- Timestamp:
- 05/02/2018 02:32:57 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-admin/includes/file.php
r43094 r43095 1863 1863 */ 1864 1864 function wp_privacy_generate_personal_data_export_file( $request_id ) { 1865 // Maybe make this a cron job instead.1866 wp_privacy_delete_old_export_files();1867 1868 1865 if ( ! class_exists( 'ZipArchive' ) ) { 1869 1866 wp_send_json_error( __( 'Unable to generate export file. ZipArchive not available.' ) ); … … 2026 2023 } 2027 2024 2028 /* translators: Do not translate LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2025 /** This filter is documented in wp-admin/includes/file.php */ 2026 $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); 2027 $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration ); 2028 2029 /* translators: Do not translate EXPIRATION, LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2029 2030 $email_text = __( 2030 2031 'Howdy, 2031 2032 2032 2033 Your request for an export of personal data has been completed. You may 2033 download your personal data by clicking on the link below. This link is 2034 good for the next 3 days. 2034 download your personal data by clicking on the link below. For privacy 2035 and security, we will automatically delete the file on ###EXPIRATION###, 2036 so please download it before then. 2035 2037 2036 2038 ###LINK### … … 2047 2049 * 2048 2050 * The following strings have a special meaning and will get replaced dynamically: 2051 * ###EXPIRATION### The date when the URL will be automatically deleted. 2049 2052 * ###LINK### URL of the personal data export file for the user. 2050 2053 * ###EMAIL### The email we are sending to. … … 2064 2067 $site_url = network_home_url(); 2065 2068 2069 $content = str_replace( '###EXPIRATION###', $expiration_date, $content ); 2066 2070 $content = str_replace( '###LINK###', esc_url_raw( $export_file_url ), $content ); 2067 2071 $content = str_replace( '###EMAIL###', $email_address, $content ); … … 2208 2212 return $response; 2209 2213 } 2210 2211 /**2212 * Cleans up export files older than three days old.2213 *2214 * @since 4.9.62215 */2216 function wp_privacy_delete_old_export_files() {2217 $upload_dir = wp_upload_dir();2218 $exports_dir = trailingslashit( $upload_dir['basedir'] . '/exports' );2219 $export_files = list_files( $exports_dir );2220 2221 foreach( (array) $export_files as $export_file ) {2222 $file_age_in_seconds = time() - filemtime( $export_file );2223 2224 if ( 3 * DAY_IN_SECONDS < $file_age_in_seconds ) {2225 @unlink( $export_file );2226 }2227 }2228 }
Note: See TracChangeset
for help on using the changeset viewer.