mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Server+Client] Tombstone deck deletes with purge and base snapshots
This commit is contained in:
parent
2916fa45af
commit
e43862c3bc
8 changed files with 180 additions and 21 deletions
|
|
@ -1370,8 +1370,8 @@ DeckList *Servatrice_DatabaseInterface::getDeckFromDatabase(int deckId, int user
|
|||
{
|
||||
checkSql();
|
||||
|
||||
QSqlQuery *query =
|
||||
prepareQuery("select content from {prefix}_decklist_files where id = :id and id_user = :id_user");
|
||||
QSqlQuery *query = prepareQuery(
|
||||
"select content from {prefix}_decklist_files where id = :id and id_user = :id_user and deleted = 0");
|
||||
query->bindValue(":id", deckId);
|
||||
query->bindValue(":id_user", userId);
|
||||
execSqlQuery(query);
|
||||
|
|
@ -1522,6 +1522,19 @@ void Servatrice_DatabaseInterface::cleanupExpiredDeckShares()
|
|||
execSqlQuery(query);
|
||||
}
|
||||
|
||||
void Servatrice_DatabaseInterface::purgeDeckTombstones(int olderThanDays)
|
||||
{
|
||||
checkSql();
|
||||
|
||||
// DB-native clock: tombstones are stamped with NOW() on this same
|
||||
// database, so the grace window is immune to app/db clock skew.
|
||||
// The null arm only catches manually flagged rows.
|
||||
QSqlQuery *query = prepareQuery("delete from {prefix}_decklist_files where deleted = 1 and (last_modified < "
|
||||
"DATE_SUB(NOW(), INTERVAL :days DAY) or last_modified is null)");
|
||||
query->bindValue(":days", qMax(0, olderThanDays));
|
||||
execSqlQuery(query);
|
||||
}
|
||||
|
||||
bool Servatrice_DatabaseInterface::getDeckSharesForUser(int userId, QList<DeckShareSummaryRecord> &shares)
|
||||
{
|
||||
checkSql();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue