ComposerInstallersOxidInstaller

The WooCommerce Multilingual Composer Installers OxidInstaller class.

Defined (1)

The class is defined in the following location(s).

/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php  
  1. class OxidInstaller extends BaseInstaller 
  2. const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/'; 
  3.  
  4. protected $locations = array( 
  5. 'module' => 'modules/{$name}/',  
  6. 'theme' => 'application/views/{$name}/',  
  7. 'out' => 'out/{$name}/',  
  8. ); 
  9.  
  10. /** 
  11. * getInstallPath 
  12. * @param PackageInterface $package 
  13. * @param string $frameworkType 
  14. * @return void 
  15. */ 
  16. public function getInstallPath(PackageInterface $package, $frameworkType = '') 
  17. $installPath = parent::getInstallPath($package, $frameworkType); 
  18. $type = $this->package->getType(); 
  19. if ($type === 'oxid-module') { 
  20. $this->prepareVendorDirectory($installPath); 
  21. return $installPath; 
  22.  
  23. /** 
  24. * prepareVendorDirectory 
  25. * Makes sure there is a vendormetadata.php file inside 
  26. * the vendor folder if there is a vendor folder. 
  27. * @param string $installPath 
  28. * @return void 
  29. */ 
  30. protected function prepareVendorDirectory($installPath) 
  31. $matches = ''; 
  32. $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches); 
  33. if (!$hasVendorDirectory) { 
  34. return; 
  35.  
  36. $vendorDirectory = $matches['vendor']; 
  37. $vendorPath = getcwd() . '/modules/' . $vendorDirectory; 
  38. if (!file_exists($vendorPath)) { 
  39. mkdir($vendorPath, 0755, true); 
  40.  
  41. $vendorMetaDataPath = $vendorPath . '/vendormetadata.php'; 
  42. touch($vendorMetaDataPath);