Impment webcron and internal scheduling methods and change settings to a key value store
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user