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

Public Member Functions

 __construct (protected readonly CoreVersionService $coreVersionService)
 
bool isCoreUpdateEnabled ()
 
 getMessages ()
 
bool checkPreConditions (CoreRelease $coreRelease, WebserverType $webserverType)
 
bool downloadVersion (CoreRelease $coreRelease)
 
bool verifyFileChecksum (CoreRelease $coreRelease)
 
bool unpackVersion (CoreRelease $coreRelease)
 
bool moveVersion (CoreRelease $coreRelease)
 
bool activateVersion (CoreRelease $coreRelease)
 

Protected Member Functions

string discoverCurrentCoreSymlink ()
 
 setDownloadTargetPath ($downloadTargetPath)
 
string getDownloadTarGzTargetPath ($version)
 
string getRelativePath ($absolutePath)
 
bool checkCoreFilesAvailable ($version)
 

Protected Attributes

FlashMessageQueue $messages
 
string $downloadTargetPath
 
string $symlinkToCoreFiles
 
string $downloadBaseUri
 

Detailed Description

Core update service. This service handles core updates, all the nasty details are encapsulated here. The single public methods 'depend' on each other, for example a new core has to be downloaded before it can be unpacked.

Each method returns only TRUE of FALSE indicating if it was successful or not. Detailed information can be fetched with getMessages() and will return a list of status messages of the previous operation.

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 CoreUpdateService.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Install\Service\CoreUpdateService::__construct ( protected readonly CoreVersionService  $coreVersionService)

Member Function Documentation

◆ activateVersion()

bool TYPO3\CMS\Install\Service\CoreUpdateService::activateVersion ( CoreRelease  $coreRelease)

Activate a core version

Parameters
CoreRelease$coreRelease‪A core release to activate
Returns
‪bool TRUE on success

Definition at line 439 of file CoreUpdateService.php.

References TYPO3\CMS\Install\Service\CoreUpdateService\getRelativePath(), TYPO3\CMS\Install\CoreVersion\CoreRelease\getVersion(), and TYPO3\CMS\Core\Utility\PathUtility\isAbsolutePath().

◆ checkCoreFilesAvailable()

bool TYPO3\CMS\Install\Service\CoreUpdateService::checkCoreFilesAvailable (   $version)
protected

Check if there is are already core files available at the download destination.

Parameters
string$version‪A version number
Returns
‪bool true when core files are available

Definition at line 522 of file CoreUpdateService.php.

Referenced by TYPO3\CMS\Install\Service\CoreUpdateService\checkPreConditions(), TYPO3\CMS\Install\Service\CoreUpdateService\downloadVersion(), TYPO3\CMS\Install\Service\CoreUpdateService\moveVersion(), TYPO3\CMS\Install\Service\CoreUpdateService\unpackVersion(), and TYPO3\CMS\Install\Service\CoreUpdateService\verifyFileChecksum().

◆ checkPreConditions()

bool TYPO3\CMS\Install\Service\CoreUpdateService::checkPreConditions ( CoreRelease  $coreRelease,
WebserverType  $webserverType 
)

Check if an update is possible at all

Parameters
CoreRelease$coreRelease‪The target core release
WebserverType$webserverType‪The webserver type.
Returns
‪bool TRUE on success

Definition at line 123 of file CoreUpdateService.php.

References TYPO3\CMS\Install\Service\CoreUpdateService\checkCoreFilesAvailable(), TYPO3\CMS\Core\Core\Environment\getPublicPath(), TYPO3\CMS\Core\Utility\StringUtility\getUniqueId(), TYPO3\CMS\Install\CoreVersion\CoreRelease\getVersion(), and TYPO3\CMS\Core\Core\Environment\isWindows().

◆ discoverCurrentCoreSymlink()

string TYPO3\CMS\Install\Service\CoreUpdateService::discoverCurrentCoreSymlink ( )
protected

In future implementations we might implement some smarter logic here

Returns
‪string

Definition at line 89 of file CoreUpdateService.php.

References TYPO3\CMS\Core\Core\Environment\getPublicPath().

Referenced by TYPO3\CMS\Install\Service\CoreUpdateService\__construct().

◆ downloadVersion()

bool TYPO3\CMS\Install\Service\CoreUpdateService::downloadVersion ( CoreRelease  $coreRelease)

◆ getDownloadTarGzTargetPath()

string TYPO3\CMS\Install\Service\CoreUpdateService::getDownloadTarGzTargetPath (   $version)
protected

Absolute path of downloaded .tar.gz

Parameters
string$version‪A version number
Returns
‪string

Definition at line 493 of file CoreUpdateService.php.

Referenced by TYPO3\CMS\Install\Service\CoreUpdateService\downloadVersion(), and TYPO3\CMS\Install\Service\CoreUpdateService\verifyFileChecksum().

◆ getMessages()

TYPO3\CMS\Install\Service\CoreUpdateService::getMessages ( )

Get messages of previous method call

Definition at line 111 of file CoreUpdateService.php.

References TYPO3\CMS\Install\Service\CoreUpdateService\$messages.

◆ getRelativePath()

string TYPO3\CMS\Install\Service\CoreUpdateService::getRelativePath (   $absolutePath)
protected

Get relative path to TYPO3 source directory from webroot

Parameters
string$absolutePath‪to TYPO3 source directory
Returns
‪string relative path to TYPO3 source directory

Definition at line 504 of file CoreUpdateService.php.

References TYPO3\CMS\Core\Core\Environment\getPublicPath().

Referenced by TYPO3\CMS\Install\Service\CoreUpdateService\activateVersion().

◆ isCoreUpdateEnabled()

bool TYPO3\CMS\Install\Service\CoreUpdateService::isCoreUpdateEnabled ( )

Check if this installation wants to enable the core updater

Returns
‪bool

Definition at line 78 of file CoreUpdateService.php.

References TYPO3\CMS\Core\Core\Environment\isComposerMode().

Referenced by TYPO3\CMS\Install\Controller\UpgradeController\coreUpdateGetDataAction().

◆ moveVersion()

bool TYPO3\CMS\Install\Service\CoreUpdateService::moveVersion ( CoreRelease  $coreRelease)

Move an unpacked core to its final destination

Parameters
CoreRelease$coreRelease‪A core release to move
Returns
‪bool TRUE on success

Definition at line 392 of file CoreUpdateService.php.

References TYPO3\CMS\Install\Service\CoreUpdateService\checkCoreFilesAvailable(), and TYPO3\CMS\Install\CoreVersion\CoreRelease\getVersion().

◆ setDownloadTargetPath()

TYPO3\CMS\Install\Service\CoreUpdateService::setDownloadTargetPath (   $downloadTargetPath)
protected

Create download location in case the folder does not exist

Todo:
‪move this to folder structure
Parameters
string$downloadTargetPath

Definition at line 100 of file CoreUpdateService.php.

References TYPO3\CMS\Install\Service\CoreUpdateService\$downloadTargetPath, and TYPO3\CMS\Core\Utility\GeneralUtility\mkdir_deep().

Referenced by TYPO3\CMS\Install\Service\CoreUpdateService\__construct().

◆ unpackVersion()

bool TYPO3\CMS\Install\Service\CoreUpdateService::unpackVersion ( CoreRelease  $coreRelease)

Unpack a downloaded core

Parameters
CoreRelease$coreRelease‪A core release to unpack
Returns
‪bool TRUE on success

Definition at line 329 of file CoreUpdateService.php.

References $output, TYPO3\CMS\Install\Service\CoreUpdateService\checkCoreFilesAvailable(), TYPO3\CMS\Install\CoreVersion\CoreRelease\getVersion(), and TYPO3\CMS\Core\Utility\PathUtility\stripPathSitePrefix().

◆ verifyFileChecksum()

bool TYPO3\CMS\Install\Service\CoreUpdateService::verifyFileChecksum ( CoreRelease  $coreRelease)

Verify checksum of downloaded version

Parameters
CoreRelease$coreRelease‪A downloaded core release to check
Returns
‪bool TRUE on success

Definition at line 280 of file CoreUpdateService.php.

References TYPO3\CMS\Install\Service\CoreUpdateService\checkCoreFilesAvailable(), TYPO3\CMS\Install\CoreVersion\CoreRelease\getChecksum(), TYPO3\CMS\Install\Service\CoreUpdateService\getDownloadTarGzTargetPath(), and TYPO3\CMS\Install\CoreVersion\CoreRelease\getVersion().

Member Data Documentation

◆ $downloadBaseUri

string TYPO3\CMS\Install\Service\CoreUpdateService::$downloadBaseUri
protected

Base URI for TYPO3 downloads

Definition at line 63 of file CoreUpdateService.php.

◆ $downloadTargetPath

string TYPO3\CMS\Install\Service\CoreUpdateService::$downloadTargetPath
protected

Absolute path to download location

Definition at line 51 of file CoreUpdateService.php.

Referenced by TYPO3\CMS\Install\Service\CoreUpdateService\setDownloadTargetPath().

◆ $messages

FlashMessageQueue TYPO3\CMS\Install\Service\CoreUpdateService::$messages
protected

◆ $symlinkToCoreFiles

string TYPO3\CMS\Install\Service\CoreUpdateService::$symlinkToCoreFiles
protected

Absolute path to the symlink pointing to the currently used TYPO3 core files

Definition at line 57 of file CoreUpdateService.php.