diff --git a/src/Domain/Version/ComposerVersionChecker.php b/src/Domain/Version/ComposerVersionChecker.php index ba249635..b6aecc59 100644 --- a/src/Domain/Version/ComposerVersionChecker.php +++ b/src/Domain/Version/ComposerVersionChecker.php @@ -18,6 +18,10 @@ final class ComposerVersionChecker implements VersionCheckerInterface { public function isSatisified(string $packageName, string $constraint): bool { - return InstalledVersions::satisfies(new VersionParser(), $packageName, $constraint); + try { + return InstalledVersions::satisfies(new VersionParser(), $packageName, $constraint); + } catch (\OutOfBoundsException $outOfBoundsException) { + return false; + } } } diff --git a/src/Task/TYPO3/CMS/AbstractCliTask.php b/src/Task/TYPO3/CMS/AbstractCliTask.php index e9f8f5c0..f3c7febe 100755 --- a/src/Task/TYPO3/CMS/AbstractCliTask.php +++ b/src/Task/TYPO3/CMS/AbstractCliTask.php @@ -124,6 +124,7 @@ protected function fileExists(string $pathAndFileName, Node $node, CMS $applicat { $this->determineWorkingDirectoryAndTargetNode($node, $application, $deployment, $options); $pathAndFileName = $this->workingDirectory . '/' . $pathAndFileName; + return $this->shell->executeOrSimulate('test -f ' . escapeshellarg($pathAndFileName), $this->targetNode, $deployment, true) !== false; } } diff --git a/src/Task/TYPO3/CMS/SetUpExtensionsTask.php b/src/Task/TYPO3/CMS/SetUpExtensionsTask.php index acdb400d..992db1f0 100755 --- a/src/Task/TYPO3/CMS/SetUpExtensionsTask.php +++ b/src/Task/TYPO3/CMS/SetUpExtensionsTask.php @@ -51,7 +51,7 @@ public function execute(Node $node, Application $application, Deployment $deploy $commandArguments = [$scriptFileName]; - if ($this->versionChecker->isSatisified('helhum/typo3-console', '>= 7.0.0')) { + if (version_compare($options['scriptFileVersion'], '7.0.0') >= 0 || $this->versionChecker->isSatisified('helhum/typo3-console', '>= 7.0.0')) { $commandArguments[] = 'extension:setup'; if (!empty($options['extensionKeys'])) { foreach ($options['extensionKeys'] as $extensionKey) { @@ -77,6 +77,7 @@ public function execute(Node $node, Application $application, Deployment $deploy protected function resolveOptions(OptionsResolver $resolver): void { + $resolver->setDefault('scriptFileVersion', '0.0.0'); $resolver->setDefault('extensionKeys', []); $resolver->setAllowedTypes('extensionKeys', 'array'); } diff --git a/tests/Unit/Task/TYPO3/CMS/SetUpExtensionsTaskTest.php b/tests/Unit/Task/TYPO3/CMS/SetUpExtensionsTaskTest.php index 64534517..9e4ec479 100644 --- a/tests/Unit/Task/TYPO3/CMS/SetUpExtensionsTaskTest.php +++ b/tests/Unit/Task/TYPO3/CMS/SetUpExtensionsTaskTest.php @@ -118,6 +118,21 @@ public function consoleIsFoundInCorrectPathWithoutAppDirectoryInVersionEqualOrHi $this->assertCommandExecuted("php 'vendor/bin/typo3cms' 'extension:setup' '-e' 'foo' '-e' 'bar'"); } + /** + * @test + */ + public function consoleIsFoundInCorrectPathWithoutAppDirectoryDefinedWithVersionHigherOrEqualSeven(): void + { + $options = [ + 'scriptFileName' => 'vendor/bin/typo3cms', + 'extensionKeys' => ['foo', 'bar'], + 'scriptFileVersion' => '7.0.0' + ]; + $this->task->execute($this->node, $this->application, $this->deployment, $options); + $this->assertCommandExecuted("cd '{$this->deployment->getApplicationReleasePath($this->node)}'"); + $this->assertCommandExecuted("php 'vendor/bin/typo3cms' 'extension:setup' '-e' 'foo' '-e' 'bar'"); + } + /** * @test */