Better cleanup routine.

This commit is contained in:
James Cole 2016-02-04 17:22:09 +01:00
parent dd361bb9ad
commit f300287814
2 changed files with 3 additions and 2 deletions

View File

@ -48,6 +48,8 @@ class ExportController extends Controller
$name = 'Export job on ' . $date . '.zip';
$quoted = sprintf('"%s"', addcslashes($name, '"\\'));
$job->change('export_downloaded');
return response(file_get_contents($file), 200)
->header('Content-Description', 'File Transfer')

View File

@ -29,8 +29,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface
{
$dayAgo = Carbon::create()->subDay();
ExportJob::where('created_at', '<', $dayAgo->format('Y-m-d H:i:s'))
->where('status', 'never_started')
// TODO also delete others.
->whereIn('status', ['never_started', 'export_status_finished', 'export_downloaded'])
->delete();
return true;