PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / composer / installers / src / Composer / Installers / OxidInstaller.php

OxidInstaller.php in Depicter — Popup & Slider Builder 1.9.2, at vendor/composer/installers/src/Composer/Installers/OxidInstaller.php

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