fix: delete all files in the purge cronJob
This commit is contained in:
parent
91c6d14a4d
commit
cebe5a9e65
1 changed files with 1 additions and 6 deletions
|
|
@ -12,17 +12,12 @@ WP_Filesystem();
|
|||
$archiveFolder = sprintf('%s/uploads/passerelle/archive', WP_CONTENT_DIR);
|
||||
|
||||
if (is_dir($archiveFolder)) {
|
||||
$files = array_merge(
|
||||
glob(sprintf('%s/*.xml', $archiveFolder)),
|
||||
glob(sprintf('%s/*.png', $archiveFolder))
|
||||
);
|
||||
|
||||
array_map(
|
||||
function ($value) use ($wp_filesystem) {
|
||||
if (Carbon::parse(filemtime($value))->lessThan(Carbon::now()->sub('3 months'))) {
|
||||
$wp_filesystem->delete($value);
|
||||
};
|
||||
},
|
||||
$files
|
||||
glob(sprintf('%s/*', $archiveFolder))
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue