These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Deployer; |
||
4 | |||
5 | set('repository', '[email protected]:shopware/production.git'); |
||
6 | |||
7 | set('release_name', static function () { |
||
8 | return date('YmdHis'); |
||
9 | }); |
||
10 | |||
11 | set('shared_files', [ |
||
12 | '.env', |
||
13 | ]); |
||
14 | set('shared_dirs', [ |
||
15 | 'custom/plugins', |
||
16 | 'config/jwt', |
||
17 | 'files', |
||
18 | 'var/log', |
||
19 | 'public/media', |
||
20 | 'public/thumbnail', |
||
21 | 'public/sitemap', |
||
22 | ]); |
||
23 | set('writable_dirs', [ |
||
24 | 'custom/plugins', |
||
25 | 'config/jwt', |
||
26 | 'files', |
||
27 | 'var', |
||
28 | 'public/media', |
||
29 | 'public/thumbnail', |
||
30 | 'public/sitemap', |
||
31 | ]); |
||
32 | set('static_folders', []); |
||
33 | |||
34 | task('sw:update_code', static function () { |
||
35 | run('git clone {{repository}} {{release_path}}'); |
||
36 | }); |
||
37 | task('sw:system:install', static function () { |
||
38 | run('cd {{release_path}} && bin/console system:install'); |
||
39 | }); |
||
40 | task('sw:build', static function () { |
||
41 | run('cd {{release_path}}/bin && bash build.sh'); |
||
42 | }); |
||
43 | task('sw:system:setup', static function () { |
||
44 | run('cd {{release_path}} && bin/console system:setup'); |
||
45 | }); |
||
46 | task('sw:theme:compile', static function () { |
||
47 | run('cd {{release_path}} && bin/console theme:compile'); |
||
48 | }); |
||
49 | task('sw:cache:clear', static function () { |
||
50 | run('cd {{release_path}} && bin/console cache:clear'); |
||
51 | }); |
||
52 | task('sw:cache:warmup', static function () { |
||
53 | run('cd {{release_path}} && bin/console cache:warmup'); |
||
54 | run('cd {{release_path}} && bin/console http:cache:warm:up'); |
||
55 | }); |
||
56 | task('sw:database:migrate', static function () { |
||
57 | run('cd {{release_path}} && bin/console database:migrate --all'); |
||
58 | }); |
||
59 | task('sw:plugin:refresh', function (){ |
||
60 | run('cd {{release_path}} && bin/console plugin:refresh'); |
||
61 | }); |
||
62 | task('sw:plugin:activate:all', static function () { |
||
63 | task('sw:plugin:refresh'); |
||
64 | $plugins = explode("\n", run('cd {{release_path}} && bin/console plugin:list')); |
||
65 | |||
66 | // take line over headlines and count "-" to get the size of the cells |
||
67 | $lengths = array_filter(array_map('strlen', explode(' ', $plugins[4]))); |
||
68 | |||
69 | // ignore first seven lines (headline, title, table, ...) |
||
70 | $plugins = array_slice($plugins, 7, -3); |
||
71 | foreach ($plugins as $plugin) { |
||
72 | $pluginParts = []; |
||
73 | foreach ($lengths as $length) { |
||
74 | $pluginParts[] = trim(substr($plugin, 0, $length)); |
||
75 | $plugin = substr($plugin, $length + 1); |
||
76 | } |
||
77 | |||
78 | [ |
||
79 | $plugin, |
||
80 | $label, |
||
0 ignored issues
–
show
|
|||
81 | $version, |
||
0 ignored issues
–
show
|
|||
82 | $upgrade, |
||
0 ignored issues
–
show
|
|||
83 | $version, |
||
84 | $author, |
||
0 ignored issues
–
show
|
|||
85 | $installed, |
||
0 ignored issues
–
show
|
|||
86 | $active, |
||
0 ignored issues
–
show
|
|||
87 | $upgradeable, |
||
0 ignored issues
–
show
The variable
$upgradeable does not exist. Did you forget to declare it?
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.
Loading history...
|
|||
88 | ] = $pluginParts; |
||
89 | |||
90 | if ($installed === 'No' || $active === 'No') { |
||
91 | run("cd {{release_path}} && bin/console plugin:install --activate $plugin"); |
||
92 | } |
||
93 | } |
||
94 | }); |
||
95 | task('sw:plugin:migrate:all', static function(){ |
||
96 | $plugins = explode("\n", run('cd {{release_path}} && bin/console plugin:list')); |
||
97 | |||
98 | // take line over headlines and count "-" to get the size of the cells |
||
99 | $lengths = array_filter(array_map('strlen', explode(' ', $plugins[4]))); |
||
100 | |||
101 | // ignore first seven lines (headline, title, table, ...) |
||
102 | $plugins = array_slice($plugins, 7, -3); |
||
103 | foreach ($plugins as $plugin) { |
||
104 | $pluginParts = []; |
||
105 | foreach ($lengths as $length) { |
||
106 | $pluginParts[] = trim(substr($plugin, 0, $length)); |
||
107 | $plugin = substr($plugin, $length + 1); |
||
108 | } |
||
109 | |||
110 | [ |
||
111 | $plugin, |
||
112 | $label, |
||
0 ignored issues
–
show
|
|||
113 | $version, |
||
0 ignored issues
–
show
|
|||
114 | $upgrade, |
||
0 ignored issues
–
show
|
|||
115 | $version, |
||
116 | $author, |
||
0 ignored issues
–
show
|
|||
117 | $installed, |
||
0 ignored issues
–
show
|
|||
118 | $active, |
||
0 ignored issues
–
show
|
|||
119 | $upgradeable, |
||
0 ignored issues
–
show
The variable
$upgradeable does not exist. Did you forget to declare it?
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.
Loading history...
|
|||
120 | ] = $pluginParts; |
||
121 | |||
122 | if ($installed === 'Yes' || $active === 'Yes') { |
||
123 | run("cd {{release_path}} && bin/console database:migrate --all $plugin || true"); |
||
124 | } |
||
125 | } |
||
126 | }); |
||
127 | |||
128 | /** |
||
129 | * Grouped SW deploy tasks |
||
130 | */ |
||
131 | task('sw:deploy', [ |
||
132 | 'sw:build', |
||
133 | 'sw:plugin:activate:all', |
||
134 | 'sw:database:migrate', |
||
135 | 'sw:plugin:migrate:all', |
||
136 | 'sw:theme:compile', |
||
137 | 'sw:cache:clear', |
||
138 | ]); |
||
139 | |||
140 | /** |
||
141 | * Main task |
||
142 | */ |
||
143 | task('deploy', [ |
||
144 | 'deploy:prepare', |
||
145 | 'deploy:lock', |
||
146 | 'deploy:release', |
||
147 | 'deploy:update_code', |
||
148 | 'deploy:shared', |
||
149 | 'sw:deploy', |
||
150 | 'deploy:writable', |
||
151 | 'deploy:clear_paths', |
||
152 | 'deploy:symlink', |
||
153 | 'deploy:unlock', |
||
154 | 'sw:cache:warmup', |
||
155 | 'cleanup', |
||
156 | 'success', |
||
157 | ])->desc('Deploy your project'); |
||
158 | |||
159 | after('deploy', 'success'); |
||
160 | after('deploy:failed', 'deploy:unlock'); |
||
161 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.