2 declare(strict_types = 1);
44 $cacheManager = $cacheManager ?? GeneralUtility::makeInstance(CacheManager::class);
45 $this->cache = $cacheManager->getCache(
'cache_pages');
55 $redirects = $this->cache->get(
'redirects');
56 if (!is_array($redirects)) {
69 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'sys_redirect');
70 $queryBuilder->getRestrictions()->removeAll()
71 ->add(GeneralUtility::makeInstance(HiddenRestriction::class))
72 ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
73 $statement = $queryBuilder
75 ->from(
'sys_redirect')
77 while ($row = $statement->fetch()) {
78 $host = $row[
'source_host'] ?:
'*';
79 if ($row[
'is_regexp']) {
80 $redirects[$host][
'regexp'][$row[
'source_path']][$row[
'uid']] = $row;
81 } elseif ($row[
'respect_query_parameters']) {
82 $redirects[$host][
'respect_query_parameters'][$row[
'source_path']][$row[
'uid']] = $row;
84 $redirects[$host][
'flat'][rtrim($row[
'source_path'],
'/') .
'/'][$row[
'uid']] = $row;
87 $this->cache->set(
'redirects', $redirects);