@@ -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,20 +72,20 @@ discard block |
||
| 72 | 72 | ]); |
| 73 | 73 | |
| 74 | 74 | // This sets the shopware version to the version of the shopware console command. |
| 75 | -set('shopware_version', function () { |
|
| 75 | +set('shopware_version', function() { |
|
| 76 | 76 | $versionOutput = run('cd {{release_path}} && {{bin/console}} -V'); |
| 77 | 77 | preg_match('/(\d+\.\d+\.\d+\.\d+)/', $versionOutput, $matches); |
| 78 | 78 | return $matches[0] ?? '6.6.0'; |
| 79 | 79 | }); |
| 80 | 80 | |
| 81 | 81 | // This task remotely executes the `cache:clear` console command on the target server. |
| 82 | -task('sw:cache:clear', static function () { |
|
| 82 | +task('sw:cache:clear', static function() { |
|
| 83 | 83 | run('cd {{release_path}} && {{bin/console}} cache:clear --no-warmup'); |
| 84 | 84 | }); |
| 85 | 85 | |
| 86 | 86 | // This task remotely executes the cache warmup console commands on the target server, so that the first user, who |
| 87 | 87 | // visits the website, doesn't have to wait for the cache to be built up. |
| 88 | -task('sw:cache:warmup', static function () { |
|
| 88 | +task('sw:cache:warmup', static function() { |
|
| 89 | 89 | run('cd {{release_path}} && {{bin/console}} cache:warmup'); |
| 90 | 90 | |
| 91 | 91 | // Shopware 6.6+ dropped support for the http:cache:warmup command, so only execute it if the version is less than 6.6 |
@@ -95,25 +95,25 @@ discard block |
||
| 95 | 95 | }); |
| 96 | 96 | |
| 97 | 97 | // This task remotely executes the `database:migrate` console command on the target server. |
| 98 | -task('sw:database:migrate', static function () { |
|
| 98 | +task('sw:database:migrate', static function() { |
|
| 99 | 99 | run('cd {{release_path}} && {{bin/console}} database:migrate --all'); |
| 100 | 100 | }); |
| 101 | 101 | |
| 102 | -task('sw:plugin:refresh', function () { |
|
| 102 | +task('sw:plugin:refresh', function() { |
|
| 103 | 103 | run('cd {{release_path}} && {{bin/console}} plugin:refresh'); |
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | -task('sw:scheduled-task:register', function () { |
|
| 106 | +task('sw:scheduled-task:register', function() { |
|
| 107 | 107 | run('cd {{release_path}} && {{bin/console}} scheduled-task:register'); |
| 108 | 108 | }); |
| 109 | 109 | |
| 110 | -task('sw:theme:refresh', function () { |
|
| 110 | +task('sw:theme:refresh', function() { |
|
| 111 | 111 | run('cd {{release_path}} && {{bin/console}} theme:refresh'); |
| 112 | 112 | }); |
| 113 | 113 | |
| 114 | 114 | // This task is not used per default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`, |
| 115 | 115 | // to build the theme remotely instead of locally. |
| 116 | -task('sw:theme:compile', function () { |
|
| 116 | +task('sw:theme:compile', function() { |
|
| 117 | 117 | run('cd {{release_path}} && {{bin/console}} theme:compile'); |
| 118 | 118 | }); |
| 119 | 119 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | return $plugins; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | -task('sw:plugin:update:all', static function () { |
|
| 128 | +task('sw:plugin:update:all', static function() { |
|
| 129 | 129 | $plugins = getPlugins(); |
| 130 | 130 | foreach ($plugins as $plugin) { |
| 131 | 131 | if ($plugin->installedAt && $plugin->upgradeVersion) { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | }); |
| 137 | 137 | |
| 138 | -task('sw:writable:jwt', static function () { |
|
| 138 | +task('sw:writable:jwt', static function() { |
|
| 139 | 139 | run('cd {{release_path}} && chmod -R 660 config/jwt/*'); |
| 140 | 140 | }); |
| 141 | 141 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | 'deploy:publish', |
| 163 | 163 | ]); |
| 164 | 164 | |
| 165 | -task('deploy:update_code')->setCallback(static function () { |
|
| 165 | +task('deploy:update_code')->setCallback(static function() { |
|
| 166 | 166 | upload('.', '{{release_path}}', [ |
| 167 | 167 | 'options' => [ |
| 168 | 168 | '--exclude=.git', |
@@ -172,11 +172,11 @@ discard block |
||
| 172 | 172 | ]); |
| 173 | 173 | }); |
| 174 | 174 | |
| 175 | -task('sw-build-without-db:get-remote-config', static function () { |
|
| 175 | +task('sw-build-without-db:get-remote-config', static function() { |
|
| 176 | 176 | if (!test('[ -d {{current_path}} ]')) { |
| 177 | 177 | return; |
| 178 | 178 | } |
| 179 | - within('{{current_path}}', function () { |
|
| 179 | + within('{{current_path}}', function() { |
|
| 180 | 180 | run('{{bin/php}} ./bin/console bundle:dump'); |
| 181 | 181 | download('{{current_path}}/var/plugins.json', './var/'); |
| 182 | 182 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | }); |
| 186 | 186 | }); |
| 187 | 187 | |
| 188 | -task('sw-build-without-db:build', static function () { |
|
| 188 | +task('sw-build-without-db:build', static function() { |
|
| 189 | 189 | runLocally('CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=1 ./bin/build-js.sh'); |
| 190 | 190 | }); |
| 191 | 191 | |
@@ -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', []), |