woocommerce-multilingual
/
vendor
/
composer
/
installers
/
src
/
Composer
/
Installers
/
BitrixInstaller.php
woocommerce-multilingual
/
vendor
/
composer
/
installers
/
src
/
Composer
/
Installers
Last commit date
AglInstaller.php
1 month ago
AimeosInstaller.php
5 years ago
AnnotateCmsInstaller.php
5 years ago
AsgardInstaller.php
1 month ago
AttogramInstaller.php
5 years ago
BaseInstaller.php
1 month ago
BitrixInstaller.php
1 month ago
BonefishInstaller.php
5 years ago
CakePHPInstaller.php
1 month ago
ChefInstaller.php
5 years ago
CiviCrmInstaller.php
5 years ago
ClanCatsFrameworkInstaller.php
5 years ago
CockpitInstaller.php
1 month ago
CodeIgniterInstaller.php
5 years ago
Concrete5Installer.php
5 years ago
CraftInstaller.php
1 month ago
CroogoInstaller.php
1 month ago
DecibelInstaller.php
1 month ago
DframeInstaller.php
5 years ago
DokuWikiInstaller.php
1 month ago
DolibarrInstaller.php
1 month ago
DrupalInstaller.php
5 years ago
ElggInstaller.php
5 years ago
EliasisInstaller.php
5 years ago
ExpressionEngineInstaller.php
5 years ago
EzPlatformInstaller.php
5 years ago
FuelInstaller.php
5 years ago
FuelphpInstaller.php
5 years ago
GravInstaller.php
1 month ago
HuradInstaller.php
1 month ago
ImageCMSInstaller.php
5 years ago
Installer.php
1 month ago
ItopInstaller.php
5 years ago
JoomlaInstaller.php
1 month ago
KanboardInstaller.php
1 month ago
KirbyInstaller.php
5 years ago
KnownInstaller.php
5 years ago
KodiCMSInstaller.php
5 years ago
KohanaInstaller.php
5 years ago
LanManagementSystemInstaller.php
1 month ago
LaravelInstaller.php
5 years ago
LavaLiteInstaller.php
5 years ago
LithiumInstaller.php
5 years ago
MODULEWorkInstaller.php
5 years ago
MODXEvoInstaller.php
1 month ago
MagentoInstaller.php
5 years ago
MajimaInstaller.php
1 month ago
MakoInstaller.php
5 years ago
MantisBTInstaller.php
1 month ago
MauticInstaller.php
1 month ago
MayaInstaller.php
1 month ago
MediaWikiInstaller.php
1 month ago
MiaoxingInstaller.php
4 years ago
MicroweberInstaller.php
1 month ago
ModxInstaller.php
1 month ago
MoodleInstaller.php
4 years ago
OctoberInstaller.php
1 month ago
OntoWikiInstaller.php
1 month ago
OsclassInstaller.php
5 years ago
OxidInstaller.php
1 month ago
PPIInstaller.php
5 years ago
PantheonInstaller.php
1 month ago
PhiftyInstaller.php
5 years ago
PhpBBInstaller.php
5 years ago
PimcoreInstaller.php
1 month ago
PiwikInstaller.php
1 month ago
PlentymarketsInstaller.php
1 month ago
Plugin.php
5 years ago
PortoInstaller.php
5 years ago
PrestashopInstaller.php
5 years ago
ProcessWireInstaller.php
1 month ago
PuppetInstaller.php
5 years ago
PxcmsInstaller.php
1 month ago
RadPHPInstaller.php
1 month ago
ReIndexInstaller.php
5 years ago
Redaxo5Installer.php
5 years ago
RedaxoInstaller.php
5 years ago
RoundcubeInstaller.php
1 month ago
SMFInstaller.php
5 years ago
ShopwareInstaller.php
1 month ago
SilverStripeInstaller.php
1 month ago
SiteDirectInstaller.php
5 years ago
StarbugInstaller.php
4 years ago
SyDESInstaller.php
1 month ago
SyliusInstaller.php
5 years ago
Symfony1Installer.php
1 month ago
TYPO3CmsInstaller.php
1 month ago
TYPO3FlowInstaller.php
1 month ago
TaoInstaller.php
1 month ago
TastyIgniterInstaller.php
1 month ago
TheliaInstaller.php
5 years ago
TuskInstaller.php
1 month ago
UserFrostingInstaller.php
5 years ago
VanillaInstaller.php
5 years ago
VgmcpInstaller.php
1 month ago
WHMCSInstaller.php
5 years ago
WinterInstaller.php
1 month ago
WolfCMSInstaller.php
5 years ago
WordPressInstaller.php
5 years ago
YawikInstaller.php
1 month ago
ZendInstaller.php
5 years ago
ZikulaInstaller.php
5 years ago
BitrixInstaller.php
93 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Composer\Installers; |
| 4 | |
| 5 | use Composer\Util\Filesystem; |
| 6 | |
| 7 | class BitrixInstaller extends BaseInstaller |
| 8 | { |
| 9 | protected $locations = array( |
| 10 | 'module' => '{$bitrix_dir}/modules/{$name}/', |
| 11 | 'component' => '{$bitrix_dir}/components/{$name}/', |
| 12 | 'theme' => '{$bitrix_dir}/templates/{$name}/', |
| 13 | 'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/', |
| 14 | 'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/', |
| 15 | 'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/', |
| 16 | ); |
| 17 | |
| 18 | private static $checkedDuplicates = array(); |
| 19 | |
| 20 | public function inflectPackageVars($vars) |
| 21 | { |
| 22 | if ($this->composer->getPackage()) { |
| 23 | $extra = $this->composer->getPackage()->getExtra(); |
| 24 | |
| 25 | if (isset($extra['bitrix-dir'])) { |
| 26 | $vars['bitrix_dir'] = $extra['bitrix-dir']; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | if (!isset($vars['bitrix_dir'])) { |
| 31 | $vars['bitrix_dir'] = 'bitrix'; |
| 32 | } |
| 33 | |
| 34 | return parent::inflectPackageVars($vars); |
| 35 | } |
| 36 | |
| 37 | protected function templatePath($path, array $vars = array()) |
| 38 | { |
| 39 | $templatePath = parent::templatePath($path, $vars); |
| 40 | $this->checkDuplicates($templatePath, $vars); |
| 41 | |
| 42 | return $templatePath; |
| 43 | } |
| 44 | |
| 45 | protected function checkDuplicates($path, array $vars = array()) |
| 46 | { |
| 47 | $packageType = substr($vars['type'], strlen('bitrix') + 1); |
| 48 | $localDir = explode('/', $vars['bitrix_dir']); |
| 49 | array_pop($localDir); |
| 50 | $localDir[] = 'local'; |
| 51 | $localDir = implode('/', $localDir); |
| 52 | |
| 53 | $oldPath = str_replace( |
| 54 | array('{$bitrix_dir}', '{$name}'), |
| 55 | array($localDir, $vars['name']), |
| 56 | $this->locations[$packageType] |
| 57 | ); |
| 58 | |
| 59 | if (in_array($oldPath, static::$checkedDuplicates)) { |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) { |
| 64 | |
| 65 | $this->io->writeError(' <error>Duplication of packages:</error>'); |
| 66 | $this->io->writeError(' <info>Package ' . $oldPath . ' will be called instead package ' . $path . '</info>'); |
| 67 | |
| 68 | while (true) { |
| 69 | switch ($this->io->ask(' <info>Delete ' . $oldPath . ' [y,n,?]?</info> ', '?')) { |
| 70 | case 'y': |
| 71 | $fs = new Filesystem(); |
| 72 | $fs->removeDirectory($oldPath); |
| 73 | break 2; |
| 74 | |
| 75 | case 'n': |
| 76 | break 2; |
| 77 | |
| 78 | case '?': |
| 79 | default: |
| 80 | $this->io->writeError(array( |
| 81 | ' y - delete package ' . $oldPath . ' and to continue with the installation', |
| 82 | ' n - don\'t delete and to continue with the installation', |
| 83 | )); |
| 84 | $this->io->writeError(' ? - print help'); |
| 85 | break; |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | static::$checkedDuplicates[] = $oldPath; |
| 91 | } |
| 92 | } |
| 93 |