Skip to content
Snippets Groups Projects
Commit 43cda8c4 authored by Andreas Kienast's avatar Andreas Kienast Committed by Christian Kuhn
Browse files

[BUGFIX] Let RedirectCacheService not rely on having redirects cached

RedirectCacheService::getRedirects() relies on having the redirects
cached. This assumption may lead to issues (e.g. in case a Redis server
fails), causing TypeErrors.

The code is changed to return the composed array in case the initial
cache request misses.

Resolves: #84070
Releases: master
Change-Id: I148db9ccbf28a2f93761fbf4b2cb632e27787b2d
Reviewed-on: https://review.typo3.org/56050


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarBenjamin Franzke <bfr@qbus.de>
Tested-by: default avatarBenjamin Franzke <bfr@qbus.de>
Reviewed-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 7fb4977b
No related branches found
No related tags found
No related merge requests found
......@@ -54,8 +54,7 @@ class RedirectCacheService
{
$redirects = $this->cache->get('redirects');
if (!is_array($redirects)) {
$this->rebuild();
$redirects = $this->cache->get('redirects');
$redirects = $this->rebuild();
}
return $redirects;
}
......@@ -64,7 +63,7 @@ class RedirectCacheService
* Rebuilds the cache for all redirects, grouped by host and by regular expressions.
* Does not include deleted redirects, but includes the ones with dynamic starttime/endtime.
*/
public function rebuild()
public function rebuild(): array
{
$redirects = [];
$this->flush();
......@@ -85,6 +84,7 @@ class RedirectCacheService
}
}
$this->cache->set('redirects', $redirects, ['redirects']);
return $redirects;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment