@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * }); |
| 51 | 51 | * ``` |
| 52 | 52 | */ |
| 53 | -function host(string ...$hostname): Host|ObjectProxy |
|
| 53 | +function host(string ...$hostname): Host | ObjectProxy |
|
| 54 | 54 | { |
| 55 | 55 | $deployer = Deployer::get(); |
| 56 | 56 | if (count($hostname) === 1 && $deployer->hosts->has($hostname[0])) { |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $deployer->hosts->set($aliases[0], $host); |
| 71 | 71 | return $host; |
| 72 | 72 | } else { |
| 73 | - $hosts = array_map(function ($hostname) use ($deployer): Host { |
|
| 73 | + $hosts = array_map(function($hostname) use ($deployer): Host { |
|
| 74 | 74 | $host = new Host($hostname); |
| 75 | 75 | $deployer->hosts->set($hostname, $host); |
| 76 | 76 | return $host; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * localhost('ci'); // Alias and hostname will be "ci". |
| 88 | 88 | * ``` |
| 89 | 89 | */ |
| 90 | -function localhost(string ...$hostnames): Localhost|ObjectProxy |
|
| 90 | +function localhost(string ...$hostnames): Localhost | ObjectProxy |
|
| 91 | 91 | { |
| 92 | 92 | $deployer = Deployer::get(); |
| 93 | 93 | $hostnames = Range::expand($hostnames); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $deployer->hosts->set($host->getAlias(), $host); |
| 98 | 98 | return $host; |
| 99 | 99 | } else { |
| 100 | - $hosts = array_map(function ($hostname) use ($deployer): Localhost { |
|
| 100 | + $hosts = array_map(function($hostname) use ($deployer): Localhost { |
|
| 101 | 101 | $host = new Localhost($hostname); |
| 102 | 102 | $deployer->hosts->set($host->getAlias(), $host); |
| 103 | 103 | return $host; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @param callable|array|null $body Callable task, array of other tasks names or nothing to get a defined tasks |
| 184 | 184 | * @return Task |
| 185 | 185 | */ |
| 186 | -function task(string $name, callable|array|null $body = null): Task |
|
| 186 | +function task(string $name, callable | array | null $body = null): Task |
|
| 187 | 187 | { |
| 188 | 188 | $deployer = Deployer::get(); |
| 189 | 189 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @return ?Task |
| 237 | 237 | */ |
| 238 | -function before(string $task, string|callable $do): ?Task |
|
| 238 | +function before(string $task, string | callable $do): ?Task |
|
| 239 | 239 | { |
| 240 | 240 | if (is_closure($do)) { |
| 241 | 241 | $newTask = task("before:$task", $do); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * |
| 256 | 256 | * @return ?Task |
| 257 | 257 | */ |
| 258 | -function after(string $task, string|callable $do): ?Task |
|
| 258 | +function after(string $task, string | callable $do): ?Task |
|
| 259 | 259 | { |
| 260 | 260 | if (is_closure($do)) { |
| 261 | 261 | $newTask = task("after:$task", $do); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @return ?Task |
| 278 | 278 | */ |
| 279 | -function fail(string $task, string|callable $do): ?Task |
|
| 279 | +function fail(string $task, string | callable $do): ?Task |
|
| 280 | 280 | { |
| 281 | 281 | if (is_callable($do)) { |
| 282 | 282 | $newTask = task("fail:$task", $do); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | { |
| 338 | 338 | $currentBecome = get('become'); |
| 339 | 339 | set('become', $user); |
| 340 | - return function () use ($currentBecome) { |
|
| 340 | + return function() use ($currentBecome) { |
|
| 341 | 341 | set('become', $currentBecome); |
| 342 | 342 | }; |
| 343 | 343 | } |
@@ -400,14 +400,14 @@ discard block |
||
| 400 | 400 | ?int $idleTimeout = null, |
| 401 | 401 | ): string { |
| 402 | 402 | $runParams = new RunParams( |
| 403 | - shell: currentHost()->getShell(), |
|
| 404 | - cwd: $cwd ?? has('working_path') ? get('working_path') : null, |
|
| 405 | - env: array_merge_alternate(get('env', []), $env ?? []), |
|
| 406 | - nothrow: $nothrow, |
|
| 407 | - timeout: $timeout ?? get('default_timeout', 300), |
|
| 408 | - idleTimeout: $idleTimeout, |
|
| 409 | - forceOutput: $forceOutput, |
|
| 410 | - secrets: empty($secret) ? null : ['secret' => $secret], |
|
| 403 | + shell : currentHost()->getShell(), |
|
| 404 | + cwd : $cwd ?? has('working_path') ? get('working_path') : null, |
|
| 405 | + env : array_merge_alternate(get('env', []), $env ?? []), |
|
| 406 | + nothrow : $nothrow, |
|
| 407 | + timeout : $timeout ?? get('default_timeout', 300), |
|
| 408 | + idleTimeout : $idleTimeout, |
|
| 409 | + forceOutput : $forceOutput, |
|
| 410 | + secrets : empty($secret) ? null : ['secret' => $secret], |
|
| 411 | 411 | ); |
| 412 | 412 | |
| 413 | 413 | $dotenv = get('dotenv', false); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $runParams->dotenv = $dotenv; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - $run = function (string $command, ?RunParams $params = null) use ($runParams): string { |
|
| 418 | + $run = function(string $command, ?RunParams $params = null) use ($runParams) : string { |
|
| 419 | 419 | $params = $params ?? $runParams; |
| 420 | 420 | $host = currentHost(); |
| 421 | 421 | $command = parse($command); |
@@ -490,14 +490,14 @@ discard block |
||
| 490 | 490 | ?string $shell = null, |
| 491 | 491 | ): string { |
| 492 | 492 | $runParams = new RunParams( |
| 493 | - shell: $shell ?? 'bash -s', |
|
| 494 | - cwd: $cwd, |
|
| 495 | - env: $env, |
|
| 496 | - nothrow: $nothrow, |
|
| 497 | - timeout: $timeout, |
|
| 498 | - idleTimeout: $idleTimeout, |
|
| 499 | - forceOutput: $forceOutput, |
|
| 500 | - secrets: empty($secret) ? null : ['secret' => $secret], |
|
| 493 | + shell : $shell ?? 'bash -s', |
|
| 494 | + cwd : $cwd, |
|
| 495 | + env : $env, |
|
| 496 | + nothrow : $nothrow, |
|
| 497 | + timeout : $timeout, |
|
| 498 | + idleTimeout : $idleTimeout, |
|
| 499 | + forceOutput : $forceOutput, |
|
| 500 | + secrets : empty($secret) ? null : ['secret' => $secret], |
|
| 501 | 501 | ); |
| 502 | 502 | |
| 503 | 503 | $process = Deployer::get()->processRunner; |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $this->pop->command($host, 'run', $command); |
| 39 | 39 | |
| 40 | 40 | $terminalOutput = $this->pop->callback($host, $params->forceOutput); |
| 41 | - $callback = function ($type, $buffer) use ($host, $terminalOutput) { |
|
| 41 | + $callback = function($type, $buffer) use ($host, $terminalOutput) { |
|
| 42 | 42 | $this->logger->printBuffer($host, $type, $buffer); |
| 43 | 43 | $terminalOutput($type, $buffer); |
| 44 | 44 | }; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | ->setTimeout($params->timeout) |
| 79 | 79 | ->setIdleTimeout($params->idleTimeout); |
| 80 | 80 | |
| 81 | - $callback = function ($type, $buffer) use ($params, $host) { |
|
| 81 | + $callback = function($type, $buffer) use ($params, $host) { |
|
| 82 | 82 | $this->logger->printBuffer($host, $type, $buffer); |
| 83 | 83 | $this->pop->callback($host, $params->forceOutput)($type, $buffer); |
| 84 | 84 | }; |
@@ -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 | |
@@ -72,37 +72,37 @@ discard block |
||
| 72 | 72 | ]); |
| 73 | 73 | |
| 74 | 74 | // This task remotely executes the `cache:clear` console command on the target server. |
| 75 | -task('sw:cache:clear', static function () { |
|
| 75 | +task('sw:cache:clear', static function() { |
|
| 76 | 76 | run('cd {{release_path}} && {{bin/console}} cache:clear --no-warmup'); |
| 77 | 77 | }); |
| 78 | 78 | |
| 79 | 79 | // This task remotely executes the cache warmup console commands on the target server, so that the first user, who |
| 80 | 80 | // visits the website, doesn't have to wait for the cache to be built up. |
| 81 | -task('sw:cache:warmup', static function () { |
|
| 81 | +task('sw:cache:warmup', static function() { |
|
| 82 | 82 | run('cd {{release_path}} && {{bin/console}} cache:warmup'); |
| 83 | 83 | run('cd {{release_path}} && {{bin/console}} http:cache:warm:up'); |
| 84 | 84 | }); |
| 85 | 85 | |
| 86 | 86 | // This task remotely executes the `database:migrate` console command on the target server. |
| 87 | -task('sw:database:migrate', static function () { |
|
| 87 | +task('sw:database:migrate', static function() { |
|
| 88 | 88 | run('cd {{release_path}} && {{bin/console}} database:migrate --all'); |
| 89 | 89 | }); |
| 90 | 90 | |
| 91 | -task('sw:plugin:refresh', function () { |
|
| 91 | +task('sw:plugin:refresh', function() { |
|
| 92 | 92 | run('cd {{release_path}} && {{bin/console}} plugin:refresh'); |
| 93 | 93 | }); |
| 94 | 94 | |
| 95 | -task('sw:scheduled-task:register', function () { |
|
| 95 | +task('sw:scheduled-task:register', function() { |
|
| 96 | 96 | run('cd {{release_path}} && {{bin/console}} scheduled-task:register'); |
| 97 | 97 | }); |
| 98 | 98 | |
| 99 | -task('sw:theme:refresh', function () { |
|
| 99 | +task('sw:theme:refresh', function() { |
|
| 100 | 100 | run('cd {{release_path}} && {{bin/console}} theme:refresh'); |
| 101 | 101 | }); |
| 102 | 102 | |
| 103 | 103 | // This task is not used per default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`, |
| 104 | 104 | // to build the theme remotely instead of locally. |
| 105 | -task('sw:theme:compile', function () { |
|
| 105 | +task('sw:theme:compile', function() { |
|
| 106 | 106 | run('cd {{release_path}} && {{bin/console}} theme:compile'); |
| 107 | 107 | }); |
| 108 | 108 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | return $plugins; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | -task('sw:plugin:update:all', static function () { |
|
| 117 | +task('sw:plugin:update:all', static function() { |
|
| 118 | 118 | $plugins = getPlugins(); |
| 119 | 119 | foreach ($plugins as $plugin) { |
| 120 | 120 | if ($plugin->installedAt && $plugin->upgradeVersion) { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | 126 | |
| 127 | -task('sw:writable:jwt', static function () { |
|
| 127 | +task('sw:writable:jwt', static function() { |
|
| 128 | 128 | run('cd {{release_path}} && chmod -R 660 config/jwt/*'); |
| 129 | 129 | }); |
| 130 | 130 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | 'deploy:publish', |
| 152 | 152 | ]); |
| 153 | 153 | |
| 154 | -task('deploy:update_code')->setCallback(static function () { |
|
| 154 | +task('deploy:update_code')->setCallback(static function() { |
|
| 155 | 155 | upload('.', '{{release_path}}', [ |
| 156 | 156 | 'options' => [ |
| 157 | 157 | '--exclude=.git', |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | ]); |
| 162 | 162 | }); |
| 163 | 163 | |
| 164 | -task('sw-build-without-db:get-remote-config', static function () { |
|
| 164 | +task('sw-build-without-db:get-remote-config', static function() { |
|
| 165 | 165 | if (!test('[ -d {{current_path}} ]')) { |
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | - within('{{current_path}}', function () { |
|
| 168 | + within('{{current_path}}', function() { |
|
| 169 | 169 | run('{{bin/php}} ./bin/console bundle:dump'); |
| 170 | 170 | download('{{current_path}}/var/plugins.json', './var/'); |
| 171 | 171 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | }); |
| 175 | 175 | }); |
| 176 | 176 | |
| 177 | -task('sw-build-without-db:build', static function () { |
|
| 177 | +task('sw-build-without-db:build', static function() { |
|
| 178 | 178 | runLocally('CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=1 ./bin/build-js.sh'); |
| 179 | 179 | }); |
| 180 | 180 | |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | namespace Deployer; |
| 26 | 26 | |
| 27 | 27 | // Get path to bin |
| 28 | -set('bin/crontab', function () { |
|
| 28 | +set('bin/crontab', function() { |
|
| 29 | 29 | return which('crontab'); |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | 32 | // Set the identifier used in the crontab, application name by default |
| 33 | -set('crontab:identifier', function () { |
|
| 33 | +set('crontab:identifier', function() { |
|
| 34 | 34 | return get('application', 'application'); |
| 35 | 35 | }); |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | set('crontab:use_sudo', false); |
| 39 | 39 | |
| 40 | 40 | desc('Sync crontab jobs'); |
| 41 | -task('crontab:sync', function () { |
|
| 41 | +task('crontab:sync', function() { |
|
| 42 | 42 | $cronJobsLocal = array_map( |
| 43 | 43 | fn($job) => parse($job), |
| 44 | 44 | get('crontab:jobs', []), |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | }); |
| 83 | 83 | |
| 84 | 84 | desc('Remove crontab jobs'); |
| 85 | -task('crontab:remove', function () { |
|
| 85 | +task('crontab:remove', function() { |
|
| 86 | 86 | $cronJobsLocal = array_map( |
| 87 | 87 | fn($job) => parse($job), |
| 88 | 88 | get('crontab:jobs', []), |