Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Also delete old files.
James Coledbd32abdd1e1
diff --git a/app/Repositories/ExportJob/ExportJobRepository.php b/app/Repositories/ExportJob/ExportJobRepository.phpindex 20fe195cf1..db5e1450e8 100644--- a/app/Repositories/ExportJob/ExportJobRepository.php+++ b/app/Repositories/ExportJob/ExportJobRepository.php@@ -28,9 +28,24 @@ class ExportJobRepository implements ExportJobRepositoryInterfacepublic function cleanup(){$dayAgo = Carbon::create()->subDay();- ExportJob::where('created_at', '<', $dayAgo->format('Y-m-d H:i:s'))- ->whereIn('status', ['never_started', 'export_status_finished', 'export_downloaded'])- ->delete();+ $set = ExportJob::where('created_at', '<', $dayAgo->format('Y-m-d H:i:s'))+ ->whereIn('status', ['never_started', 'export_status_finished', 'export_downloaded'])+ ->get();++ // loop set:+ /** @var ExportJob $entry */+ foreach ($set as $entry) {+ $key = $entry->key;+ $len = strlen($key);+ $files = scandir(storage_path('export'));+ /** @var string $file */+ foreach ($files as $file) {+ if (substr($file, 0, $len) === $key) {+ unlink(storage_path('export') . DIRECTORY_SEPARATOR . $file);+ }+ }+ $entry->delete();+ }return true;}