auto delete all shared links every day in demo mode

This commit is contained in:
Čarodej
2022-03-31 11:22:13 +02:00
parent ff476251f5
commit 182451515c
3 changed files with 20 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
APP_NAME=Laravel APP_NAME=Laravel
APP_ENV=local APP_ENV=local
APP_KEY=base64:SrIyY45mJQvvP8DTufIDcTRptGHFka0jT+QCsAj1yI4= APP_KEY=base64:Dau44h6D3cJyjYdcbJ2ZjEf52oKR5xqjQ4BrJykCh0g=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost APP_URL=http://localhost
APP_DEMO=false APP_DEMO=false

View File

@@ -5,6 +5,7 @@ use Illuminate\Console\Scheduling\Schedule;
use App\Console\Commands\SetupDevEnvironment; use App\Console\Commands\SetupDevEnvironment;
use App\Console\Commands\SetupProdEnvironment; use App\Console\Commands\SetupProdEnvironment;
use Support\Scheduler\Actions\ReportUsageAction; use Support\Scheduler\Actions\ReportUsageAction;
use Support\Demo\Actions\DeleteAllSharedLinksAction;
use Support\Scheduler\Actions\DeleteFailedFilesAction; use Support\Scheduler\Actions\DeleteFailedFilesAction;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Support\Scheduler\Actions\DeleteUnverifiedUsersAction; use Support\Scheduler\Actions\DeleteUnverifiedUsersAction;
@@ -39,6 +40,12 @@ class Kernel extends ConsoleKernel
)->everySixHours(); )->everySixHours();
} }
if (is_demo()) {
$schedule->call(
fn () => resolve(DeleteAllSharedLinksAction::class)()
)->daily()->at('00:00');
}
$schedule->call( $schedule->call(
fn () => resolve(DeleteExpiredShareLinksAction::class)() fn () => resolve(DeleteExpiredShareLinksAction::class)()
)->everyTenMinutes(); )->everyTenMinutes();

View File

@@ -0,0 +1,12 @@
<?php
namespace Support\Demo\Actions;
use DB;
class DeleteAllSharedLinksAction
{
public function __invoke()
{
DB::table('shares')->delete();
}
}