From 5a6a772712782009626e281d534ee2cf8267d85c Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Fri, 18 Jun 2021 16:20:17 +0100 Subject: [PATCH] Warn users trying to use the deprecated spam checker interface --- changelog.d/10210.removal | 1 + synapse/config/spam_checker.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 changelog.d/10210.removal diff --git a/changelog.d/10210.removal b/changelog.d/10210.removal new file mode 100644 index 000000000000..5fb7bfb47e7e --- /dev/null +++ b/changelog.d/10210.removal @@ -0,0 +1 @@ +The current spam checker interface is deprecated in favour of a new generic modules system. See the [upgrade notes](https://github.com/matrix-org/synapse/blob/master/UPGRADE.rst#deprecation-of-the-current-spam-checker-interface) for more information on how to update to the new system. diff --git a/synapse/config/spam_checker.py b/synapse/config/spam_checker.py index c24165eb8a88..d0311d6468d5 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 ._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 @@ def read_config(self, config, **kwargs): 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)