Files
breadcrumb-the-shire/lib/Repository/Scheduler/ScheduledJobRepositoryInterface.php
fs 312d43d9d9 feat(scheduler): delete orphaned jobs and block editing of unregistered jobs
Adds deleteOrphanedJobs() to clean up stale job_keys during ensureSystemJobs, and prevents editing jobs that are no longer registered in the runtime registry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 14:13:09 +02:00

35 lines
998 B
PHP

<?php
namespace MintyPHP\Repository\Scheduler;
/** Contract for scheduled job CRUD, due-job queries, and run status tracking. */
interface ScheduledJobRepositoryInterface
{
public function create(array $data): int|false;
public function find(int $id): ?array;
public function findByKey(string $jobKey): ?array;
public function listPaged(array $filters): array;
public function listDueJobs(string $nowUtc, int $limit = 20): array;
public function updateJobMeta(int $id, array $data): bool;
public function markRunning(int $id, string $startedAtUtc): bool;
public function finishRun(
int $id,
string $status,
string $startedAtUtc,
string $finishedAtUtc,
?string $nextRunAtUtc,
?string $errorCode,
?string $errorMessage
): bool;
/** Delete jobs whose job_key is not in the given list of valid keys. Returns affected row count. */
public function deleteOrphanedJobs(array $validKeys): int;
}