清理超过三天的导出文件。

原型

wp_privacy_delete_old_export_files()

描述

导出文件存储在wp-content / uploads中,因此可以公开访问。 CSPRN附加到文件名以减轻未经授权的人下载文件的风险,但仍然可以。在数据主体有机会删除文件后删除文件会增加额外的保护层。

源文件

路径:wp-includes/functions.php

<?php
...
function wp_privacy_delete_old_export_files() {
	require_once( ABSPATH . 'wp-admin/includes/file.php' );
	$exports_dir  = wp_privacy_exports_dir();
	$export_files = list_files( $exports_dir, 100, array( 'index.html' ) );
	/**
	 * Filters the lifetime, in seconds, of a personal data export file.
	 *
	 * By default, the lifetime is 3 days. Once the file reaches that age, it will automatically
	 * be deleted by a cron job.
	 *
	 * @since 4.9.6
	 *
	 * @param int $expiration The expiration age of the export, in seconds.
	 */
	$expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
	foreach ( (array) $export_files as $export_file ) {
		$file_age_in_seconds = time() - filemtime( $export_file );
		if ( $expiration < $file_age_in_seconds ) {
			unlink( $export_file );
		}
	}
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/wp_privacy_delete_old_export_files/