PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | vendor/composer/installers/src/Composer/Installers/Installer.php +42 -51 1.10 → trunk View file →
@@ -5,8 +5,9 @@
5 5 use Composer\Composer;
6 6 use Composer\Installer\BinaryInstaller;
7 7 use Composer\Installer\LibraryInstaller;
8 8 use Composer\IO\IOInterface;
9 +use Composer\Package\Package;
9 10 use Composer\Package\PackageInterface;
10 11 use Composer\Repository\InstalledRepositoryInterface;
11 12 use Composer\Util\Filesystem;
12 13 use React\Promise\PromiseInterface;
@@ -12,21 +13,21 @@
12 13 use React\Promise\PromiseInterface;
13 14
14 15 class Installer extends LibraryInstaller
15 16 {
16 -
17 17 /**
18 18 * Package types to installer class map
19 19 *
20 - * @var array
20 + * @var array<string, string>
21 21 */
22 22 private $supportedTypes = array(
23 - 'aimeos' => 'AimeosInstaller',
23 + 'akaunting' => 'AkauntingInstaller',
24 24 'asgard' => 'AsgardInstaller',
25 25 'attogram' => 'AttogramInstaller',
26 26 'agl' => 'AglInstaller',
27 27 'annotatecms' => 'AnnotateCmsInstaller',
28 28 'bitrix' => 'BitrixInstaller',
29 + 'botble' => 'BotbleInstaller',
29 30 'bonefish' => 'BonefishInstaller',
30 31 'cakephp' => 'CakePHPInstaller',
31 32 'chef' => 'ChefInstaller',
32 33 'civicrm' => 'CiviCrmInstaller',
@@ -33,9 +34,9 @@
33 34 'ccframework' => 'ClanCatsFrameworkInstaller',
34 35 'cockpit' => 'CockpitInstaller',
35 36 'codeigniter' => 'CodeIgniterInstaller',
36 37 'concrete5' => 'Concrete5Installer',
37 - 'craft' => 'CraftInstaller',
38 + 'concretecms' => 'ConcreteCMSInstaller',
38 39 'croogo' => 'CroogoInstaller',
39 40 'dframe' => 'DframeInstaller',
40 41 'dokuwiki' => 'DokuWikiInstaller',
41 42 'dolibarr' => 'DolibarrInstaller',
@@ -45,8 +46,9 @@
45 46 'eliasis' => 'EliasisInstaller',
46 47 'ee3' => 'ExpressionEngineInstaller',
47 48 'ee2' => 'ExpressionEngineInstaller',
48 49 'ezplatform' => 'EzPlatformInstaller',
50 + 'fork' => 'ForkCMSInstaller',
49 51 'fuel' => 'FuelInstaller',
50 52 'fuelphp' => 'FuelphpInstaller',
51 53 'grav' => 'GravInstaller',
52 54 'hurad' => 'HuradInstaller',
@@ -52,15 +54,13 @@
52 54 'hurad' => 'HuradInstaller',
53 55 'tastyigniter' => 'TastyIgniterInstaller',
54 56 'imagecms' => 'ImageCMSInstaller',
55 57 'itop' => 'ItopInstaller',
56 - 'joomla' => 'JoomlaInstaller',
57 58 'kanboard' => 'KanboardInstaller',
58 - 'kirby' => 'KirbyInstaller',
59 59 'known' => 'KnownInstaller',
60 60 'kodicms' => 'KodiCMSInstaller',
61 61 'kohana' => 'KohanaInstaller',
62 - 'lms' => 'LanManagementSystemInstaller',
62 + 'lms' => 'LanManagementSystemInstaller',
63 63 'laravel' => 'LaravelInstaller',
64 64 'lavalite' => 'LavaLiteInstaller',
65 65 'lithium' => 'LithiumInstaller',
66 66 'magento' => 'MagentoInstaller',
@@ -66,8 +66,9 @@
66 66 'magento' => 'MagentoInstaller',
67 67 'majima' => 'MajimaInstaller',
68 68 'mantisbt' => 'MantisBTInstaller',
69 69 'mako' => 'MakoInstaller',
70 + 'matomo' => 'MatomoInstaller',
70 71 'maya' => 'MayaInstaller',
71 72 'mautic' => 'MauticInstaller',
72 73 'mediawiki' => 'MediaWikiInstaller',
73 74 'miaoxing' => 'MiaoxingInstaller',
@@ -81,9 +82,8 @@
81 82 'oxid' => 'OxidInstaller',
82 83 'osclass' => 'OsclassInstaller',
83 84 'pxcms' => 'PxcmsInstaller',
84 85 'phpbb' => 'PhpBBInstaller',
85 - 'pimcore' => 'PimcoreInstaller',
86 86 'piwik' => 'PiwikInstaller',
87 87 'plentymarkets'=> 'PlentymarketsInstaller',
88 88 'ppi' => 'PPIInstaller',
89 89 'puppet' => 'PuppetInstaller',
@@ -90,8 +90,9 @@
90 90 'radphp' => 'RadPHPInstaller',
91 91 'phifty' => 'PhiftyInstaller',
92 92 'porto' => 'PortoInstaller',
93 93 'processwire' => 'ProcessWireInstaller',
94 + 'quicksilver' => 'PantheonInstaller',
94 95 'redaxo' => 'RedaxoInstaller',
95 96 'redaxo5' => 'Redaxo5Installer',
96 97 'reindex' => 'ReIndexInstaller',
97 98 'roundcube' => 'RoundcubeInstaller',
@@ -101,14 +102,11 @@
101 102 'smf' => 'SMFInstaller',
102 103 'starbug' => 'StarbugInstaller',
103 104 'sydes' => 'SyDESInstaller',
104 105 'sylius' => 'SyliusInstaller',
105 - 'symfony1' => 'Symfony1Installer',
106 106 'tao' => 'TaoInstaller',
107 107 'thelia' => 'TheliaInstaller',
108 108 'tusk' => 'TuskInstaller',
109 - 'typo3-cms' => 'TYPO3CmsInstaller',
110 - 'typo3-flow' => 'TYPO3FlowInstaller',
111 109 'userfrosting' => 'UserFrostingInstaller',
112 110 'vanilla' => 'VanillaInstaller',
113 111 'whmcs' => 'WHMCSInstaller',
114 112 'winter' => 'WinterInstaller',
@@ -120,28 +118,19 @@
120 118 'prestashop' => 'PrestashopInstaller'
121 119 );
122 120
123 121 /**
124 - * Installer constructor.
125 - *
126 122 * Disables installers specified in main composer extra installer-disable
127 123 * list
128 - *
129 - * @param IOInterface $io
130 - * @param Composer $composer
131 - * @param string $type
132 - * @param Filesystem|null $filesystem
133 - * @param BinaryInstaller|null $binaryInstaller
134 124 */
135 125 public function __construct(
136 126 IOInterface $io,
137 127 Composer $composer,
138 - $type = 'library',
139 - Filesystem $filesystem = null,
140 - BinaryInstaller $binaryInstaller = null
128 + string $type = 'library',
129 + ?Filesystem $filesystem = null,
130 + ?BinaryInstaller $binaryInstaller = null
141 131 ) {
142 - parent::__construct($io, $composer, $type, $filesystem,
143 - $binaryInstaller);
132 + parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
144 133 $this->removeDisabledInstallers();
145 134 }
146 135
147 136 /**
@@ -158,11 +147,19 @@
158 147 );
159 148 }
160 149
161 150 $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
151 + /**
152 + * @var BaseInstaller
153 + */
162 154 $installer = new $class($package, $this->composer, $this->getIO());
163 155
164 - return $installer->getInstallPath($package, $frameworkType);
156 + $path = $installer->getInstallPath($package, $frameworkType);
157 + if (!$this->filesystem->isAbsolutePath($path)) {
158 + $path = getcwd() . '/' . $path;
159 + }
160 +
161 + return $path;
165 162 }
166 163
167 164 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
168 165 {
@@ -186,8 +183,10 @@
186 183 }
187 184
188 185 /**
189 186 * {@inheritDoc}
187 + *
188 + * @param string $packageType
190 189 */
191 190 public function supports($packageType)
192 191 {
193 192 $frameworkType = $this->findFrameworkType($packageType);
@@ -203,12 +202,11 @@
203 202
204 203 /**
205 204 * Finds a supported framework type if it exists and returns it
206 205 *
207 - * @param string $type
208 206 * @return string|false
209 207 */
210 - protected function findFrameworkType($type)
208 + protected function findFrameworkType(string $type)
211 209 {
212 210 krsort($this->supportedTypes);
213 211
214 212 foreach ($this->supportedTypes as $key => $val) {
@@ -222,32 +220,26 @@
222 220
223 221 /**
224 222 * Get the second part of the regular expression to check for support of a
225 223 * package type
226 - *
227 - * @param string $frameworkType
228 - * @return string
229 224 */
230 - protected function getLocationPattern($frameworkType)
225 + protected function getLocationPattern(string $frameworkType): string
231 226 {
232 - $pattern = false;
227 + $pattern = null;
233 228 if (!empty($this->supportedTypes[$frameworkType])) {
234 229 $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
235 230 /** @var BaseInstaller $framework */
236 - $framework = new $frameworkClass(null, $this->composer, $this->getIO());
237 - $locations = array_keys($framework->getLocations());
238 - $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
231 + $framework = new $frameworkClass(new Package('dummy/pkg', '1.0.0.0', '1.0.0'), $this->composer, $this->getIO());
232 + $locations = array_keys($framework->getLocations($frameworkType));
233 + if ($locations) {
234 + $pattern = '(' . implode('|', $locations) . ')';
235 + }
239 236 }
240 237
241 - return $pattern ? : '(\w+)';
238 + return $pattern ?: '(\w+)';
242 239 }
243 240
244 - /**
245 - * Get I/O object
246 - *
247 - * @return IOInterface
248 - */
249 - private function getIO()
241 + private function getIO(): IOInterface
250 242 {
251 243 return $this->io;
252 244 }
253 245
@@ -258,12 +250,10 @@
258 250 * Globals:
259 251 * - true, "all", and "*" - disable all installers.
260 252 * - false - enable all installers (useful with
261 253 * wikimedia/composer-merge-plugin or similar)
262 - *
263 - * @return void
264 254 */
265 - protected function removeDisabledInstallers()
255 + protected function removeDisabledInstallers(): void
266 256 {
267 257 $extra = $this->composer->getPackage()->getExtra();
268 258
269 259 if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
@@ -284,14 +274,15 @@
284 274 $intersect = array_intersect($all, $disable);
285 275 if (!empty($intersect)) {
286 276 // Disable all installers
287 277 $this->supportedTypes = array();
288 - } else {
289 - // Disable specified installers
290 - foreach ($disable as $key => $installer) {
291 - if (is_string($installer) && key_exists($installer, $this->supportedTypes)) {
292 - unset($this->supportedTypes[$installer]);
293 - }
278 + return;
279 + }
280 +
281 + // Disable specified installers
282 + foreach ($disable as $key => $installer) {
283 + if (is_string($installer) && key_exists($installer, $this->supportedTypes)) {
284 + unset($this->supportedTypes[$installer]);
294 285 }
295 286 }
296 287 }
297 288 }