aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Route
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Route')
-rw-r--r--lib/private/Route/CachingRouter.php2
-rw-r--r--lib/private/Route/Router.php14
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php
index dbd5ef02603..becdb807f73 100644
--- a/lib/private/Route/CachingRouter.php
+++ b/lib/private/Route/CachingRouter.php
@@ -80,7 +80,7 @@ class CachingRouter extends Router {
if (!$cachedRoutes) {
parent::loadRoutes();
$cachedRoutes = $this->serializeRouteCollection($this->root);
- $this->cache->set($key, $cachedRoutes, 3600);
+ $this->cache->set($key, $cachedRoutes, ($this->config->getSystemValueBool('debug') ? 3 : 3600));
}
$matcher = new CompiledUrlMatcher($cachedRoutes, $this->context);
$this->eventLogger->start('cacheroute:url:match', 'Symfony URL match call');
diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php
index 02f371e808a..90225212e9a 100644
--- a/lib/private/Route/Router.php
+++ b/lib/private/Route/Router.php
@@ -53,7 +53,7 @@ class Router implements IRouter {
public function __construct(
protected LoggerInterface $logger,
IRequest $request,
- private IConfig $config,
+ protected IConfig $config,
protected IEventLogger $eventLogger,
private ContainerInterface $container,
protected IAppManager $appManager,
@@ -74,6 +74,14 @@ class Router implements IRouter {
$this->root = $this->getCollection('root');
}
+ public function setContext(RequestContext $context): void {
+ $this->context = $context;
+ }
+
+ public function getRouteCollection() {
+ return $this->root;
+ }
+
/**
* Get the files to load the routes from
*
@@ -102,7 +110,7 @@ class Router implements IRouter {
*
* @param null|string $app
*/
- public function loadRoutes($app = null) {
+ public function loadRoutes(?string $app = null, bool $skipLoadingCore = false): void {
if (is_string($app)) {
$app = $this->appManager->cleanAppId($app);
}
@@ -165,7 +173,7 @@ class Router implements IRouter {
}
$this->eventLogger->end('route:load:files');
- if (!isset($this->loadedApps['core'])) {
+ if (!$skipLoadingCore && !isset($this->loadedApps['core'])) {
$this->loadedApps['core'] = true;
$this->useCollection('root');
$this->setupRoutes($this->getAttributeRoutes('core'), 'core');