diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index a036c09a..9842067f 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -53,8 +53,14 @@ public function register(IRegistrationContext $context): void { /* Register our own user backend */ $this->backend = $this->getContainer()->get(Backend::class); - // see https://docs.nextcloud.com/server/latest/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_32.html#id3 - $userManager->registerBackend($this->backend); + + $config = $this->getContainer()->get(IConfig::class); + if (version_compare($config->getSystemValueString('version', '0.0.0'), '32.0.0', '>=')) { + // see https://docs.nextcloud.com/server/latest/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_32.html#id3 + $userManager->registerBackend($this->backend); + } else { + \OC_User::useBackend($this->backend); + } $context->registerEventListener(LoadAdditionalScriptsEvent::class, TimezoneHandlingListener::class); $context->registerEventListener(ExchangedTokenRequestedEvent::class, ExchangedTokenRequestedListener::class);