-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMagento2.php
More file actions
83 lines (71 loc) · 2.61 KB
/
Magento2.php
File metadata and controls
83 lines (71 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
namespace Hypernode\DeployConfiguration\ApplicationTemplate;
use Hypernode\DeployConfiguration\Configuration;
class Magento2 extends Configuration
{
/**
* @param string[] $locales
*/
public function __construct(array $locales)
{
parent::__construct();
$this->initializeDefaultConfiguration($locales);
}
/**
* Initialize defaults
*
* @param string[] $locales
*/
private function initializeDefaultConfiguration(array $locales): void
{
$this->setRecipe('magento2');
$this->setVariable('static_content_locales', implode(' ', $locales));
$this->setVariable('env', ['MAGE_MODE' => 'production'], 'build');
$this->addBuildTask('deploy:vendors');
$this->addBuildTask('magento:compile');
$this->addBuildTask('magento:deploy:assets');
$this->addDeployTask('magento:config:import');
$this->addDeployTask('magento:upgrade:db');
$this->addDeployTask('magento:cache:flush');
$this->setSharedFiles([
'app/etc/env.php',
'pub/errors/local.xml',
'pub/.user.ini',
]);
$this->setSharedFolders([
'var/log',
'var/report',
'var/session',
'pub/media',
]);
$this->addDeployExclude('phpserver/');
$this->addDeployExclude('docker/');
$this->addDeployExclude('dev/');
$this->addDeployExclude('deploy/');
}
/**
* Set Magento themes and optionally allow split static deployment
*
* @param string[]|array<string, string> $themes Array of themes as ['vendor/theme', 'vendor/theme']
* or as ['vendor/theme' => 'nl_NL en_US', 'vendor/theme' => 'nl_NL en_US']
* @param bool $allowSplitStaticDeployment
*/
public function setMagentoThemes(array $themes, bool $allowSplitStaticDeployment = true): void
{
$this->setVariable('magento_themes', $themes);
if (!array_is_list($themes) && $allowSplitStaticDeployment) {
$this->setVariable('split_static_deployment', true);
}
}
/**
* Set Magento backend themes
*
* @param string[]|array<string, string> $themes Array of themes as ['vendor/theme', 'vendor/theme']
* or as ['vendor/theme' => 'nl_NL en_US', 'vendor/theme' => 'nl_NL en_US']
*/
public function setMagentoBackendThemes(array $themes): void
{
$this->setVariable('magento_themes_backend', $themes);
$this->setVariable('split_static_deployment', true);
}
}