syncUserLogs: delegate to backfillUserLogs when user has no rows
Deploy website via FTP / Deploy (push) Skipped

This commit is contained in:
Keith Solomon
2026-08-10 20:07:59 -05:00
parent 6b7f37963c
commit bd120608d7
+12
View File
@@ -102,6 +102,18 @@ function syncUserLogs($user) {
$pdo = getDatabaseConnection();
$stmt = $pdo->prepare('SELECT COUNT(*) FROM vault WHERE user = :user');
$stmt->bindValue(':user', $user);
$stmt->execute();
$userRowCount = (int)$stmt->fetchColumn();
// If the user has zero rows (not the global dbNew, but per-user empty),
// delegate to backfillUserLogs which walks the full prev chain.
if ($userRowCount === 0) {
backfillUserLogs($user);
return;
}
$stmt = $pdo->prepare('SELECT MAX(timestamp) AS max_ts FROM vault WHERE user = :user');
$stmt->bindValue(':user', $user);
$stmt->execute();