This repository was archived by the owner on Nov 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathshopware.php
More file actions
150 lines (126 loc) · 4.7 KB
/
shopware.php
File metadata and controls
150 lines (126 loc) · 4.7 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
require_once __DIR__ . '/../../deployer/deployer/recipe/common.php';
set('shared_files', ['.htaccess']);
set('shared_dirs', [
'engine/Shopware/Plugins/Community',
'media',
'files'
]);
set('copy_dirs', [
'var/cache',
'web/cache',
]);
set('create_shared_dirs', [
'engine/Shopware/Plugins/Community/Frontend',
'engine/Shopware/Plugins/Community/Core',
'engine/Shopware/Plugins/Community/Backend',
'media/archive',
'media/image',
'media/image/thumbnail',
'media/music',
'media/pdf',
'media/unknown',
'media/video',
'media/temp',
'files/documents',
'files/downloads'
]);
set('writable_dirs', [
'var/cache',
'web/cache',
'engine/Shopware/Plugins/Community',
'recovery',
'themes'
]);
task('deploy:writable:create_dirs', function() {
foreach (get('writable_dirs') as $dir) {
run("cd {{release_path}} && mkdir -p $dir");
}
});
before('deploy:copy_dirs', 'deploy:writable:create_dirs');
set('writable_use_sudo', false);
/**
* Installing vendors tasks.
*/
task('deploy:vendors:recovery', function () {
$composer = env('bin/composer');
$envVars = env('env_vars') ? 'export ' . env('env_vars') . ' &&' : '';
run("cd {{release_path}}/recovery/common && $envVars $composer {{composer_options}}");
})->desc('Installing recovery vendors for shopware');
after('deploy:vendors', 'deploy:vendors:recovery');
task('deploy:shared:sub', function () {
$sharedPath = "{{deploy_path}}/shared";
foreach (get('create_shared_dirs') as $dir) {
// Create shared dir if it does not exist.
run("mkdir -p $sharedPath/$dir");
}
})->desc('Creating shared subdirs');
after('deploy:shared', 'deploy:shared:sub');
task('deploy:prepare:configuration:1', function() {
run("cd {{release_path}} && cp {{deploy_path}}/shared/default.ini ./");
run("cd {{release_path}} && mv ./config.php.dist ./config.php && chmod 777 ./config.php");
});
task('deploy:prepare:configuration:2', function() {
run("cd {{release_path}} && cp {{deploy_path}}/shared/default.ini ./");
run("cd {{release_path}} && mv ./config.php.dist ./config.php && chmod 777 ./config.php");
/**
* Additionally for install needed:
* ALTER TABLE `s_core_snippets` ADD `dirty` INT( 1 ) NOT NULL DEFAULT '0';
* ALTER TABLE `s_core_shops` ADD `always_secure` INT( 1 ) NOT NULL DEFAULT '0';
*/
upload(__DIR__ . '/_sql/install/latest.sql', '{{release_path}}/recovery/install/data/sql/install.sql');
upload(__DIR__ . '/_sql/snippets.sql', '{{release_path}}/recovery/install/data/sql/snippets.sql');
});
task('deploy:install:shop', function() {
run("mysql --defaults-extra-file={{deploy_path}}/shared/default.ini < {{release_path}}/recovery/install/data/sql/install.sql");
run("cd {{release_path}} && php build/ApplyDeltas.php");
run("cd {{release_path}} && php bin/console sw:generate:attributes");
run("cd {{release_path}} && php bin/console sw:theme:initialize");
run("cd {{release_path}} && php bin/console sw:firstrunwizard:disable");
run("mysql --defaults-extra-file={{deploy_path}}/shared/default.ini < {{release_path}}/recovery/install/data/sql/snippets.sql");
run("cd {{release_path}}/recovery/install/data && touch install.lock");
});
after('deploy:prepare:configuration:2', 'deploy:install:shop');
task('shopware:upload-community', function() {
upload('engine/Shopware/Plugins/Community/Backend', '{{deploy_path}}/shared/engine/Shopware/Plugins/Community/Backend');
upload('engine/Shopware/Plugins/Community/Core', '{{deploy_path}}/shared/engine/Shopware/Plugins/Community/Core');
upload('engine/Shopware/Plugins/Community/Frontend', '{{deploy_path}}/shared/engine/Shopware/Plugins/Community/Frontend');
});
before('deploy:symlink', 'shopware:upload-community');
/**
* Main task
*/
task('shopware:install', [
'deploy:prepare',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:writable',
'deploy:prepare:configuration:1',
'deploy:prepare:configuration:2',
'deploy:symlink',
'cleanup',
])->desc('Install a complete new shopware instance');
task('shopware:deploy', [
'deploy:prepare',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:copy_dirs',
'deploy:writable',
'deploy:prepare:configuration:1',
'deploy:symlink',
'cleanup',
])->desc('Deploys a given shopware instance');
task('shopware:deploy:test', [
'deploy:prepare',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:copy_dirs',
'deploy:writable',
'deploy:prepare:configuration:1',
])->desc('Deploys a given shopware instance, without releasing it!');