Skip to content

Commit e425356

Browse files
authored
[TASK] Add support for typo3/cms-composer-installers v4 (#595)
1 parent 5403505 commit e425356

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Classes/Controller/BuilderModuleController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,12 @@ protected function rpcActionSave(): array
507507
$publicExtensionDirectory = Environment::getExtensionsPath() . '/' . $extension->getExtensionKey();
508508
$usesComposerPath = $this->extensionService->isComposerStoragePath($extensionDirectory);
509509
$extensionExistedBefore = is_dir($extensionDirectory);
510+
$isComposerInstallerV4 = $this->extensionService->isComposerInstallerV4();
510511

511512
if (!$extensionExistedBefore) {
512513
GeneralUtility::mkdir($extensionDirectory);
513514
}
514-
if ($usesComposerPath && !is_link($publicExtensionDirectory)) {
515+
if ($usesComposerPath && !$isComposerInstallerV4 && !is_link($publicExtensionDirectory)) {
515516
symlink(
516517
PathUtility::getRelativePath(dirname($publicExtensionDirectory), $extensionDirectory),
517518
$publicExtensionDirectory
@@ -616,7 +617,7 @@ protected function handleValidationWarnings(array $warnings): array
616617
$messagesPerErrorCode = [];
617618
foreach ($warnings as $exception) {
618619
$errorCode = $exception->getCode();
619-
if (!is_array($messagesPerErrorCode[$errorCode])) {
620+
if (!isset($messagesPerErrorCode[$errorCode])) {
620621
$messagesPerErrorCode[$errorCode] = [];
621622
}
622623
$messagesPerErrorCode[$errorCode][] = nl2br(htmlspecialchars($exception->getMessage())) . ' (Error ' . $errorCode . ')<br /><br />';

Classes/Service/ExtensionService.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
namespace EBT\ExtensionBuilder\Service;
1919

2020
use TYPO3\CMS\Core\Core\Environment;
21+
use TYPO3\CMS\Core\Utility\GeneralUtility;
2122
use TYPO3\CMS\Core\Utility\PathUtility;
2223

2324
class ExtensionService
@@ -94,4 +95,14 @@ public function isStoragePathConfigured(): bool
9495
{
9596
return !Environment::isComposerMode() || count($this->resolveStoragePaths()) > 0;
9697
}
98+
99+
/**
100+
* Returns, if typo3/cms-composer-installers v4 is used by checking, if /vendor/friendsoftypo3/extension-builder/
101+
* is part of the absolute install path of extension_builder
102+
*/
103+
public function isComposerInstallerV4(): bool
104+
{
105+
$extensionPath = GeneralUtility::getFileAbsFileName('EXT:extension_builder/');
106+
return str_contains($extensionPath, '/vendor/friendsoftypo3/extension-builder/');
107+
}
97108
}

Classes/Service/RoundTrip.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function initialize(Extension $extension): void
139139

140140
if (file_exists($this->previousExtensionDirectory . ExtensionBuilderConfigurationManager::EXTENSION_BUILDER_SETTINGS_FILE)) {
141141
$extensionSchemaBuilder = GeneralUtility::makeInstance(ExtensionSchemaBuilder::class);
142-
$jsonConfig = $this->configurationManager->getExtensionBuilderConfiguration($this->previousExtensionKey);
142+
$jsonConfig = $this->configurationManager->getExtensionBuilderConfiguration($this->previousExtensionKey, $extension->getStoragePath());
143143
$this->previousExtension = $extensionSchemaBuilder->build($jsonConfig);
144144
$previousDomainObjects = $this->previousExtension->getDomainObjects();
145145
/** @var DomainObject[] $previousDomainObjects */

0 commit comments

Comments
 (0)