PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.3.1
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.3.1
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
imagify / vendor / composer / installers / src / Composer / Installers / OxidInstaller.php

OxidInstaller.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.3.1, at vendor/composer/installers/src/Composer/Installers/OxidInstaller.php

50 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Composer\Installers;
4
5 use Composer\Package\PackageInterface;
6
7 class OxidInstaller extends BaseInstaller
8 {
9 const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
10
11 /** @var array<string, string> */
12 protected $locations = array(
13 'module' => 'modules/{$name}/',
14 'theme' => 'application/views/{$name}/',
15 'out' => 'out/{$name}/',
16 );
17
18 public function getInstallPath(PackageInterface $package, string $frameworkType = ''): string
19 {
20 $installPath = parent::getInstallPath($package, $frameworkType);
21 $type = $this->package->getType();
22 if ($type === 'oxid-module') {
23 $this->prepareVendorDirectory($installPath);
24 }
25 return $installPath;
26 }
27
28 /**
29 * Makes sure there is a vendormetadata.php file inside
30 * the vendor folder if there is a vendor folder.
31 */
32 protected function prepareVendorDirectory(string $installPath): void
33 {
34 $matches = '';
35 $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
36 if (!$hasVendorDirectory) {
37 return;
38 }
39
40 $vendorDirectory = $matches['vendor'];
41 $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
42 if (!file_exists($vendorPath)) {
43 mkdir($vendorPath, 0755, true);
44 }
45
46 $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
47 touch($vendorMetaDataPath);
48 }
49 }
50