mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various code cleanup.
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Repositories\ExportJob;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
@@ -54,11 +55,10 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function cleanup(): bool
|
||||
{
|
||||
$dayAgo = Carbon::create()->subDay();
|
||||
$dayAgo = Carbon::now()->subDay();
|
||||
$set = ExportJob::where('created_at', '<', $dayAgo->format('Y-m-d H:i:s'))
|
||||
->whereIn('status', ['never_started', 'export_status_finished', 'export_downloaded'])
|
||||
->get();
|
||||
@@ -74,7 +74,11 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
unlink(storage_path('export') . DIRECTORY_SEPARATOR . $file);
|
||||
}
|
||||
}
|
||||
$entry->delete();
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::debug(sprintf('Could not delete object: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -142,8 +146,8 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
*/
|
||||
public function getContent(ExportJob $job): string
|
||||
{
|
||||
$disk = Storage::disk('export');
|
||||
$file = $job->key . '.zip';
|
||||
$disk = Storage::disk('export');
|
||||
$file = $job->key . '.zip';
|
||||
|
||||
try {
|
||||
$content = $disk->get($file);
|
||||
|
@@ -375,7 +375,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
}
|
||||
if ('yearly' === $repetition->repetition_type) {
|
||||
//
|
||||
$today = Carbon::create()->endOfYear();
|
||||
$today = Carbon::now()->endOfYear();
|
||||
$repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
|
||||
$diffInYears = $today->diffInYears($repDate);
|
||||
$repDate->addYears($diffInYears); // technically not necessary.
|
||||
|
Reference in New Issue
Block a user