Skip to content
Snippets Groups Projects
Commit 9487c117 authored by Helmut Hummel's avatar Helmut Hummel Committed by Tobi Kretschmann
Browse files

[BUGFIX] Use proper path to install cli binary

The cli binary path is changed to be located in TYPO3_PATH_WEB
instead of TYPO3_PATH_ROOT.

Releases: 9.5, master
Resolves: #88088
Change-Id: I96587254d121149b58f35b0abb0084a89a31b0c7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60371


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarJörg Bösche <typo3@joergboesche.de>
Reviewed-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarJörg Bösche <typo3@joergboesche.de>
parent 3fe30c41
Branches
Tags
No related merge requests found
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\Composer;
/*
* This file is part of the TYPO3 project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Composer\Script\Event;
use Composer\Util\Filesystem as FilesystemUtility;
use Symfony\Component\Filesystem\Filesystem;
use TYPO3\CMS\Composer\Plugin\Config;
use TYPO3\CMS\Composer\Plugin\Core\InstallerScript;
class CliEntryPoint implements InstallerScript
{
/**
* Absolute path to entry script source
*
* @var string
*/
private $source;
/**
* The target file relative to the web directory
*
* @var string
*/
private $target;
public function __construct(string $source, string $target)
{
$this->source = $source;
$this->target = $target;
}
public function run(Event $event): bool
{
$composer = $event->getComposer();
$filesystemUtility = new FilesystemUtility();
$filesystem = new Filesystem();
$pluginConfig = Config::load($composer);
$entryPointContent = file_get_contents($this->source);
$targetFile = $pluginConfig->get('root-dir') . '/' . $this->target;
$autoloadFile = $composer->getConfig()->get('vendor-dir') . '/autoload.php';
$entryPointContent = preg_replace(
'/__DIR__ . \'[^\']*\'/',
$filesystemUtility->findShortestPathCode($targetFile, $autoloadFile),
$entryPointContent
);
$filesystemUtility->ensureDirectoryExists(dirname($targetFile));
$filesystem->dumpFile($targetFile, $entryPointContent);
$filesystem->chmod($targetFile, 0755);
return $filesystem->exists($targetFile);
}
}
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Core\Composer;
*/
use Composer\Script\Event;
use TYPO3\CMS\Composer\Plugin\Core\InstallerScripts\EntryPoint;
use TYPO3\CMS\Composer\Plugin\Core\InstallerScriptsRegistration;
use TYPO3\CMS\Composer\Plugin\Core\ScriptDispatcher;
......@@ -35,32 +34,6 @@ class InstallerScripts implements InstallerScriptsRegistration
$source = dirname(__DIR__, 2) . '/Resources/Private/Php/cli.php';
$target = 'typo3/sysext/core/bin/typo3';
$scriptDispatcher->addInstallerScript(
// @todo: Add support to `typo3/cms-composer-installers` to create executable entry points
new class($source, $target) extends EntryPoint {
/** @var string */
private $target;
public function __construct(string $source, string $target)
{
parent::__construct($source, $target);
$this->target = $target;
}
public function run(Event $event): bool
{
parent::run($event);
$composer = $event->getComposer();
$pluginConfig = \TYPO3\CMS\Composer\Plugin\Config::load($composer);
$targetFile = $pluginConfig->get('web-dir') . '/' . $this->target;
@chmod($targetFile, 0755);
return true;
}
}
);
$scriptDispatcher->addInstallerScript(new CliEntryPoint($source, $target));
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment