SiteConfiguration

class \TYPO3\CMS\Core\Configuration\SiteConfiguration

Implements
SingletonInterface

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.

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$cache  : PhpFrontend
$cacheIdentifier  : string
Identifier to store all configuration data in the core cache.
$configFileName  : string
Config yaml file name.
$configPath  : string
$firstLevelCache  : array|null
Cache stores all configuration as Site objects, as long as they haven't been changed.

Methods

__construct()  : mixed
createNewBasicSite()  : void
Creates a site configuration with one language "English" which is the de-facto default language for TYPO3 in general.
delete()  : void
Removes the config.yaml file of a site configuration.
getAllExistingSites()  : Site[]
Return all site objects which have been found in the filesystem.
load()  : array
Load plain configuration 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.
rename()  : void
Renames a site identifier (and moves the folder)
resolveAllExistingSites()  : Site[]
Resolve all site objects which have been found in the filesystem.
warmupCaches()  : void
write()  : void
Add or update a site configuration
findModified()  : array
findRemoved()  : array
getAllSiteConfigurationFromFiles()  : array
Read the site configuration from config files.
protectPlaceholders()  : array<string, mixed>
Detects placeholders that have been introduced and handles* them.
sortConfiguration()  : array

Properties

$cacheIdentifier

Identifier to store all configuration data in the core cache.

protected string $cacheIdentifier = 'sites-configuration'

$configFileName

Config yaml file name.

protected string $configFileName = 'config.yaml'

$firstLevelCache

Cache stores all configuration as Site objects, as long as they haven't been changed.

protected array|null $firstLevelCache

This drastically improves performance as SiteFinder utilizes SiteConfiguration heavily

Methods

__construct()

public __construct(string $configPath[, PhpFrontend|null $coreCache = null ]) : mixed

Parameters

$configPath : string
$coreCache : PhpFrontend|null = null

createNewBasicSite()

Creates a site configuration with one language "English" which is the de-facto default language for TYPO3 in general.

public createNewBasicSite(string $identifier, int $rootPageId, string $base) : void

Parameters

$identifier : string
$rootPageId : int
$base : string

Tags

throws
SiteConfigurationWriteException

getAllExistingSites()

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

public getAllExistingSites([bool $useCache = true ]) : Site[]

Parameters

$useCache : bool = true

Return values

Site[]

load()

Load plain configuration 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.

public load(string $siteIdentifier) : array

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

Parameters

$siteIdentifier : string

Return values

array

rename()

Renames a site identifier (and moves the folder)

public rename(string $currentIdentifier, string $newIdentifier) : void

Parameters

$currentIdentifier : string
$newIdentifier : string

Tags

throws
SiteConfigurationWriteException

resolveAllExistingSites()

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

public resolveAllExistingSites([bool $useCache = true ]) : Site[]

Parameters

$useCache : bool = true

Return values

Site[]

write()

Add or update a site configuration

public write(string $siteIdentifier, array $configuration[, bool $protectPlaceholders = false ]) : void

Parameters

$siteIdentifier : string
$configuration : array
$protectPlaceholders : bool = false

whether to disallow introducing new placeholders

Tags

throws
SiteConfigurationWriteException

findModified()

protected static findModified(array $currentConfiguration, array $newConfiguration) : array

Parameters

$currentConfiguration : array
$newConfiguration : array

Return values

array

findRemoved()

protected static findRemoved(array $currentConfiguration, array $newConfiguration) : array

Parameters

$currentConfiguration : array
$newConfiguration : array

Return values

array

getAllSiteConfigurationFromFiles()

Read the site configuration from config files.

protected getAllSiteConfigurationFromFiles([bool $useCache = true ]) : array

Parameters

$useCache : bool = true

Tags

throws
InvalidDataException

Return values

array

protectPlaceholders()

Detects placeholders that have been introduced and handles* them.

protected protectPlaceholders(array<string, mixed> $existingConfiguration, array<string, mixed> $modifiedConfiguration) : array<string, mixed>

(*) currently throws an exception, but could be purged or escaped as well

Parameters

$existingConfiguration : array<string, mixed>
$modifiedConfiguration : array<string, mixed>

Tags

throws
SiteConfigurationWriteException

Return values

array<string, mixed> —

sanitized configuration (currently not used, exception thrown before)

sortConfiguration()

protected sortConfiguration(array $newConfiguration) : array

Parameters

$newConfiguration : array

Return values

array
On this page