Skip to content

Add Baikal compatible DAV route and optimize data fetching#256

Open
lukastrkan wants to merge 4 commits intotchapi:mainfrom
lukastrkan:merge/fix-dashboard-memory-leak
Open

Add Baikal compatible DAV route and optimize data fetching#256
lukastrkan wants to merge 4 commits intotchapi:mainfrom
lukastrkan:merge/fix-dashboard-memory-leak

Conversation

@lukastrkan
Copy link
Copy Markdown

Improvements made during the migration from Baikal to Davis:

  • Baikal-compatible route: Added route so existing clients don't need any config changes.
  • Fix out-of-memory on dashboard: Replaced findAll() with count()

});
}

#[Route('/dav.php/{path?}', name: 'dav-old', requirements: ['path' => '.*'])]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's:

  • name this dav-legacy so that it's consistent with the method name
  • add a comment that explains why it exists (reference to Baikal migration)

#[Route('/dav.php/{path?}', name: 'dav-old', requirements: ['path' => '.*'])]
public function davLegacy(Request $request, ?string $path): Response
{
return $this->redirect($this->generateUrl('dav', ['path' => $path ?? '']).$this->buildQueryString($request), 301);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you pass to the generateUrl() method some parameters that are not part of the route definition, they are included in the generated URL as a query string.

So $this->generateUrl('dav', ['path' => $path ?? '', ...$request->query->all()]), should work (no need for a private function)

return $this->redirect($this->generateUrl('dav', ['path' => $path ?? '']).$this->buildQueryString($request), 301);
}

private function buildQueryString(Request $request): string
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uneeded (see above)

Comment on lines -29 to +33
'users' => $users,
'calendars' => $calendars,
'addressbooks' => $addressbooks,
'events' => $events,
'contacts' => $contacts,
'users' => $usersCount,
'calendars' => $calendarsCount,
'addressbooks' => $addressbooksCount,
'events' => $eventsCount,
'contacts' => $contactsCount,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename the parameters too so they are explicit

@tchapi tchapi self-assigned this Apr 18, 2026
@tchapi tchapi added the enhancement New feature or request label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants