syncUserLogs: delegate to backfillUserLogs when user has no rows
Deploy website via FTP / Deploy (push) Skipped
Deploy website via FTP / Deploy (push) Skipped
This commit is contained in:
@@ -102,6 +102,18 @@ function syncUserLogs($user) {
|
|||||||
|
|
||||||
$pdo = getDatabaseConnection();
|
$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 = $pdo->prepare('SELECT MAX(timestamp) AS max_ts FROM vault WHERE user = :user');
|
||||||
$stmt->bindValue(':user', $user);
|
$stmt->bindValue(':user', $user);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|||||||
Reference in New Issue
Block a user