summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-04-28 10:39:31 +0100
committerMark Haines <mjark@negativecurvature.net>2015-04-28 10:39:31 +0100
commit252e6f68699718f466ddb4a1bfe2d61436fb8502 (patch)
tree9bb89c6d737a9b4a89ebb829e151b8f0881168bb /synapse/storage
parentOutput vim style mode markers into the yaml config file (diff)
parentpep8 (diff)
downloadsynapse-252e6f68699718f466ddb4a1bfe2d61436fb8502.tar.xz
Merge pull request #130 from matrix-org/server_rename_check
Fix for SYN-266
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index f4dec70393..9b6471aec2 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -421,3 +421,13 @@ def prepare_sqlite3_database(db_conn):
                     " VALUES (?,?)",
                     (row[0], False)
                 )
+
+
+def are_all_users_on_domain(txn, domain):
+    sql = "SELECT COUNT(*) FROM users WHERE name NOT LIKE ?"
+    pat = "%:" + domain
+    cursor = txn.execute(sql, (pat,))
+    num_not_matching = cursor.fetchall()[0][0]
+    if num_not_matching == 0:
+        return True
+    return False