diff --git a/plinth/modules/matrixsynapse/__init__.py b/plinth/modules/matrixsynapse/__init__.py index f9ebbcee6..9f0c05a6b 100644 --- a/plinth/modules/matrixsynapse/__init__.py +++ b/plinth/modules/matrixsynapse/__init__.py @@ -33,6 +33,7 @@ from plinth.daemon import Daemon from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall from plinth.modules.letsencrypt.components import LetsEncrypt +from plinth.utils import Version from .manifest import backup, clients # noqa, pylint: disable=unused-import @@ -141,6 +142,26 @@ def setup(helper, old_version=None): app.get_component('letsencrypt-matrixsynapse').setup_certificates() +def force_upgrade(helper, packages): + """Force upgrade matrix-synapse to resolve conffile prompt.""" + if 'matrix-synapse' not in packages: + return False + + # Allow any lower version to upgrade to 1.8.* + package = packages['matrix-synapse'] + if Version(package['new_version']) > Version('1.9~'): + return False + + public_registration_status = get_public_registration_status() + helper.install(['matrix-synapse'], force_configuration='new') + actions.superuser_run('matrixsynapse', ['post-install']) + if public_registration_status: + actions.superuser_run('matrixsynapse', + ['public-registration', 'enable']) + + return True + + def setup_domain(domain_name): """Configure a domain name for matrixsynapse.""" app.get_component('letsencrypt-matrixsynapse').setup_certificates(