first commit

This commit is contained in:
2026-02-15 11:37:27 +01:00
commit 884ee9cc88
299 changed files with 41102 additions and 0 deletions

33
src/Models/Site.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use App\Core\Model;
class Site extends Model
{
protected static string $table = 'sites';
public static function findActive(): array
{
return self::where('is_active = 1', [], 'last_published_at ASC');
}
public static function findDueForPublishing(): array
{
$sql = "SELECT * FROM sites
WHERE is_active = 1
AND (
last_published_at IS NULL
OR DATE_ADD(last_published_at, INTERVAL publish_interval_days DAY) <= NOW()
)
ORDER BY last_published_at ASC";
$stmt = self::db()->query($sql);
return $stmt->fetchAll();
}
public static function updateLastPublished(int $id): void
{
self::update($id, ['last_published_at' => date('Y-m-d H:i:s')]);
}
}