Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Refactor database cleanup command to include dry-run mode

Andras Bacsai6ef79f52138e
diff --git a/app/Console/Commands/CleanupDatabase.php b/app/Console/Commands/CleanupDatabase.php
index 60e6ea9015..110e49c491 100644
--- a/app/Console/Commands/CleanupDatabase.php
+++ b/app/Console/Commands/CleanupDatabase.php
@@ -12,9 +12,13 @@ class CleanupDatabase extends Command
public function handle()
{
- echo "Running database cleanup...\n";
+ if ($this->option('yes')) {
+ echo "Running database cleanup...\n";
+ } else {
+ echo "Running database cleanup in dry-run mode...\n";
+ }
$keep_days = 60;
-
+ echo "Keep days: $keep_days\n";
// Cleanup failed jobs table
$failed_jobs = DB::table('failed_jobs')->where('failed_at', '<', now()->subDays(7));
$count = $failed_jobs->count();