File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 ],
2020 "require" : {
2121 "php" : " >=7.3 <8.4" ,
22- "composer-plugin-api" : " ^1.0 || ^2.0 " ,
22+ "composer-plugin-api" : " ^2.1 " ,
2323 "roundcube/roundcubemail" : " *"
2424 },
2525 "require-dev" : {
26- "composer/composer" : " ^2.0 " ,
26+ "composer/composer" : " ^2.1 " ,
2727 "ergebnis/composer-normalize" : " ^2.13" ,
2828 "friendsofphp/php-cs-fixer" : " ^3.0" ,
2929 "phpstan/extension-installer" : " ^1.1" ,
Original file line number Diff line number Diff line change 22
33namespace Roundcube \Composer ;
44
5+ use Composer \Installer \InstallationManager ;
56use Composer \Installer \LibraryInstaller ;
67use Composer \Package \PackageInterface ;
78use Composer \Package \Version \VersionParser ;
@@ -43,15 +44,26 @@ protected function setRoundcubemailInstallPath(InstalledRepositoryInterface $ins
4344
4445 protected function getRoundcubemailInstallPath (): string
4546 {
47+ // install path is not set at composer download phase
48+ // never assume any path, but for this known composer behaviour get it from backtrace instead
49+ if ($ this ->roundcubemailInstallPath === null ) {
50+ $ backtrace = debug_backtrace ();
51+ foreach ($ backtrace as $ frame ) {
52+ // relies on https://github.com/composer/composer/blob/2.7.4/src/Composer/Installer/InstallationManager.php#L243
53+ if (($ frame ['object ' ] ?? null ) instanceof InstallationManager
54+ && $ frame ['function ' ] === 'downloadAndExecuteBatch '
55+ ) {
56+ $ this ->setRoundcubemailInstallPath ($ frame ['args ' ][0 ]);
57+ }
58+ }
59+ }
60+
4661 return $ this ->roundcubemailInstallPath ;
4762 }
4863
4964 public function getInstallPath (PackageInterface $ package )
5065 {
51- if (
52- !$ this ->supports ($ package ->getType ())
53- || $ this ->roundcubemailInstallPath === null // install path is not known at download phase
54- ) {
66+ if (!$ this ->supports ($ package ->getType ())) {
5567 return parent ::getInstallPath ($ package );
5668 }
5769
You can’t perform that action at this time.
0 commit comments