@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | */ |
59 | 59 | set('cachetool_url', 'https://github.com/gordalina/cachetool/releases/download/9.1.0/cachetool.phar'); |
60 | 60 | set('cachetool_args', ''); |
61 | -set('bin/cachetool', function () { |
|
61 | +set('bin/cachetool', function() { |
|
62 | 62 | if (!test('[ -f {{release_or_current_path}}/cachetool.phar ]')) { |
63 | 63 | run("cd {{release_or_current_path}} && curl -sLO {{cachetool_url}}"); |
64 | 64 | } |
65 | 65 | return '{{release_or_current_path}}/cachetool.phar'; |
66 | 66 | }); |
67 | -set('cachetool_options', function () { |
|
67 | +set('cachetool_options', function() { |
|
68 | 68 | $options = (array) get('cachetool'); |
69 | 69 | $fullOptions = (string) get('cachetool_args'); |
70 | 70 | $return = []; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * Clear opcache cache |
87 | 87 | */ |
88 | 88 | desc('Clears OPcode cache'); |
89 | -task('cachetool:clear:opcache', function () { |
|
89 | +task('cachetool:clear:opcache', function() { |
|
90 | 90 | $options = get('cachetool_options'); |
91 | 91 | foreach ($options as $option) { |
92 | 92 | run("cd {{release_or_current_path}} && {{bin/php}} {{bin/cachetool}} opcache:reset $option"); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * Clear APCu cache |
98 | 98 | */ |
99 | 99 | desc('Clears APCu system cache'); |
100 | -task('cachetool:clear:apcu', function () { |
|
100 | +task('cachetool:clear:apcu', function() { |
|
101 | 101 | $options = get('cachetool_options'); |
102 | 102 | foreach ($options as $option) { |
103 | 103 | run("cd {{release_or_current_path}} && {{bin/php}} {{bin/cachetool}} apcu:cache:clear $option"); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * Clear file status cache, including the realpath cache |
109 | 109 | */ |
110 | 110 | desc('Clears file status and realpath caches'); |
111 | -task('cachetool:clear:stat', function () { |
|
111 | +task('cachetool:clear:stat', function() { |
|
112 | 112 | $options = get('cachetool_options'); |
113 | 113 | foreach ($options as $option) { |
114 | 114 | run("cd {{release_or_current_path}} && {{bin/php}} {{bin/cachetool}} stat:clear $option"); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | set('dotenv_example', '.env.example'); |
6 | 6 | |
7 | 7 | desc('Configure .env file'); |
8 | -task('deploy:env', function () { |
|
8 | +task('deploy:env', function() { |
|
9 | 9 | cd('{{release_or_current_path}}'); |
10 | 10 | if (test('[ ! -e .env ] && [ -f {{dotenv_example}} ]')) { |
11 | 11 | run('cp {{dotenv_example}} .env'); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | // Used in `chown` and `acl` modes of {{writable_mode}}. |
7 | 7 | // Attempts automatically to detect http user in process list. |
8 | 8 | |
9 | -set('http_user', function () { |
|
9 | +set('http_user', function() { |
|
10 | 10 | $candidates = explode("\n", run("ps axo comm,user | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | sort | awk '{print \$NF}' | uniq")); |
11 | 11 | $httpUser = array_shift($candidates); |
12 | 12 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // Used to make a writable directory by a server. |
24 | 24 | // Used in `chgrp` mode of {{writable_mode}} only. |
25 | 25 | // Attempts automatically to detect http user in process list. |
26 | -set('http_group', function () { |
|
26 | +set('http_group', function() { |
|
27 | 27 | $candidates = explode("\n", run("ps axo comm,group | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | sort | awk '{print \$NF}' | uniq")); |
28 | 28 | $httpGroup = array_shift($candidates); |
29 | 29 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | set('writable_acl_groups', []); |
63 | 63 | |
64 | 64 | desc('Makes writable dirs'); |
65 | -task('deploy:writable', function () { |
|
65 | +task('deploy:writable', function() { |
|
66 | 66 | $dirs = join(' ', get('writable_dirs')); |
67 | 67 | $mode = get('writable_mode'); |
68 | 68 | $recursive = get('writable_recursive') ? '-R' : ''; |
@@ -13,13 +13,13 @@ |
||
13 | 13 | add('writable_dirs', ['public/var', 'var/cache/dev']); |
14 | 14 | |
15 | 15 | desc('Rebuilds Pimcore Classes'); |
16 | -task('pimcore:rebuild-classes', function () { |
|
16 | +task('pimcore:rebuild-classes', function() { |
|
17 | 17 | run('{{bin/console}} pimcore:build:classes'); |
18 | 18 | run('{{bin/console}} pimcore:deployment:classes-rebuild --create-classes --delete-classes --no-interaction'); |
19 | 19 | }); |
20 | 20 | |
21 | 21 | desc('Removes cache'); |
22 | -task('pimcore:cache_clear', function () { |
|
22 | +task('pimcore:cache_clear', function() { |
|
23 | 23 | run('rm -rf {{release_or_current_path}}/var/cache/dev/*'); |
24 | 24 | }); |
25 | 25 |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | use function Deployer\Support\escape_shell_argument; |
28 | 28 | |
29 | 29 | // Get path to bin |
30 | -set('bin/crontab', function () { |
|
30 | +set('bin/crontab', function() { |
|
31 | 31 | return which('crontab'); |
32 | 32 | }); |
33 | 33 | |
34 | 34 | // Set the identifier used in the crontab, application name by default |
35 | -set('crontab:identifier', function () { |
|
35 | +set('crontab:identifier', function() { |
|
36 | 36 | return get('application', 'application'); |
37 | 37 | }); |
38 | 38 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | set('crontab:use_sudo', false); |
41 | 41 | |
42 | 42 | desc('Sync crontab jobs'); |
43 | -task('crontab:sync', function () { |
|
43 | +task('crontab:sync', function() { |
|
44 | 44 | $cronJobsLocal = array_map( |
45 | 45 | fn($job) => parse($job), |
46 | 46 | get('crontab:jobs', []), |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | }); |
85 | 85 | |
86 | 86 | desc('Remove crontab jobs'); |
87 | -task('crontab:remove', function () { |
|
87 | +task('crontab:remove', function() { |
|
88 | 88 | $cronJobsLocal = array_map( |
89 | 89 | fn($job) => parse($job), |
90 | 90 | get('crontab:jobs', []), |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | // Name of lsb_release like: focal, bionic, etc. |
18 | 18 | // As only Ubuntu 20.04 LTS is supported for provision should be the `focal`. |
19 | -set('lsb_release', function () { |
|
19 | +set('lsb_release', function() { |
|
20 | 20 | return run("lsb_release -s -c"); |
21 | 21 | }); |
22 | 22 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | set('provision_user', 'root'); |
44 | 44 | |
45 | 45 | desc('Checks pre-required state'); |
46 | -task('provision:check', function () { |
|
46 | +task('provision:check', function() { |
|
47 | 47 | set('remote_user', get('provision_user')); |
48 | 48 | |
49 | 49 | $release = run('cat /etc/os-release'); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | })->oncePerNode(); |
69 | 69 | |
70 | 70 | desc('Collects required params'); |
71 | -task('provision:configure', function () { |
|
71 | +task('provision:configure', function() { |
|
72 | 72 | set('remote_user', get('provision_user')); |
73 | 73 | |
74 | 74 | $params = [ |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | |
122 | 122 | desc('Adds repositories and update'); |
123 | -task('provision:update', function () { |
|
123 | +task('provision:update', function() { |
|
124 | 124 | set('remote_user', get('provision_user')); |
125 | 125 | |
126 | 126 | // Update before installing anything |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | ->verbose(); |
147 | 147 | |
148 | 148 | desc('Upgrades all packages'); |
149 | -task('provision:upgrade', function () { |
|
149 | +task('provision:upgrade', function() { |
|
150 | 150 | set('remote_user', get('provision_user')); |
151 | 151 | run('apt-get upgrade -y', env: ['DEBIAN_FRONTEND' => 'noninteractive'], timeout: 900); |
152 | 152 | }) |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | ->verbose(); |
155 | 155 | |
156 | 156 | desc('Installs packages'); |
157 | -task('provision:install', function () { |
|
157 | +task('provision:install', function() { |
|
158 | 158 | set('remote_user', get('provision_user')); |
159 | 159 | $packages = [ |
160 | 160 | 'acl', |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | ->oncePerNode(); |
190 | 190 | |
191 | 191 | desc('Configures the ssh'); |
192 | -task('provision:ssh', function () { |
|
192 | +task('provision:ssh', function() { |
|
193 | 193 | set('remote_user', get('provision_user')); |
194 | 194 | run("sed -i 's/PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config"); |
195 | 195 | run('ssh-keygen -A'); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | })->oncePerNode(); |
202 | 202 | |
203 | 203 | desc('Setups a firewall'); |
204 | -task('provision:firewall', function () { |
|
204 | +task('provision:firewall', function() { |
|
205 | 205 | set('remote_user', get('provision_user')); |
206 | 206 | run('ufw allow 22'); |
207 | 207 | run('ufw allow 80'); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | })->oncePerNode(); |
211 | 211 | |
212 | 212 | desc('Verifies what provision was successful'); |
213 | -task('provision:verify', function () { |
|
213 | +task('provision:verify', function() { |
|
214 | 214 | fetch('{{domain}}', 'get', [], null, $info, true); |
215 | 215 | if ($info['http_code'] === 404) { |
216 | 216 | info("provisioned successfully!"); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | ]); |
23 | 23 | set('log_files', 'storage/logs/*.log'); |
24 | 24 | set('bin/artisan', '{{release_or_current_path}}/artisan'); |
25 | -set('laravel_version', function () { |
|
25 | +set('laravel_version', function() { |
|
26 | 26 | $result = run("{{bin/php}} {{bin/artisan}} --version"); |
27 | 27 | preg_match_all('/(\d+\.?)+/', $result, $matches); |
28 | 28 | return $matches[0][0] ?? 5.5; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | function artisan($command, $options = []) |
47 | 47 | { |
48 | - return function () use ($command, $options) { |
|
48 | + return function() use ($command, $options) { |
|
49 | 49 | |
50 | 50 | // Ensure the artisan command is available on the current version. |
51 | 51 | $versionTooEarly = array_key_exists('min', $options) |
@@ -32,14 +32,14 @@ |
||
32 | 32 | namespace Deployer; |
33 | 33 | |
34 | 34 | // Automatically detects by using {{bin/php}}. |
35 | -set('php_fpm_version', function () { |
|
35 | +set('php_fpm_version', function() { |
|
36 | 36 | return run('{{bin/php}} -r "printf(\'%d.%d\', PHP_MAJOR_VERSION, PHP_MINOR_VERSION);"'); |
37 | 37 | }); |
38 | 38 | |
39 | 39 | set('php_fpm_service', 'php{{php_fpm_version}}-fpm'); |
40 | 40 | |
41 | 41 | desc('Reloads the php-fpm service'); |
42 | -task('php-fpm:reload', function () { |
|
42 | +task('php-fpm:reload', function() { |
|
43 | 43 | warning('Avoid reloading php-fpm [deployer.org/docs/8.x/avoid-php-fpm-reloading]'); |
44 | 44 | run('sudo systemctl reload {{php_fpm_service}}'); |
45 | 45 | }); |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | ]); |
75 | 75 | |
76 | 76 | // This sets the Shopware version to the version of the Shopware console command. |
77 | -set('shopware_version', function () { |
|
77 | +set('shopware_version', function() { |
|
78 | 78 | $versionOutput = run('cd {{release_path}} && {{bin/console}} -V'); |
79 | 79 | preg_match('/(\d+\.\d+\.\d+\.\d+)/', $versionOutput, $matches); |
80 | 80 | return $matches[0] ?? '6.6.0'; |
81 | 81 | }); |
82 | 82 | |
83 | 83 | // This task remotely executes the `cache:clear` console command on the target server. |
84 | -task('sw:cache:clear', static function () { |
|
84 | +task('sw:cache:clear', static function() { |
|
85 | 85 | run('cd {{release_path}} && {{bin/console}} cache:clear --no-warmup'); |
86 | 86 | }); |
87 | 87 | |
88 | 88 | // This task remotely executes the cache warmup console commands on the target server, so that the first user, who |
89 | 89 | // visits the website, doesn't have to wait for the cache to be built up. |
90 | -task('sw:cache:warmup', static function () { |
|
90 | +task('sw:cache:warmup', static function() { |
|
91 | 91 | run('cd {{release_path}} && {{bin/console}} cache:warmup'); |
92 | 92 | |
93 | 93 | // Shopware 6.6+ dropped support for the http:cache:warmup command, so only execute it if the version is less than 6.6 |
@@ -97,25 +97,25 @@ discard block |
||
97 | 97 | }); |
98 | 98 | |
99 | 99 | // This task remotely executes the `database:migrate` console command on the target server. |
100 | -task('sw:database:migrate', static function () { |
|
100 | +task('sw:database:migrate', static function() { |
|
101 | 101 | run('cd {{release_path}} && {{bin/console}} database:migrate --all'); |
102 | 102 | }); |
103 | 103 | |
104 | -task('sw:plugin:refresh', function () { |
|
104 | +task('sw:plugin:refresh', function() { |
|
105 | 105 | run('cd {{release_path}} && {{bin/console}} plugin:refresh'); |
106 | 106 | }); |
107 | 107 | |
108 | -task('sw:scheduled-task:register', function () { |
|
108 | +task('sw:scheduled-task:register', function() { |
|
109 | 109 | run('cd {{release_path}} && {{bin/console}} scheduled-task:register'); |
110 | 110 | }); |
111 | 111 | |
112 | -task('sw:theme:refresh', function () { |
|
112 | +task('sw:theme:refresh', function() { |
|
113 | 113 | run('cd {{release_path}} && {{bin/console}} theme:refresh'); |
114 | 114 | }); |
115 | 115 | |
116 | 116 | // This task is not used by default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`, |
117 | 117 | // to build the theme remotely instead of locally. |
118 | -task('sw:theme:compile', function () { |
|
118 | +task('sw:theme:compile', function() { |
|
119 | 119 | run('cd {{release_path}} && {{bin/console}} theme:compile'); |
120 | 120 | }); |
121 | 121 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return $plugins; |
128 | 128 | } |
129 | 129 | |
130 | -task('sw:plugin:update:all', static function () { |
|
130 | +task('sw:plugin:update:all', static function() { |
|
131 | 131 | $plugins = getPlugins(); |
132 | 132 | foreach ($plugins as $plugin) { |
133 | 133 | if ($plugin->installedAt && $plugin->upgradeVersion) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | }); |
139 | 139 | |
140 | -task('sw:writable:jwt', static function () { |
|
140 | +task('sw:writable:jwt', static function() { |
|
141 | 141 | if (!test('[ -d {{deploy_path}}/config/jwt/ ]')) { |
142 | 142 | return; |
143 | 143 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | 'deploy:publish', |
168 | 168 | ]); |
169 | 169 | |
170 | -task('deploy:update_code')->setCallback(static function () { |
|
170 | +task('deploy:update_code')->setCallback(static function() { |
|
171 | 171 | upload('.', '{{release_path}}', [ |
172 | 172 | 'options' => [ |
173 | 173 | '--exclude=.git', |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | ]); |
178 | 178 | }); |
179 | 179 | |
180 | -task('sw-build-without-db:get-remote-config', static function () { |
|
180 | +task('sw-build-without-db:get-remote-config', static function() { |
|
181 | 181 | if (!test('[ -d {{current_path}} ]')) { |
182 | 182 | return; |
183 | 183 | } |
184 | - within('{{current_path}}', function () { |
|
184 | + within('{{current_path}}', function() { |
|
185 | 185 | run('{{bin/php}} ./bin/console bundle:dump'); |
186 | 186 | download('{{current_path}}/var/plugins.json', './var/'); |
187 | 187 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | }); |
191 | 191 | }); |
192 | 192 | |
193 | -task('sw-build-without-db:build', static function () { |
|
193 | +task('sw-build-without-db:build', static function() { |
|
194 | 194 | runLocally('CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=1 ./bin/build-js.sh'); |
195 | 195 | }); |
196 | 196 |