From c51f5b9592a8f7e44c132e7e63b96f0af34dfef3 Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Tue, 7 Jun 2022 12:28:08 +0100 Subject: [PATCH] Prevent breaking old sqlite's when media retention is enabled (#12977) --- changelog.d/12977.feature | 1 + synapse/storage/databases/main/media_repository.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/12977.feature diff --git a/changelog.d/12977.feature b/changelog.d/12977.feature new file mode 100644 index 000000000..3c73363d2 --- /dev/null +++ b/changelog.d/12977.feature @@ -0,0 +1 @@ +Add new `media_retention` options to the homeserver config for routinely cleaning up non-recently accessed media. \ No newline at end of file diff --git a/synapse/storage/databases/main/media_repository.py b/synapse/storage/databases/main/media_repository.py index 3c585c555..d028be16d 100644 --- a/synapse/storage/databases/main/media_repository.py +++ b/synapse/storage/databases/main/media_repository.py @@ -327,7 +327,7 @@ class MediaRepositoryStore(MediaRepositoryBackgroundUpdateStore): if include_protected_media is False: # Do not include media that has been protected from quarantine sql += """ - AND safe_from_quarantine = false + AND NOT safe_from_quarantine """ def _get_local_media_ids_txn(txn: LoggingTransaction) -> List[str]: