‪TYPO3CMS  11.5
TYPO3\CMS\Core\Composer\PackageArtifactBuilder Class Reference
Inheritance diagram for TYPO3\CMS\Core\Composer\PackageArtifactBuilder:

Public Member Functions

 __construct ()
 
bool run (Event $event)
 

Protected Member Functions

 isComposerDependency (string $packageName)
 

Private Member Functions

 setTitleFromExtEmConf (Package $package)
 
 sortPackagesAndConfiguration ()
 
array extractPackageMapFromComposer ()
 
array handleRootPackage (PackageInterface $rootPackage, string $extensionKey)
 
 publishResources (array $installedTypo3Packages)
 
 ensureJunctionExists (string $target, string $junction)
 
 ensureSymlinkExists (string $target, string $link)
 
array amendWithLocallyAvailableExtensions (array $installedTypo3Packages)
 
array scanForRootExtensions (array $installedExtensionKeys)
 

Private Attributes

const LEGACY_EXTENSION_INSTALL_PATH = '/typo3conf/ext'
 
Event $event
 
Config $config
 
Filesystem $fileSystem
 
array $availableComposerPackageKeys = array( )
 

Detailed Description

The builder is a subclass of PackageManager as it shares much of its functionality. It evaluates the installed Composer packages for applicable TYPO3 extensions. All Composer packages will be discovered, that have an extra.typo3/cms definition in their composer.json. All ext_emconf.php files will be completely ignored in this context, which means all extensions are required to have a composer.json file, which works out naturally with a Composer setup.

This class is an implementation detail and does not represent public API

Definition at line 49 of file PackageArtifactBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Composer\PackageArtifactBuilder::__construct ( )

Definition at line 70 of file PackageArtifactBuilder.php.

Member Function Documentation

◆ amendWithLocallyAvailableExtensions()

array TYPO3\CMS\Core\Composer\PackageArtifactBuilder::amendWithLocallyAvailableExtensions ( array  $installedTypo3Packages)
private

Add extensions, that are located in typo3conf/ext, but are not installed by Composer to the list of known packages. This is now deprecated and will be removed with TYPO3 12. From then on all Extension for Composer enabled TYPO3 projects must be installed with Composer.

Deprecated:
‪Will be removed with TYPO3 12
Parameters
array$installedTypo3Packages
Returns
‪array

Definition at line 320 of file PackageArtifactBuilder.php.

References TYPO3\CMS\Core\Composer\PackageArtifactBuilder\scanForRootExtensions().

Referenced by TYPO3\CMS\Core\Composer\PackageArtifactBuilder\extractPackageMapFromComposer().

◆ ensureJunctionExists()

TYPO3\CMS\Core\Composer\PackageArtifactBuilder::ensureJunctionExists ( string  $target,
string  $junction 
)
private

◆ ensureSymlinkExists()

TYPO3\CMS\Core\Composer\PackageArtifactBuilder::ensureSymlinkExists ( string  $target,
string  $link 
)
private

◆ extractPackageMapFromComposer()

array TYPO3\CMS\Core\Composer\PackageArtifactBuilder::extractPackageMapFromComposer ( )
private

◆ handleRootPackage()

array TYPO3\CMS\Core\Composer\PackageArtifactBuilder::handleRootPackage ( PackageInterface  $rootPackage,
string  $extensionKey 
)
private

TYPO3 can not handle public resources of extensions, that do not reside in typo3conf/ext Therefore, if the root package is of type typo3-cms-extension and has the folder Resources/Public, we fake the path of this extension to be in typo3conf/ext

For root packages of other types or extensions without public resources, no symlink is created and the package path stays to be the composer root path.

If extensions are installed into vendor folder, linking is skipped, because public resources are published anyway. Linking could be skipped altogether, but is kept to stay consistent: extensions in typo3conf/ext: root package is linked extensions in vendor: public resources of all packages are published

Todo:
‪: remove this method in TYPO3 v12
Parameters
PackageInterface$rootPackage
string$extensionKey
Returns
‪array

Definition at line 247 of file PackageArtifactBuilder.php.

Referenced by TYPO3\CMS\Core\Composer\PackageArtifactBuilder\extractPackageMapFromComposer().

◆ isComposerDependency()

TYPO3\CMS\Core\Composer\PackageArtifactBuilder::isComposerDependency ( string  $packageName)
protected

Definition at line 76 of file PackageArtifactBuilder.php.

◆ publishResources()

TYPO3\CMS\Core\Composer\PackageArtifactBuilder::publishResources ( array  $installedTypo3Packages)
private

◆ run()

bool TYPO3\CMS\Core\Composer\PackageArtifactBuilder::run ( Event  $event)

Entry method called in Composer post-dump-autoload hook

Parameters
Event$event
Returns
‪bool
Exceptions
InvalidPackageKeyException
InvalidPackageManifestException
InvalidPackagePathException
InvalidPackageStateException

Definition at line 91 of file PackageArtifactBuilder.php.

References TYPO3\CMS\Core\Composer\PackageArtifactBuilder\$event, TYPO3\CMS\Core\Composer\PackageArtifactBuilder\extractPackageMapFromComposer(), TYPO3\CMS\Core\Utility\PathUtility\sanitizeTrailingSeparator(), TYPO3\CMS\Core\Composer\PackageArtifactBuilder\setTitleFromExtEmConf(), and TYPO3\CMS\Core\Composer\PackageArtifactBuilder\sortPackagesAndConfiguration().

◆ scanForRootExtensions()

array TYPO3\CMS\Core\Composer\PackageArtifactBuilder::scanForRootExtensions ( array  $installedExtensionKeys)
private

Scans typo3conf/ext folder for extensions

Parameters
array$installedExtensionKeys
Returns
‪array

Definition at line 344 of file PackageArtifactBuilder.php.

References $finder, and TYPO3\CMS\Core\Composer\PackageArtifactBuilder\LEGACY_EXTENSION_INSTALL_PATH.

Referenced by TYPO3\CMS\Core\Composer\PackageArtifactBuilder\amendWithLocallyAvailableExtensions().

◆ setTitleFromExtEmConf()

TYPO3\CMS\Core\Composer\PackageArtifactBuilder::setTitleFromExtEmConf ( Package  $package)
private

Sets a title for the package from ext_emconf.php in case this file exists

Todo:
‪deprecate or remove in TYPO3 v12
Parameters
Package$package

Definition at line 121 of file PackageArtifactBuilder.php.

References $EM_CONF, TYPO3\CMS\Core\Package\Package\getPackageKey(), TYPO3\CMS\Core\Package\Package\getPackageMetaData(), TYPO3\CMS\Core\Package\Package\getPackagePath(), and TYPO3\CMS\Core\Package\MetaData\setTitle().

Referenced by TYPO3\CMS\Core\Composer\PackageArtifactBuilder\run().

◆ sortPackagesAndConfiguration()

TYPO3\CMS\Core\Composer\PackageArtifactBuilder::sortPackagesAndConfiguration ( )
private

Sorts all TYPO3 extension packages by dependency defined in composer.json file

Definition at line 137 of file PackageArtifactBuilder.php.

Referenced by TYPO3\CMS\Core\Composer\PackageArtifactBuilder\run().

Member Data Documentation

◆ $availableComposerPackageKeys

array TYPO3\CMS\Core\Composer\PackageArtifactBuilder::$availableComposerPackageKeys = array( )
private

Array of Composer package names (as array key) that are installed by Composer but have no relation to TYPO3 extension API

Definition at line 68 of file PackageArtifactBuilder.php.

◆ $config

Config TYPO3\CMS\Core\Composer\PackageArtifactBuilder::$config
private

$config

Definition at line 59 of file PackageArtifactBuilder.php.

◆ $event

Event TYPO3\CMS\Core\Composer\PackageArtifactBuilder::$event
private

$event

Definition at line 55 of file PackageArtifactBuilder.php.

Referenced by TYPO3\CMS\Core\Composer\PackageArtifactBuilder\run().

◆ $fileSystem

Filesystem TYPO3\CMS\Core\Composer\PackageArtifactBuilder::$fileSystem
private

$fileSystem

Definition at line 63 of file PackageArtifactBuilder.php.

◆ LEGACY_EXTENSION_INSTALL_PATH

const TYPO3\CMS\Core\Composer\PackageArtifactBuilder::LEGACY_EXTENSION_INSTALL_PATH = '/typo3conf/ext'
private