Impment webcron and internal scheduling methods and change settings to a key value store

This commit is contained in:
2025-12-03 14:23:03 +01:00
parent e37a14993d
commit 53acdb40b7
12 changed files with 222 additions and 90 deletions
+12 -5
View File
@@ -3,20 +3,27 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Cache;
use App\Services\CaldavService;
use App\Models\Todo;
use App\Models\TodoType;
use Sabre\VObject\Component\VCalendar;
use Illuminate\Support\Facades\Log;
class CaldavSyncCommand extends Command
{
protected $signature = 'caldav:sync {--calendar= : optional calendar path}';
protected $signature = 'caldav:sync';
protected $description = 'Sync CalDAV VTODOs into local todos table';
public function handle(CaldavService $service)
{
$this->info('Starting CalDAV sync...');
// only run every 5 minutes although the task is called every minute
$cacheKey = 'caldav_sync_last_run';
if (\Illuminate\Support\Facades\Cache::has($cacheKey)) {
return 0;
}
Cache::put($cacheKey, true, 300);
Log::info('Running CalDAV sync');
$this->info('Starting CalDAV sync');
$todos = $service->getTodos();