Mercurial > hg > isophonics-drupal-site
annotate vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 7a779792577d |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 namespace Composer\Installers; |
Chris@0 | 3 |
Chris@0 | 4 use Composer\Package\PackageInterface; |
Chris@0 | 5 |
Chris@0 | 6 class SilverStripeInstaller extends BaseInstaller |
Chris@0 | 7 { |
Chris@0 | 8 protected $locations = array( |
Chris@0 | 9 'module' => '{$name}/', |
Chris@0 | 10 'theme' => 'themes/{$name}/', |
Chris@0 | 11 ); |
Chris@0 | 12 |
Chris@0 | 13 /** |
Chris@0 | 14 * Return the install path based on package type. |
Chris@0 | 15 * |
Chris@0 | 16 * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework |
Chris@0 | 17 * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0 |
Chris@0 | 18 * |
Chris@0 | 19 * @param PackageInterface $package |
Chris@0 | 20 * @param string $frameworkType |
Chris@0 | 21 * @return string |
Chris@0 | 22 */ |
Chris@0 | 23 public function getInstallPath(PackageInterface $package, $frameworkType = '') |
Chris@0 | 24 { |
Chris@0 | 25 if ( |
Chris@0 | 26 $package->getName() == 'silverstripe/framework' |
Chris@0 | 27 && preg_match('/^\d+\.\d+\.\d+/', $package->getVersion()) |
Chris@0 | 28 && version_compare($package->getVersion(), '2.999.999') < 0 |
Chris@0 | 29 ) { |
Chris@0 | 30 return $this->templatePath($this->locations['module'], array('name' => 'sapphire')); |
Chris@0 | 31 } |
Chris@0 | 32 |
Chris@12 | 33 return parent::getInstallPath($package, $frameworkType); |
Chris@0 | 34 } |
Chris@0 | 35 } |