Commit graph

24 commits

Author SHA1 Message Date
Daniel Calviño Sánchez
51ed61bb4a fix: Fix caching routes by users with an active session
When a user has an active session only the apps that are enabled for the
user are initially loaded. In order to cache the routes the routes for
all apps are loaded, but routes defined in routes.php are taken into
account only if the app was already loaded. Therefore, when the routes
were cached in a request by a user with an active session only the
routes for apps enabled for that user were cached, and those routes were
used by any other user, independently of which apps they had access to.
To solve that now all the enabled apps are explicitly loaded before
caching the routes.

Note that this did not affect routes defined using annotations on the
controller files; in that case the loaded routes do not depend on the
previously loaded apps, as it explicitly checks all the enabled apps.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-12-12 16:10:20 +01:00
Daniel Calviño Sánchez
0ba2f5e537 Revert "fix(CachingRouter): Disable cache for findMatchingRoute"
This reverts commit 90948f5096.

It temporary disabled cache for routes until an actual fix was added,
which is done in the following commits.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-12-12 16:06:47 +01:00
provokateurin
90948f5096
fix(CachingRouter): Disable cache for findMatchingRoute
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-12-09 09:16:01 +01:00
Côme Chilliet
b188fad8e8
fix(router): In debug mode, cache routes only for 3 seconds
This allows testing a newly added or changed route in your application
 without having to wait 1 hour or bump the application version.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-12 16:12:22 +02:00
Côme Chilliet
0d78c60759
fix: Fix psalm issue by adding missing parameter for profiler
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:54 +02:00
Côme Chilliet
446b22ac3c
feat(router): Add fallback for legacy action and file routes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:54 +02:00
Côme Chilliet
5c9092bc5b
fix: Use a more fitting cache key
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:53 +02:00
Côme Chilliet
01575b7d95
feat(router): Use Symfony CompiledUrlMatcherDumper to cache routes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:53 +02:00
Côme Chilliet
ee3abdd81b
feat(router): Cache routes in local cache if possible
This is not ideal because serializing the routecollection is not easy.
It seems Symfony has its own way of doing things by dumping routes to a
 PHP file, maybe that would be better, but it would mean pulling a new
 symfony dependency and maybe refactor our Router.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-05 17:58:46 +02:00
Andy Scherzinger
dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +02:00
Côme Chilliet
733a818139
fix: Migrate a few more classes away from OC_App::getAppPath
Also fixed AppTest

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-22 12:19:01 +02:00
Robin Appelman
b911da3e1e
DI for Router
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-02-13 22:51:14 +01:00
Côme Chilliet
6be7aa112f
Migrate from ILogger to LoggerInterface in lib/private
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 16:21:25 +01:00
John Molakvoæ (skjnldsv)
215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +02:00
Christoph Wurst
1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +02:00
Christoph Wurst
b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +01:00
Christoph Wurst
5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Robin Appelman
219905b9c8
Dont cache empty url for not found routes
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-10-18 18:20:25 +02:00
Morris Jobke
c1e4f9f305
Use type casting instead of *val() method
It should be up to 6x faster

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 11:35:42 +01:00
Joas Schilling
0215b004da
Update with robin 2016-07-21 18:13:58 +02:00
Joas Schilling
ba87db3fcc
Fix others 2016-07-21 18:13:57 +02:00
Lukas Reschke
aba539703c
Update license headers 2016-05-26 19:57:24 +02:00
Lukas Reschke
f81b57bc45
Read only once
This can lead to race conditions otherwise. Also depracted hasKey
2016-05-02 11:31:57 +02:00
Roeland Jago Douma
bb1e2f9d9d
Move \OC\Route to PSR-4 2016-04-25 21:49:07 +02:00
Renamed from lib/private/route/cachingrouter.php (Browse further)