summary refs log tree commit diff
path: root/synapse/config/spam_checker.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2021-06-22 12:24:10 +0200
committerGitHub <noreply@github.com>2021-06-22 12:24:10 +0200
commit34db6bb9f56de6db6283a1b74815315e9de051bf (patch)
treed0936c2346c2ade90ca8ad4ee5e59d0c54591695 /synapse/config/spam_checker.py
parentAdd endpoints for backfilling history (MSC2716) (#9247) (diff)
downloadsynapse-34db6bb9f56de6db6283a1b74815315e9de051bf.tar.xz
Warn users trying to use the deprecated spam checker interface (#10210)
So admins aren't surprised if things break when we remove this code in a couple of months.
Diffstat (limited to 'synapse/config/spam_checker.py')
-rw-r--r--synapse/config/spam_checker.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/config/spam_checker.py b/synapse/config/spam_checker.py
index c24165eb8a..d0311d6468 100644
--- a/synapse/config/spam_checker.py
+++ b/synapse/config/spam_checker.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import logging
 from typing import Any, Dict, List, Tuple
 
 from synapse.config import ConfigError
@@ -19,6 +20,15 @@ from synapse.util.module_loader import load_module
 
 from ._base import Config
 
+logger = logging.getLogger(__name__)
+
+LEGACY_SPAM_CHECKER_WARNING = """
+This server is using a spam checker module that is implementing the deprecated spam
+checker interface. Please check with the module's maintainer to see if a new version
+supporting Synapse's generic modules system is available.
+For more information, please see https://matrix-org.github.io/synapse/develop/modules.html
+---------------------------------------------------------------------------------------"""
+
 
 class SpamCheckerConfig(Config):
     section = "spamchecker"
@@ -42,3 +52,8 @@ class SpamCheckerConfig(Config):
                 self.spam_checkers.append(load_module(spam_checker, config_path))
         else:
             raise ConfigError("spam_checker syntax is incorrect")
+
+        # If this configuration is being used in any way, warn the admin that it is going
+        # away soon.
+        if self.spam_checkers:
+            logger.warning(LEGACY_SPAM_CHECKER_WARNING)