From 37d0e7da4e31193a62129abcfb1eb8a838bca352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 18 May 2021 10:32:11 +0300 Subject: [PATCH] added command to clear temp files --- app/Console/Commands/StorageTempClear.php | 42 +++++++++++++++++++++++ app/Console/Kernel.php | 11 ++++++ config/app.php | 10 +++--- 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 app/Console/Commands/StorageTempClear.php diff --git a/app/Console/Commands/StorageTempClear.php b/app/Console/Commands/StorageTempClear.php new file mode 100644 index 000000000..01d7dd8a9 --- /dev/null +++ b/app/Console/Commands/StorageTempClear.php @@ -0,0 +1,42 @@ +glob("{$path}/*") as $file) { + $filesystem->delete($file); + } + + $this->info('Temporary files cleared!'); + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 6a4c03cbf..88648f393 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -32,6 +32,7 @@ class Kernel extends ConsoleKernel $schedule->command('reminder:invoice')->dailyAt($schedule_time); $schedule->command('reminder:bill')->dailyAt($schedule_time); $schedule->command('recurring:check')->dailyAt($schedule_time); + $schedule->command('storage-temp:clear')->dailyAt('17:00'); } /** @@ -45,4 +46,14 @@ class Kernel extends ConsoleKernel $this->load(__DIR__ . '/Commands'); } + + /** + * Get the timezone that should be used by default for scheduled events. + * + * @return \DateTimeZone|string|null + */ + protected function scheduleTimezone() + { + return config('app.timezone'); + } } diff --git a/config/app.php b/config/app.php index 54edc76b0..86ec20af2 100644 --- a/config/app.php +++ b/config/app.php @@ -14,9 +14,9 @@ return [ 'name' => env('APP_NAME', 'Akaunting'), - 'installed' => env('APP_INSTALLED', false), + 'installed' => (bool) env('APP_INSTALLED', false), - 'schedule_time' => env('APP_SCHEDULE_TIME', '9:00'), + 'schedule_time' => env('APP_SCHEDULE_TIME', '09:00'), /* |-------------------------------------------------------------------------- @@ -70,7 +70,7 @@ return [ | */ - 'timezone' => 'UTC', + 'timezone' => env('APP_TIMEZONE', 'UTC'), /* |-------------------------------------------------------------------------- @@ -96,7 +96,7 @@ return [ | */ - 'fallback_locale' => 'en-GB', + 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en-GB'), /* |-------------------------------------------------------------------------- @@ -108,7 +108,7 @@ return [ | localized telephone numbers, street address information and more. | */ - 'faker_locale' => 'en_GB', + 'faker_locale' => env('APP_FAKER_LOCALE', 'en_GB'), /* |--------------------------------------------------------------------------