summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
36b7cf4)
The entity of SiteLanguage is re-connected to a
site. However this circular dependency makes it impossible
to serialize or compile any of the site configuration.
As this was introduced at the very early stage of
Site Handling where the API wasn't clear, this can
be removed, as "site" and "language" are both
always available in a PSR-7 request.
Resolves: #85841
Releases: master
Change-Id: Id061def7b0299b9c355ae83e1903cf64b6127149
Reviewed-on: https://review.typo3.org/57893
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
$base = $this->sanitizeBaseUrl(rtrim($this->base, '/') . '/');
}
$this->languages[$languageUid] = new SiteLanguage(
$base = $this->sanitizeBaseUrl(rtrim($this->base, '/') . '/');
}
$this->languages[$languageUid] = new SiteLanguage(
$languageUid,
$languageConfiguration['locale'],
$base,
$languageUid,
$languageConfiguration['locale'],
$base,
- /**
- * @var SiteInterface
- */
- protected $site;
-
/**
* The language mapped to the sys_language DB entry.
*
/**
* The language mapped to the sys_language DB entry.
*
/**
* SiteLanguage constructor.
/**
* SiteLanguage constructor.
- * @param SiteInterface $site
* @param int $languageId
* @param string $locale
* @param string $base
* @param array $attributes
*/
* @param int $languageId
* @param string $locale
* @param string $base
* @param array $attributes
*/
- public function __construct(SiteInterface $site, int $languageId, string $locale, string $base, array $attributes)
+ public function __construct(int $languageId, string $locale, string $base, array $attributes)
$this->languageId = $languageId;
$this->locale = $locale;
$this->base = $base;
$this->languageId = $languageId;
$this->locale = $locale;
$this->base = $base;
- /**
- * @return SiteInterface
- */
- public function getSite(): SiteInterface
- {
- return $this->site;
- }
-
use TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\UserAspect;
use TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\UserAspect;
+use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
- $siteLanguage = $this->getCurrentSiteLanguage();
- if ($siteLanguage instanceof SiteLanguage) {
- $site = $siteLanguage->getSite();
+ $site = $this->getCurrentSite();
+ if ($site instanceof Site) {
$values = GeneralUtility::trimExplode(',', $value, true);
foreach ($values as $test) {
$point = strcspn($test, '=');
$values = GeneralUtility::trimExplode(',', $value, true);
foreach ($values as $test) {
$point = strcspn($test, '=');
+
+ /**
+ * Returns the currently configured site if a site is configured (= resolved) in the current request.
+ *
+ * @internal
+ */
+ protected function getCurrentSite(): ?Site
+ {
+ if ($GLOBALS['TYPO3_REQUEST'] instanceof ServerRequestInterface
+ && $GLOBALS['TYPO3_REQUEST']->getAttribute('site') instanceof Site) {
+ return $GLOBALS['TYPO3_REQUEST']->getAttribute('site');
+ }
+ return null;
+ }
{
$site = new Site('angelo', 13, ['languages' => [], 'base' => 'https://typo3.org/']);
$GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
{
$site = new Site('angelo', 13, ['languages' => [], 'base' => 'https://typo3.org/']);
$GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
- $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('language', $site->getLanguageById(0));
+ $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('site', $site);
$subject = new ConditionMatcher(new Context());
$this->assertTrue($subject->match('[site = identifier = angelo]'));
$this->assertTrue($subject->match('[site = rootPageId = 13]'));
$subject = new ConditionMatcher(new Context());
$this->assertTrue($subject->match('[site = identifier = angelo]'));
$this->assertTrue($subject->match('[site = rootPageId = 13]'));
]
]);
$GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
]
]);
$GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
- $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('language', $site->getLanguageById(0));
+ $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('site', $site);
$subject = new ConditionMatcher(new Context());
$this->assertFalse($subject->match('[site = identifier = berta]'));
$this->assertFalse($subject->match('[site = rootPageId = 14, rootPageId=23]'));
$subject = new ConditionMatcher(new Context());
$this->assertFalse($subject->match('[site = identifier = berta]'));
$this->assertFalse($subject->match('[site = rootPageId = 14, rootPageId=23]'));