Use laravel task scheduler

This commit is contained in:
2026-05-26 15:17:57 +02:00
parent 5dc1bff60c
commit 81639aaabf
3 changed files with 15 additions and 6 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ class GenerateSitemap extends Command
*
* @var string
*/
protected $signature = 'sitemap:generate';
protected $signature = 'app:generate-sitemap';
/**
* The console command description.
@@ -8,6 +8,7 @@ use Illuminate\Console\Command;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Http;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Facades\Log;
class SyncSubscriptionKeys extends Command
{
@@ -83,8 +84,11 @@ class SyncSubscriptionKeys extends Command
->whereNotIn('subscription_key', $activeKeys)
->chunk(100, function ($users) {
foreach($users as $user) {
if ($user->hasRole(UserRole::SUPPORTER)) {
Log::info("Removed Supporter Role from {$user->name}");
$user->removeRole(UserRole::SUPPORTER);
}
}
});
}
@@ -95,8 +99,11 @@ class SyncSubscriptionKeys extends Command
->whereIn('subscription_key', $activeKeys)
->chunk(100, function ($users) {
foreach($users as $user) {
if (!$user->hasRole(UserRole::SUPPORTER)) {
Log::info("Added Supporter Role for {$user->name}");
$user->addRole(UserRole::SUPPORTER);
}
}
});
}
}
+5 -3
View File
@@ -2,6 +2,7 @@
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
/*
|--------------------------------------------------------------------------
@@ -14,6 +15,7 @@ use Illuminate\Support\Facades\Artisan;
|
*/
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
Schedule::command('app:auto-stats')->hourly();
Schedule::command('app:reset-user-downloads')->daily();
Schedule::command('app:generate-sitemap')->daily();
Schedule::command('app:sync-subscription-keys')->daily();