PluginProbe
PayPlug for WooCommerce (Official) / 3.1.0
PayPlug for WooCommerce (Official) v3.1.0
3.1.0 3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 All 102 releases
payplug / vendor / composer / installers / src / Composer / Installers / OxidInstaller.php

OxidInstaller.php in PayPlug for WooCommerce (Official) 3.1.0, 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