From 2a30d64f083370ee438b6ad3ddfc0be264907f6c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 19 Sep 2024 21:39:56 -0700 Subject: [PATCH] nextcloud: Fix existing installs to upgrade properly Fixes: #2433. Tests: - Without the patches, as described in the bug, create an installation that is facing the problem. Ensure that 'podman exec --user www-data nextcloud-freedombox /var/www/html/occ config:system:get overwrite.cli.url' shows an empty value. - Apply patches, nextcloud app is updated and configuration value is set to 'http://localhost/nextlcoud' by running 'podman exec --user www-data nextcloud-freedombox /var/www/html/occ config:system:get overwrite.cli.url'. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/nextcloud/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plinth/modules/nextcloud/__init__.py b/plinth/modules/nextcloud/__init__.py index 67f501770..3a3f8920f 100644 --- a/plinth/modules/nextcloud/__init__.py +++ b/plinth/modules/nextcloud/__init__.py @@ -46,7 +46,7 @@ class NextcloudApp(app_module.App): app_id = 'nextcloud' - _version = 1 + _version = 2 configure_when_disabled = False @@ -128,6 +128,13 @@ class NextcloudApp(app_module.App): def setup(self, old_version): """Install and configure the app.""" + if old_version == 1: + with _ensure_nextcloud_running(): + # Reset the value so that 'overwrite.cli.url' is set to default + # value instead of it being missing. + if not privileged.get_override_domain(): + privileged.set_override_domain('') + super().setup(old_version) # Drop-in configs need to be enabled for setup to succeed self.get_component('dropin-configs-nextcloud').enable()