summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorDirk Klimpel <5740567+dklimpel@users.noreply.github.com>2023-02-23 19:14:17 +0100
committerGitHub <noreply@github.com>2023-02-23 13:14:17 -0500
commita068ad7dd4910c81bb0886fbf986dde126eeb4ee (patch)
tree41bfbb4f3f4048cdd4cc774b54d50e96143535dd /synapse/app
parentDocumentation using Shibboleth with OIDC Plugin for SSO. (#15112) (diff)
downloadsynapse-a068ad7dd4910c81bb0886fbf986dde126eeb4ee.tar.xz
Add information on uploaded media to user export command. (#15107)
Diffstat (limited to 'synapse/app')
-rw-r--r--synapse/app/admin_cmd.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/app/admin_cmd.py b/synapse/app/admin_cmd.py
index 5003777f0d..b05fe2c589 100644
--- a/synapse/app/admin_cmd.py
+++ b/synapse/app/admin_cmd.py
@@ -44,6 +44,7 @@ from synapse.storage.databases.main.event_push_actions import (
 )
 from synapse.storage.databases.main.events_worker import EventsWorkerStore
 from synapse.storage.databases.main.filtering import FilteringWorkerStore
+from synapse.storage.databases.main.media_repository import MediaRepositoryStore
 from synapse.storage.databases.main.profile import ProfileWorkerStore
 from synapse.storage.databases.main.push_rule import PushRulesWorkerStore
 from synapse.storage.databases.main.receipts import ReceiptsWorkerStore
@@ -86,6 +87,7 @@ class AdminCmdSlavedStore(
     RegistrationWorkerStore,
     RoomWorkerStore,
     ProfileWorkerStore,
+    MediaRepositoryStore,
 ):
     def __init__(
         self,
@@ -235,6 +237,14 @@ class FileExfiltrationWriter(ExfiltrationWriter):
         with open(account_data_file, "a") as f:
             json.dump(account_data, fp=f)
 
+    def write_media_id(self, media_id: str, media_metadata: JsonDict) -> None:
+        file_directory = os.path.join(self.base_directory, "media_ids")
+        os.makedirs(file_directory, exist_ok=True)
+        media_id_file = os.path.join(file_directory, media_id)
+
+        with open(media_id_file, "w") as f:
+            json.dump(media_metadata, fp=f)
+
     def finished(self) -> str:
         return self.base_directory