mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-09 13:02:04 +00:00
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.
This commit is contained in:
parent
96f6293de5
commit
34db6bb9f5
1
changelog.d/10210.removal
Normal file
1
changelog.d/10210.removal
Normal file
@ -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.
|
@ -12,6 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import logging
|
||||||
from typing import Any, Dict, List, Tuple
|
from typing import Any, Dict, List, Tuple
|
||||||
|
|
||||||
from synapse.config import ConfigError
|
from synapse.config import ConfigError
|
||||||
@ -19,6 +20,15 @@ from synapse.util.module_loader import load_module
|
|||||||
|
|
||||||
from ._base import Config
|
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):
|
class SpamCheckerConfig(Config):
|
||||||
section = "spamchecker"
|
section = "spamchecker"
|
||||||
@ -42,3 +52,8 @@ class SpamCheckerConfig(Config):
|
|||||||
self.spam_checkers.append(load_module(spam_checker, config_path))
|
self.spam_checkers.append(load_module(spam_checker, config_path))
|
||||||
else:
|
else:
|
||||||
raise ConfigError("spam_checker syntax is incorrect")
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user