|
2 | 2 |
|
3 | 3 | namespace Hypernode\DeployConfiguration\ApplicationTemplate; |
4 | 4 |
|
5 | | -use Hypernode\DeployConfiguration\ClusterSharedFolder; |
6 | 5 | use Hypernode\DeployConfiguration\Configuration; |
7 | | -use Hypernode\DeployConfiguration\Command; |
8 | | -use Hypernode\DeployConfiguration\SharedFolder; |
9 | 6 |
|
10 | 7 | class Magento2 extends Configuration |
11 | 8 | { |
12 | 9 | /** |
13 | | - * Magento2 constructor. |
14 | | - * |
15 | | - * @param string $gitRepository |
16 | | - * @param array|null $localesFrontend |
17 | | - * @param array|null $localesBackend |
| 10 | + * @param string[] $locales |
18 | 11 | */ |
19 | | - public function __construct(string $gitRepository, array $localesFrontend, array $localesBackend) |
| 12 | + public function __construct(array $locales) |
20 | 13 | { |
21 | | - parent::__construct($gitRepository); |
| 14 | + parent::__construct(); |
22 | 15 |
|
23 | | - $this->initializeDefaultConfiguration($localesFrontend, $localesBackend); |
| 16 | + $this->initializeDefaultConfiguration($locales); |
24 | 17 | } |
25 | 18 |
|
26 | 19 | /** |
27 | 20 | * Initialize defaults |
28 | 21 | * |
29 | | - * @param array|null $localesFrontend |
30 | | - * @param array|null $localesBackend |
| 22 | + * @param string[] $locales |
31 | 23 | */ |
32 | | - private function initializeDefaultConfiguration(array $localesFrontend = null, array $localesBackend = null): void |
| 24 | + private function initializeDefaultConfiguration(array $locales): void |
33 | 25 | { |
34 | | - $this->setPhpVersion('php71'); |
35 | | - $this->addBuildCommand(new Command\Build\Composer()); |
36 | | - $this->addBuildCommand(new Command\Build\Magento2\SetupDiCompile()); |
37 | | - $this->addBuildCommand(new Command\Build\Magento2\SetupStaticContentDeploy($localesFrontend, 'frontend')); |
38 | | - $this->addBuildCommand(new Command\Build\Magento2\SetupStaticContentDeploy($localesBackend, 'adminhtml')); |
| 26 | + $this->setRecipe('magento2'); |
| 27 | + $this->setVariable('static_content_locales', $locales); |
| 28 | + $this->setVariable('ENV', ['MAGE_MODE' => 'production'], 'build'); |
| 29 | + |
| 30 | + $this->addBuildTask('deploy:vendors'); |
| 31 | + $this->addBuildTask('magento:compile'); |
| 32 | + $this->addBuildTask('magento:deploy:assets'); |
39 | 33 |
|
40 | | - $this->addDeployCommand(new Command\Deploy\Magento2\MaintenanceMode()); |
41 | | - $this->addDeployCommand(new Command\Deploy\Magento2\SetupUpgrade()); |
42 | | - $this->addDeployCommand(new Command\Deploy\Magento2\CacheFlush()); |
| 34 | + $this->addDeployTask('magento:config:import'); |
| 35 | + $this->addDeployTask('magento:upgrade:db'); |
| 36 | + $this->addDeployTask('magento:cache:flush'); |
43 | 37 |
|
44 | 38 | $this->setSharedFiles([ |
45 | 39 | 'app/etc/env.php', |
46 | 40 | 'pub/errors/local.xml', |
| 41 | + 'pub/.user.ini', |
47 | 42 | ]); |
48 | 43 |
|
49 | 44 | $this->setSharedFolders([ |
50 | | - new SharedFolder('var/log'), |
51 | | - new SharedFolder('var/report'), |
52 | | - new ClusterSharedFolder('var/session'), |
53 | | - new ClusterSharedFolder('pub/media'), |
| 45 | + 'var/log', |
| 46 | + 'var/report', |
| 47 | + 'var/session', |
| 48 | + 'pub/media', |
54 | 49 | ]); |
55 | 50 |
|
56 | 51 | $this->addDeployExclude('phpserver/'); |
|
0 commit comments