‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Configuration\SiteConfiguration Class Reference
Inheritance diagram for TYPO3\CMS\Core\Configuration\SiteConfiguration:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (#[Autowire('%env(TYPO3:configPath)%/sites')] protected string $configPath, protected SiteSettingsFactory $siteSettingsFactory, protected EventDispatcherInterface $eventDispatcher, #[Autowire(service:'cache.core')] protected PhpFrontend $cache)
 
Site[] getAllExistingSites (bool $useCache=true)
 
Site[] resolveAllExistingSites (bool $useCache=true)
 
Site[] resolveAllExistingSitesRaw ()
 
 getAllSiteConfigurationPaths ()
 
 load (string $siteIdentifier)
 
 siteConfigurationChanged ()
 
 warmupCaches (CacheWarmupEvent $event)
 

Protected Member Functions

 getAllSiteConfigurationFromFiles (bool $useCache=true)
 
 getSiteTypoScript (string $siteIdentifier)
 
 getSiteTSconfig (string $siteIdentifier)
 
 getContentSecurityPolicies (string $siteIdentifier)
 

Protected Attributes

string $configFileName = 'config.yaml'
 
string $typoScriptSetupFileName = 'setup.typoscript'
 
string $typoScriptConstantsFileName = 'constants.typoscript'
 
string $pageTSconfigFileName = 'page.tsconfig'
 
string $contentSecurityFileName = 'csp.yaml'
 
string $cacheIdentifier = 'sites-configuration'
 
array null $firstLevelCache
 

Detailed Description

Responsibility: Handles the format of the configuration (currently yaml), and the location of the file system folder

Reads all available site configuration options, and puts them into Site objects.

Definition at line 46 of file SiteConfiguration.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Configuration\SiteConfiguration::__construct ( # protected string  $configPath[Autowire('%env(TYPO3:configPath)%/sites')],
protected SiteSettingsFactory  $siteSettingsFactory,
protected EventDispatcherInterface  $eventDispatcher,
# protected PhpFrontend  $cache[Autowire(service:'cache.core')] 
)

Definition at line 97 of file SiteConfiguration.php.

Member Function Documentation

◆ getAllExistingSites()

Site [] TYPO3\CMS\Core\Configuration\SiteConfiguration::getAllExistingSites ( bool  $useCache = true)

Return all site objects which have been found in the filesystem.

Returns
Site[]

Definition at line 111 of file SiteConfiguration.php.

References TYPO3\CMS\Core\Configuration\SiteConfiguration\$firstLevelCache, and TYPO3\CMS\Core\Configuration\SiteConfiguration\resolveAllExistingSites().

◆ getAllSiteConfigurationFromFiles()

TYPO3\CMS\Core\Configuration\SiteConfiguration::getAllSiteConfigurationFromFiles ( bool  $useCache = true)
protected

◆ getAllSiteConfigurationPaths()

TYPO3\CMS\Core\Configuration\SiteConfiguration::getAllSiteConfigurationPaths ( )

Returns an array of paths in which a site configuration is found.

Definition at line 175 of file SiteConfiguration.php.

References $finder.

◆ getContentSecurityPolicies()

◆ getSiteTSconfig()

TYPO3\CMS\Core\Configuration\SiteConfiguration::getSiteTSconfig ( string  $siteIdentifier)
protected

◆ getSiteTypoScript()

◆ load()

TYPO3\CMS\Core\Configuration\SiteConfiguration::load ( string  $siteIdentifier)

Load plain configuration without additional settings.

This method should only be used in case the original configuration as it exists in the file should be loaded, for example for writing / editing configuration.

All read related actions should be performed on the site entity.

Parameters
string$siteIdentifier

Definition at line 234 of file SiteConfiguration.php.

References TYPO3\CMS\Core\Configuration\SiteConfiguration\$configFileName, TYPO3\CMS\Webhooks\Message\$siteIdentifier, and TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader\PROCESS_IMPORTS.

Referenced by TYPO3\CMS\Install\Updates\MigrateSiteSettingsConfigUpdate\getSitePathsToMigrate().

◆ resolveAllExistingSites()

◆ resolveAllExistingSitesRaw()

Site [] TYPO3\CMS\Core\Configuration\SiteConfiguration::resolveAllExistingSitesRaw ( )

Resolve all site objects which have been found in the filesystem containing settings only from the config.yaml file ignoring values from the settings.yaml and csp.yaml file.

Returns
Site[]

Not part of public API. Used as intermediate solution until settings are handled by a dedicated GUI.

Definition at line 152 of file SiteConfiguration.php.

References TYPO3\CMS\Webhooks\Message\$identifier, TYPO3\CMS\Core\Configuration\SiteConfiguration\getAllSiteConfigurationFromFiles(), and TYPO3\CMS\Core\Configuration\SiteConfiguration\getSiteTypoScript().

◆ siteConfigurationChanged()

TYPO3\CMS\Core\Configuration\SiteConfiguration::siteConfigurationChanged ( )

Definition at line 293 of file SiteConfiguration.php.

◆ warmupCaches()

TYPO3\CMS\Core\Configuration\SiteConfiguration::warmupCaches ( CacheWarmupEvent  $event)

Member Data Documentation

◆ $cacheIdentifier

string TYPO3\CMS\Core\Configuration\SiteConfiguration::$cacheIdentifier = 'sites-configuration'
protected

Identifier to store all configuration data in the core cache.

Definition at line 88 of file SiteConfiguration.php.

◆ $configFileName

string TYPO3\CMS\Core\Configuration\SiteConfiguration::$configFileName = 'config.yaml'
protected

Config yaml file name.

Definition at line 53 of file SiteConfiguration.php.

Referenced by TYPO3\CMS\Core\Configuration\SiteConfiguration\load().

◆ $contentSecurityFileName

string TYPO3\CMS\Core\Configuration\SiteConfiguration::$contentSecurityFileName = 'csp.yaml'
protected

YAML file name with all settings related to Content-Security-Policies.

Definition at line 81 of file SiteConfiguration.php.

Referenced by TYPO3\CMS\Core\Configuration\SiteConfiguration\getContentSecurityPolicies().

◆ $firstLevelCache

array null TYPO3\CMS\Core\Configuration\SiteConfiguration::$firstLevelCache
protected

Cache stores all configuration as Site objects, as long as they haven't been changed. This drastically improves performance as SiteFinder utilizes SiteConfiguration heavily

Definition at line 95 of file SiteConfiguration.php.

Referenced by TYPO3\CMS\Core\Configuration\SiteConfiguration\getAllExistingSites().

◆ $pageTSconfigFileName

string TYPO3\CMS\Core\Configuration\SiteConfiguration::$pageTSconfigFileName = 'page.tsconfig'
protected

File naming containing page TSconfig definitions

Definition at line 74 of file SiteConfiguration.php.

Referenced by TYPO3\CMS\Core\Configuration\SiteConfiguration\getSiteTSconfig().

◆ $typoScriptConstantsFileName

string TYPO3\CMS\Core\Configuration\SiteConfiguration::$typoScriptConstantsFileName = 'constants.typoscript'
protected

File naming containing TypoScript Constants.

Definition at line 67 of file SiteConfiguration.php.

Referenced by TYPO3\CMS\Core\Configuration\SiteConfiguration\getSiteTypoScript().

◆ $typoScriptSetupFileName

string TYPO3\CMS\Core\Configuration\SiteConfiguration::$typoScriptSetupFileName = 'setup.typoscript'
protected

File naming containing TypoScript Setup.

Definition at line 60 of file SiteConfiguration.php.

Referenced by TYPO3\CMS\Core\Configuration\SiteConfiguration\getSiteTypoScript().