1
0

instances added god may help

This commit is contained in:
2026-02-23 12:58:19 +01:00
parent 25370a1a55
commit 99db252f60
290 changed files with 9858 additions and 4914 deletions

View File

@@ -7,7 +7,7 @@ use MintyPHP\Repository\Support\RepoQuery;
class ScheduledJobRepository
{
public static function create(array $data): int|false
public function create(array $data): int|false
{
$id = DB::insert(
'insert into scheduled_jobs (
@@ -30,26 +30,26 @@ class ScheduledJobRepository
return $id ? (int) $id : false;
}
public static function find(int $id): ?array
public function find(int $id): ?array
{
if ($id <= 0) {
return null;
}
$row = DB::selectOne('select * from scheduled_jobs where id = ? limit 1', (string) $id);
return self::normalizeRow($row);
return $this->normalizeRow($row);
}
public static function findByKey(string $jobKey): ?array
public function findByKey(string $jobKey): ?array
{
$jobKey = trim($jobKey);
if ($jobKey === '') {
return null;
}
$row = DB::selectOne('select * from scheduled_jobs where job_key = ? limit 1', $jobKey);
return self::normalizeRow($row);
return $this->normalizeRow($row);
}
public static function listPaged(array $filters): array
public function listPaged(array $filters): array
{
$search = trim((string) ($filters['search'] ?? ''));
$enabled = trim((string) ($filters['enabled'] ?? ''));
@@ -92,7 +92,7 @@ class ScheduledJobRepository
$normalized = [];
if (is_array($rows)) {
foreach ($rows as $row) {
$item = self::normalizeRow($row);
$item = $this->normalizeRow($row);
if ($item !== null) {
$normalized[] = $item;
}
@@ -105,7 +105,7 @@ class ScheduledJobRepository
];
}
public static function listDueJobs(string $nowUtc, int $limit = 20): array
public function listDueJobs(string $nowUtc, int $limit = 20): array
{
$limit = max(1, min(200, $limit));
$rows = DB::select(
@@ -122,7 +122,7 @@ class ScheduledJobRepository
$normalized = [];
if (is_array($rows)) {
foreach ($rows as $row) {
$item = self::normalizeRow($row);
$item = $this->normalizeRow($row);
if ($item !== null) {
$normalized[] = $item;
}
@@ -131,7 +131,7 @@ class ScheduledJobRepository
return $normalized;
}
public static function updateJobMeta(int $id, array $data): bool
public function updateJobMeta(int $id, array $data): bool
{
if ($id <= 0) {
return false;
@@ -176,7 +176,7 @@ class ScheduledJobRepository
* Returns true only when the UPDATE affected a row, i.e. the job was successfully
* claimed by this runner. Returns false if the job is already running (not stale).
*/
public static function markRunning(int $id, string $startedAtUtc): bool
public function markRunning(int $id, string $startedAtUtc): bool
{
if ($id <= 0) {
return false;
@@ -206,7 +206,7 @@ class ScheduledJobRepository
return (int) $updated > 0;
}
public static function finishRun(
public function finishRun(
int $id,
string $status,
string $startedAtUtc,
@@ -238,7 +238,7 @@ class ScheduledJobRepository
return $updated !== false;
}
private static function normalizeRow(mixed $row): ?array
private function normalizeRow(mixed $row): ?array
{
if (!is_array($row)) {
return null;