PluginProbe ʕ •ᴥ•ʔ
Presto Player / trunk
Presto Player vtrunk
4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / vendor / composer / installers / src / Composer / Installers / Installer.php
presto-player / vendor / composer / installers / src / Composer / Installers Last commit date
AglInstaller.php 4 years ago AkauntingInstaller.php 4 years ago AnnotateCmsInstaller.php 4 years ago AsgardInstaller.php 4 years ago AttogramInstaller.php 4 years ago BaseInstaller.php 4 years ago BitrixInstaller.php 4 years ago BonefishInstaller.php 4 years ago BotbleInstaller.php 11 months ago CakePHPInstaller.php 11 months ago ChefInstaller.php 4 years ago CiviCrmInstaller.php 4 years ago ClanCatsFrameworkInstaller.php 4 years ago CockpitInstaller.php 4 years ago CodeIgniterInstaller.php 4 years ago Concrete5Installer.php 4 years ago ConcreteCMSInstaller.php 11 months ago CroogoInstaller.php 4 years ago DecibelInstaller.php 4 years ago DframeInstaller.php 4 years ago DokuWikiInstaller.php 4 years ago DolibarrInstaller.php 4 years ago DrupalInstaller.php 11 months ago ElggInstaller.php 4 years ago EliasisInstaller.php 4 years ago ExpressionEngineInstaller.php 4 years ago EzPlatformInstaller.php 4 years ago ForkCMSInstaller.php 11 months ago FuelInstaller.php 4 years ago FuelphpInstaller.php 4 years ago GravInstaller.php 4 years ago HuradInstaller.php 4 years ago ImageCMSInstaller.php 4 years ago Installer.php 11 months ago ItopInstaller.php 4 years ago KanboardInstaller.php 4 years ago KnownInstaller.php 4 years ago KodiCMSInstaller.php 4 years ago KohanaInstaller.php 4 years ago LanManagementSystemInstaller.php 4 years ago LaravelInstaller.php 4 years ago LavaLiteInstaller.php 4 years ago LithiumInstaller.php 4 years ago MODULEWorkInstaller.php 4 years ago MODXEvoInstaller.php 4 years ago MagentoInstaller.php 4 years ago MajimaInstaller.php 4 years ago MakoInstaller.php 4 years ago MantisBTInstaller.php 4 years ago MatomoInstaller.php 2 years ago MauticInstaller.php 4 years ago MayaInstaller.php 4 years ago MediaWikiInstaller.php 4 years ago MiaoxingInstaller.php 4 years ago MicroweberInstaller.php 4 years ago ModxInstaller.php 4 years ago MoodleInstaller.php 11 months ago OctoberInstaller.php 4 years ago OntoWikiInstaller.php 4 years ago OsclassInstaller.php 4 years ago OxidInstaller.php 4 years ago PPIInstaller.php 4 years ago PantheonInstaller.php 4 years ago PhiftyInstaller.php 4 years ago PhpBBInstaller.php 4 years ago PiwikInstaller.php 4 years ago PlentymarketsInstaller.php 4 years ago Plugin.php 4 years ago PortoInstaller.php 4 years ago PrestashopInstaller.php 4 years ago ProcessWireInstaller.php 4 years ago PuppetInstaller.php 4 years ago PxcmsInstaller.php 4 years ago RadPHPInstaller.php 4 years ago ReIndexInstaller.php 4 years ago Redaxo5Installer.php 4 years ago RedaxoInstaller.php 4 years ago RoundcubeInstaller.php 4 years ago SMFInstaller.php 4 years ago ShopwareInstaller.php 4 years ago SilverStripeInstaller.php 4 years ago SiteDirectInstaller.php 4 years ago StarbugInstaller.php 4 years ago SyDESInstaller.php 4 years ago SyliusInstaller.php 4 years ago TaoInstaller.php 4 years ago TastyIgniterInstaller.php 4 years ago TheliaInstaller.php 4 years ago TuskInstaller.php 4 years ago UserFrostingInstaller.php 4 years ago VanillaInstaller.php 4 years ago VgmcpInstaller.php 4 years ago WHMCSInstaller.php 4 years ago WinterInstaller.php 4 years ago WolfCMSInstaller.php 4 years ago WordPressInstaller.php 4 years ago YawikInstaller.php 4 years ago ZendInstaller.php 4 years ago ZikulaInstaller.php 4 years ago
Installer.php
289 lines
1 <?php
2
3 namespace Composer\Installers;
4
5 use Composer\Composer;
6 use Composer\Installer\BinaryInstaller;
7 use Composer\Installer\LibraryInstaller;
8 use Composer\IO\IOInterface;
9 use Composer\Package\Package;
10 use Composer\Package\PackageInterface;
11 use Composer\Repository\InstalledRepositoryInterface;
12 use Composer\Util\Filesystem;
13 use React\Promise\PromiseInterface;
14
15 class Installer extends LibraryInstaller
16 {
17 /**
18 * Package types to installer class map
19 *
20 * @var array<string, string>
21 */
22 private $supportedTypes = array(
23 'akaunting' => 'AkauntingInstaller',
24 'asgard' => 'AsgardInstaller',
25 'attogram' => 'AttogramInstaller',
26 'agl' => 'AglInstaller',
27 'annotatecms' => 'AnnotateCmsInstaller',
28 'bitrix' => 'BitrixInstaller',
29 'botble' => 'BotbleInstaller',
30 'bonefish' => 'BonefishInstaller',
31 'cakephp' => 'CakePHPInstaller',
32 'chef' => 'ChefInstaller',
33 'civicrm' => 'CiviCrmInstaller',
34 'ccframework' => 'ClanCatsFrameworkInstaller',
35 'cockpit' => 'CockpitInstaller',
36 'codeigniter' => 'CodeIgniterInstaller',
37 'concrete5' => 'Concrete5Installer',
38 'concretecms' => 'ConcreteCMSInstaller',
39 'croogo' => 'CroogoInstaller',
40 'dframe' => 'DframeInstaller',
41 'dokuwiki' => 'DokuWikiInstaller',
42 'dolibarr' => 'DolibarrInstaller',
43 'decibel' => 'DecibelInstaller',
44 'drupal' => 'DrupalInstaller',
45 'elgg' => 'ElggInstaller',
46 'eliasis' => 'EliasisInstaller',
47 'ee3' => 'ExpressionEngineInstaller',
48 'ee2' => 'ExpressionEngineInstaller',
49 'ezplatform' => 'EzPlatformInstaller',
50 'fork' => 'ForkCMSInstaller',
51 'fuel' => 'FuelInstaller',
52 'fuelphp' => 'FuelphpInstaller',
53 'grav' => 'GravInstaller',
54 'hurad' => 'HuradInstaller',
55 'tastyigniter' => 'TastyIgniterInstaller',
56 'imagecms' => 'ImageCMSInstaller',
57 'itop' => 'ItopInstaller',
58 'kanboard' => 'KanboardInstaller',
59 'known' => 'KnownInstaller',
60 'kodicms' => 'KodiCMSInstaller',
61 'kohana' => 'KohanaInstaller',
62 'lms' => 'LanManagementSystemInstaller',
63 'laravel' => 'LaravelInstaller',
64 'lavalite' => 'LavaLiteInstaller',
65 'lithium' => 'LithiumInstaller',
66 'magento' => 'MagentoInstaller',
67 'majima' => 'MajimaInstaller',
68 'mantisbt' => 'MantisBTInstaller',
69 'mako' => 'MakoInstaller',
70 'matomo' => 'MatomoInstaller',
71 'maya' => 'MayaInstaller',
72 'mautic' => 'MauticInstaller',
73 'mediawiki' => 'MediaWikiInstaller',
74 'miaoxing' => 'MiaoxingInstaller',
75 'microweber' => 'MicroweberInstaller',
76 'modulework' => 'MODULEWorkInstaller',
77 'modx' => 'ModxInstaller',
78 'modxevo' => 'MODXEvoInstaller',
79 'moodle' => 'MoodleInstaller',
80 'october' => 'OctoberInstaller',
81 'ontowiki' => 'OntoWikiInstaller',
82 'oxid' => 'OxidInstaller',
83 'osclass' => 'OsclassInstaller',
84 'pxcms' => 'PxcmsInstaller',
85 'phpbb' => 'PhpBBInstaller',
86 'piwik' => 'PiwikInstaller',
87 'plentymarkets'=> 'PlentymarketsInstaller',
88 'ppi' => 'PPIInstaller',
89 'puppet' => 'PuppetInstaller',
90 'radphp' => 'RadPHPInstaller',
91 'phifty' => 'PhiftyInstaller',
92 'porto' => 'PortoInstaller',
93 'processwire' => 'ProcessWireInstaller',
94 'quicksilver' => 'PantheonInstaller',
95 'redaxo' => 'RedaxoInstaller',
96 'redaxo5' => 'Redaxo5Installer',
97 'reindex' => 'ReIndexInstaller',
98 'roundcube' => 'RoundcubeInstaller',
99 'shopware' => 'ShopwareInstaller',
100 'sitedirect' => 'SiteDirectInstaller',
101 'silverstripe' => 'SilverStripeInstaller',
102 'smf' => 'SMFInstaller',
103 'starbug' => 'StarbugInstaller',
104 'sydes' => 'SyDESInstaller',
105 'sylius' => 'SyliusInstaller',
106 'tao' => 'TaoInstaller',
107 'thelia' => 'TheliaInstaller',
108 'tusk' => 'TuskInstaller',
109 'userfrosting' => 'UserFrostingInstaller',
110 'vanilla' => 'VanillaInstaller',
111 'whmcs' => 'WHMCSInstaller',
112 'winter' => 'WinterInstaller',
113 'wolfcms' => 'WolfCMSInstaller',
114 'wordpress' => 'WordPressInstaller',
115 'yawik' => 'YawikInstaller',
116 'zend' => 'ZendInstaller',
117 'zikula' => 'ZikulaInstaller',
118 'prestashop' => 'PrestashopInstaller'
119 );
120
121 /**
122 * Disables installers specified in main composer extra installer-disable
123 * list
124 */
125 public function __construct(
126 IOInterface $io,
127 Composer $composer,
128 string $type = 'library',
129 ?Filesystem $filesystem = null,
130 ?BinaryInstaller $binaryInstaller = null
131 ) {
132 parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
133 $this->removeDisabledInstallers();
134 }
135
136 /**
137 * {@inheritDoc}
138 */
139 public function getInstallPath(PackageInterface $package)
140 {
141 $type = $package->getType();
142 $frameworkType = $this->findFrameworkType($type);
143
144 if ($frameworkType === false) {
145 throw new \InvalidArgumentException(
146 'Sorry the package type of this package is not yet supported.'
147 );
148 }
149
150 $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
151 /**
152 * @var BaseInstaller
153 */
154 $installer = new $class($package, $this->composer, $this->getIO());
155
156 $path = $installer->getInstallPath($package, $frameworkType);
157 if (!$this->filesystem->isAbsolutePath($path)) {
158 $path = getcwd() . '/' . $path;
159 }
160
161 return $path;
162 }
163
164 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
165 {
166 $installPath = $this->getPackageBasePath($package);
167 $io = $this->io;
168 $outputStatus = function () use ($io, $installPath) {
169 $io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
170 };
171
172 $promise = parent::uninstall($repo, $package);
173
174 // Composer v2 might return a promise here
175 if ($promise instanceof PromiseInterface) {
176 return $promise->then($outputStatus);
177 }
178
179 // If not, execute the code right away as parent::uninstall executed synchronously (composer v1, or v2 without async)
180 $outputStatus();
181
182 return null;
183 }
184
185 /**
186 * {@inheritDoc}
187 *
188 * @param string $packageType
189 */
190 public function supports($packageType)
191 {
192 $frameworkType = $this->findFrameworkType($packageType);
193
194 if ($frameworkType === false) {
195 return false;
196 }
197
198 $locationPattern = $this->getLocationPattern($frameworkType);
199
200 return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
201 }
202
203 /**
204 * Finds a supported framework type if it exists and returns it
205 *
206 * @return string|false
207 */
208 protected function findFrameworkType(string $type)
209 {
210 krsort($this->supportedTypes);
211
212 foreach ($this->supportedTypes as $key => $val) {
213 if ($key === substr($type, 0, strlen($key))) {
214 return substr($type, 0, strlen($key));
215 }
216 }
217
218 return false;
219 }
220
221 /**
222 * Get the second part of the regular expression to check for support of a
223 * package type
224 */
225 protected function getLocationPattern(string $frameworkType): string
226 {
227 $pattern = null;
228 if (!empty($this->supportedTypes[$frameworkType])) {
229 $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
230 /** @var BaseInstaller $framework */
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 }
236 }
237
238 return $pattern ?: '(\w+)';
239 }
240
241 private function getIO(): IOInterface
242 {
243 return $this->io;
244 }
245
246 /**
247 * Look for installers set to be disabled in composer's extra config and
248 * remove them from the list of supported installers.
249 *
250 * Globals:
251 * - true, "all", and "*" - disable all installers.
252 * - false - enable all installers (useful with
253 * wikimedia/composer-merge-plugin or similar)
254 */
255 protected function removeDisabledInstallers(): void
256 {
257 $extra = $this->composer->getPackage()->getExtra();
258
259 if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
260 // No installers are disabled
261 return;
262 }
263
264 // Get installers to disable
265 $disable = $extra['installer-disable'];
266
267 // Ensure $disabled is an array
268 if (!is_array($disable)) {
269 $disable = array($disable);
270 }
271
272 // Check which installers should be disabled
273 $all = array(true, "all", "*");
274 $intersect = array_intersect($all, $disable);
275 if (!empty($intersect)) {
276 // Disable all installers
277 $this->supportedTypes = array();
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]);
285 }
286 }
287 }
288 }
289