diff --git a/lib/UserBackend.php b/lib/UserBackend.php index baa1ef5e7..7c49734bc 100644 --- a/lib/UserBackend.php +++ b/lib/UserBackend.php @@ -120,6 +120,16 @@ public function createUserIfNotExists(string $uid, array $attributes = []): void * @throws \OCP\Files\NotFoundException */ public function initializeHomeDir(string $uid): void { + $user = $this->userManager->get($uid); + if ($user === null) { + throw new \LogicException('Trying to initialize home dir for a non-existent user'); + } + + if (version_compare($this->config->getSystemValueString('version', '0.0.0'), '34.0.0', '>=')) { + $this->eventDispatcher->dispatchTyped(new UserFirstTimeLoggedInEvent($user)); + return; + } + ### Code taken from lib/private/User/Session.php - function prepareUserLogin() ### //trigger creation of user home and /files folder $userFolder = Server::get(IRootFolder::class)->getUserFolder($uid); @@ -130,10 +140,6 @@ public function initializeHomeDir(string $uid): void { // read only uses } // trigger any other initialization - $user = $this->userManager->get($uid); - if ($user === null) { - throw new \LogicException('Trying to initialize home dir for a non-existent user'); - } $this->eventDispatcher->dispatchTyped(new UserFirstTimeLoggedInEvent($user)); }