‪TYPO3CMS  ‪main
TYPO3\CMS\Install\Service\SetupService Class Reference

Public Member Functions

 __construct (private ConfigurationManager $configurationManager, private SiteConfiguration $siteConfiguration, private YamlFileLoader $yamlFileLoader,)
 
 setSiteName (string $name)
 
 createSiteConfiguration (string $identifier, int $rootPageId, string $siteUrl)
 
 createUser (string $username, string $password, string $email='')
 
 setInstallToolPassword (string $password)
 
 prepareSystemSettings (bool $forceOverwrite=false)
 
 createSite ()
 
 createBackendUserGroups (bool $createEditor=true, bool $createAdvancedEditor=true)
 

Private Member Functions

string getHashedPassword (string $password)
 
 applyPermissionPreset (array $permissionPreset, string $table, int $recordId)
 

Detailed Description

Service class helping to manage parts of the setup process (set configuration, create backend user, create a basic site, create default backend groups, etc.)

This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.

Definition at line 41 of file SetupService.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Install\Service\SetupService::__construct ( private ConfigurationManager  $configurationManager,
private SiteConfiguration  $siteConfiguration,
private YamlFileLoader  $yamlFileLoader 
)

Definition at line 43 of file SetupService.php.

Member Function Documentation

◆ applyPermissionPreset()

TYPO3\CMS\Install\Service\SetupService::applyPermissionPreset ( array  $permissionPreset,
string  $table,
int  $recordId 
)
private

Definition at line 259 of file SetupService.php.

References $fields.

Referenced by TYPO3\CMS\Install\Service\SetupService\createBackendUserGroups().

◆ createBackendUserGroups()

TYPO3\CMS\Install\Service\SetupService::createBackendUserGroups ( bool  $createEditor = true,
bool  $createAdvancedEditor = true 
)

Initializes backend user group presets. Currently hard-coded to editor and advanced editor. When more backend user group presets are added, please refactor (maybe DTO).

Definition at line 226 of file SetupService.php.

References TYPO3\CMS\Install\Service\SetupService\applyPermissionPreset().

◆ createSite()

TYPO3\CMS\Install\Service\SetupService::createSite ( )

Definition at line 159 of file SetupService.php.

◆ createSiteConfiguration()

TYPO3\CMS\Install\Service\SetupService::createSiteConfiguration ( string  $identifier,
int  $rootPageId,
string  $siteUrl 
)

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

Exceptions
SiteConfigurationWriteException

Definition at line 58 of file SetupService.php.

References TYPO3\CMS\Webhooks\Message\$identifier.

◆ createUser()

TYPO3\CMS\Install\Service\SetupService::createUser ( string  $username,
string  $password,
string  $email = '' 
)

Create a backend user with maintainer and admin flag set by default, because the initial user always requires these flags to grant full permissions to the system.

Definition at line 98 of file SetupService.php.

References $GLOBALS, and TYPO3\CMS\Install\Service\SetupService\getHashedPassword().

◆ getHashedPassword()

string TYPO3\CMS\Install\Service\SetupService::getHashedPassword ( string  $password)
private

This function returns a salted hashed key for new backend user password and install tool password.

This method is executed during installation before the preset did set up proper hash method selection in LocalConfiguration. So PasswordHashFactory is not usable at this point. We thus loop through the default hash mechanisms and select the first one that works. The preset calculation of step executeDefaultConfigurationAction() basically does the same later.

Parameters
string$password‪Plain text password
Returns
‪string Hashed password

Definition at line 75 of file SetupService.php.

Referenced by TYPO3\CMS\Install\Service\SetupService\createUser(), and TYPO3\CMS\Install\Service\SetupService\setInstallToolPassword().

◆ prepareSystemSettings()

TYPO3\CMS\Install\Service\SetupService::prepareSystemSettings ( bool  $forceOverwrite = false)
Exceptions
ExistingTargetFileNameException

Definition at line 131 of file SetupService.php.

◆ setInstallToolPassword()

TYPO3\CMS\Install\Service\SetupService::setInstallToolPassword ( string  $password)

◆ setSiteName()

TYPO3\CMS\Install\Service\SetupService::setSiteName ( string  $name)

Definition at line 49 of file SetupService.php.