Mercurial > hg > isophonics-drupal-site
annotate vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php @ 7:848c88cfe644
More layout
author | Chris Cannam |
---|---|
date | Fri, 05 Jan 2018 13:59:44 +0000 |
parents | 4c8ae668cc8c |
children | 7a779792577d |
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 } else { |
Chris@0 | 32 return parent::getInstallPath($package, $frameworkType); |
Chris@0 | 33 } |
Chris@0 | 34 |
Chris@0 | 35 } |
Chris@0 | 36 } |