From e812d895315c2d84b3eea47dcc865dec57543c38 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Tue, 7 Nov 2023 11:25:22 +0100 Subject: [PATCH] Revert "[TASK] Update TYPO3 recipe (#3674)" This reverts commit 73f2b531d71075f8523829ce0bbeeac4fb7e10fa. --- docs/recipe/typo3.md | 143 ++++++++-------------------------------- recipe/typo3.php | 102 ++++------------------------ src/Deployer.php | 2 +- src/Executor/Master.php | 4 +- src/Task/GroupTask.php | 27 -------- src/Task/Task.php | 15 ----- 6 files changed, 44 insertions(+), 249 deletions(-) diff --git a/docs/recipe/typo3.md b/docs/recipe/typo3.md index 423bf0893..ad84e4a4e 100644 --- a/docs/recipe/typo3.md +++ b/docs/recipe/typo3.md @@ -28,45 +28,37 @@ Additionally, Deployer has a lot of other features, like: You can read more about Deployer in [Getting Started](/docs/getting-started.md). The [deploy](#deploy) task of **TYPO3** consists of: -* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) – Prepares host for deploy -* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) – Locks deploy -* [deploy:release](/docs/recipe/deploy/release.md#deployrelease) – Prepares release -* [rsync](/docs/contrib/rsync.md#rsync) – Rsync local->remote -* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) – Creates symlinks for shared files and dirs -* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) – Makes writable dirs -* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) – Creates symlink to release -* [typo3:extension:setup](/docs/recipe/typo3.md#typo3extensionsetup) – TYPO3 - Set up extensions -* [typo3:cache:flush](/docs/recipe/typo3.md#typo3cacheflush) – TYPO3 - Cache clearing for all caches -* [typo3:language:update](/docs/recipe/typo3.md#typo3languageupdate) – TYPO3 - Update the language files of all activated extensions -* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) – Unlocks deploy -* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) – Cleanup old releases +* [deploy:prepare](/docs/recipe/common.md#deployprepare) – Prepares a new release + * [deploy:info](/docs/recipe/deploy/info.md#deployinfo) – Displays info about deployment + * [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) – Prepares host for deploy + * [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) – Locks deploy + * [deploy:release](/docs/recipe/deploy/release.md#deployrelease) – Prepares release + * [deploy:update_code](/docs/recipe/deploy/update_code.md#deployupdate_code) – Updates code + * [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) – Creates symlinks for shared files and dirs + * [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) – Makes writable dirs +* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors) – Installs vendors +* [deploy:publish](/docs/recipe/common.md#deploypublish) – Publishes the release + * [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) – Creates symlink to release + * [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) – Unlocks deploy + * [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) – Cleanup old releases + * [deploy:success](/docs/recipe/common.md#deploysuccess) – The typo3 recipe is based on the [common](/docs/recipe/common.md) recipe. ## Configuration ### typo3_webroot -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L12) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L11) DocumentRoot / WebRoot for the TYPO3 installation ```php title="Default value" -'public' -``` - - -### bin/typo3 -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L17) - -Path to TYPO3 cli - -```php title="Default value" -'vendor/bin/typo3' +'Web' ``` ### shared_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L22) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L26) Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`. @@ -82,7 +74,7 @@ Shared directories ### shared_files -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L31) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L35) Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`. @@ -90,14 +82,13 @@ Shared files ```php title="Default value" [ - '{{typo3_webroot}}/.htaccess', - 'config/system/settings.php', + '{{typo3_webroot}}/.htaccess' ] ``` ### writable_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L39) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L42) Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`. @@ -106,28 +97,9 @@ Writeable directories ```php title="Default value" [ '{{typo3_webroot}}/fileadmin', - 'var', -] -``` - - -### rsync -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L65) - - - -```php title="Default value" -[ - 'exclude' => array_merge(get('shared_dirs'), get('shared_files'), $exclude), - 'exclude-file' => false, - 'include' => ['vendor'], - 'include-file' => false, - 'filter' => ['dir-merge,-n /.gitignore'], - 'filter-file' => false, - 'filter-perdir' => false, - 'flags' => 'avz', - 'options' => ['delete', 'keep-dirlinks', 'links'], - 'timeout' => 600 + '{{typo3_webroot}}/typo3temp', + '{{typo3_webroot}}/typo3conf', + '{{typo3_webroot}}/uploads' ] ``` @@ -135,74 +107,17 @@ Writeable directories ## Tasks -### typo3:cache:warmup -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L79) - -TYPO3 - Cache warmup for all caches. - - - - -### typo3:cache:flush -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L85) - -TYPO3 - Cache clearing for all caches. - - - - -### typo3:language:update -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L91) - -TYPO3 - Update the language files of all activated extensions. - - - - -### typo3:extension:setup -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L97) - -TYPO3 - Set up extensions. - - - - -### deploy:update_code -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L105) - - - -Configure "deploy" task group. - - -### deploy:info -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L106) - - - - - - ### deploy -[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L109) - -Deploys a TYPO3 project. +[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3.php#L17) +Deploys your project. +Main TYPO3 task This task is group task which contains next tasks: -* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) -* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) -* [deploy:release](/docs/recipe/deploy/release.md#deployrelease) -* [rsync](/docs/contrib/rsync.md#rsync) -* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) -* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) -* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) -* [typo3:extension:setup](/docs/recipe/typo3.md#typo3extensionsetup) -* [typo3:cache:flush](/docs/recipe/typo3.md#typo3cacheflush) -* [typo3:language:update](/docs/recipe/typo3.md#typo3languageupdate) -* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) -* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) +* [deploy:prepare](/docs/recipe/common.md#deployprepare) +* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors) +* [deploy:publish](/docs/recipe/common.md#deploypublish) diff --git a/recipe/typo3.php b/recipe/typo3.php index 5a9b9231a..e01476e46 100644 --- a/recipe/typo3.php +++ b/recipe/typo3.php @@ -2,19 +2,23 @@ namespace Deployer; require_once __DIR__ . '/common.php'; -require_once __DIR__ . '/../contrib/rsync.php'; add('recipes', ['typo3']); /** * DocumentRoot / WebRoot for the TYPO3 installation */ -set('typo3_webroot', 'public'); +set('typo3_webroot', 'Web'); /** - * Path to TYPO3 cli + * Main TYPO3 task */ -set('bin/typo3', 'vendor/bin/typo3'); +desc('Deploys your project'); +task('deploy', [ + 'deploy:prepare', + 'deploy:vendors', + 'deploy:publish', +]); /** * Shared directories @@ -29,8 +33,7 @@ * Shared files */ set('shared_files', [ - '{{typo3_webroot}}/.htaccess', - 'config/system/settings.php', + '{{typo3_webroot}}/.htaccess' ]); /** @@ -38,88 +41,7 @@ */ set('writable_dirs', [ '{{typo3_webroot}}/fileadmin', - 'var', -]); - -$exclude = [ - '.Build', - '.git', - '.gitlab', - '.ddev', - '.deployer', - '.idea', - '.DS_Store', - '.gitlab-ci.yml', - '.npm', - 'deploy.yaml', - 'package.json', - 'package-lock.json', - 'node_modules/', - 'var/', - 'public/fileadmin/', - 'public/typo3temp/', - 'config/system/additional.php', - 'config/system/settings.php', -]; - -set('rsync', [ - 'exclude' => array_merge(get('shared_dirs'), get('shared_files'), $exclude), - 'exclude-file' => false, - 'include' => ['vendor'], - 'include-file' => false, - 'filter' => ['dir-merge,-n /.gitignore'], - 'filter-file' => false, - 'filter-perdir' => false, - 'flags' => 'avz', - 'options' => ['delete', 'keep-dirlinks', 'links'], - 'timeout' => 600 -]); - -desc('TYPO3 - Cache warmup for all caches'); -task('typo3:cache:warmup', function () { - cd('{{release_path}}'); - run('{{bin/php}} {{bin/typo3}} cache:warmup'); -}); - -desc('TYPO3 - Cache clearing for all caches'); -task('typo3:cache:flush', function () { - cd('{{release_path}}'); - run('{{bin/php}} {{bin/typo3}} cache:flush'); -}); - -desc('TYPO3 - Update the language files of all activated extensions'); -task('typo3:language:update', function () { - cd('{{release_path}}'); - run('{{bin/php}} {{bin/typo3}} language:update'); -}); - -desc('TYPO3 - Set up extensions'); -task('typo3:extension:setup', function () { - cd('{{release_path}}'); - run('{{bin/php}} {{bin/typo3}} extension:setup'); -}); - -/** - * Configure "deploy" task group. - */ -task('deploy:update_code')->hidden()->disable(); -task('deploy:info')->hidden()->disable(); - -desc('Deploys a TYPO3 project'); -task('deploy', [ - 'deploy:setup', - 'deploy:lock', - 'deploy:release', - 'rsync', - 'deploy:shared', - 'deploy:writable', - 'deploy:symlink', - 'typo3:extension:setup', - 'typo3:cache:flush', - 'typo3:language:update', - 'deploy:unlock', - 'deploy:cleanup', - 'deploy:success' + '{{typo3_webroot}}/typo3temp', + '{{typo3_webroot}}/typo3conf', + '{{typo3_webroot}}/uploads' ]); - -after('deploy:failed', 'deploy:unlock'); diff --git a/src/Deployer.php b/src/Deployer.php index fec8d90e7..be8c9fc10 100755 --- a/src/Deployer.php +++ b/src/Deployer.php @@ -321,7 +321,7 @@ public static function run(string $version, ?string $deployFile) $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); } self::printException($output, $exception); - + exit(1); } } diff --git a/src/Executor/Master.php b/src/Executor/Master.php index b7fa7e77f..042246323 100644 --- a/src/Executor/Master.php +++ b/src/Executor/Master.php @@ -201,9 +201,9 @@ private function runTask(Task $task, array $hosts): int } }); - $this->server->loop->addPeriodicTimer(0.03, function ($timer) use (&$processes, $callback, $task) { + $this->server->loop->addPeriodicTimer(0.03, function ($timer) use (&$processes, $callback) { $this->gatherOutput($processes, $callback); - if ($this->output->isDecorated() && !getenv('CI') && $task->hasSpinner()) { + if ($this->output->isDecorated() && !getenv('CI')) { $this->output->write(spinner()); } if ($this->allFinished($processes)) { diff --git a/src/Task/GroupTask.php b/src/Task/GroupTask.php index 57ac56ce5..a43a77eb2 100644 --- a/src/Task/GroupTask.php +++ b/src/Task/GroupTask.php @@ -49,31 +49,4 @@ public function setGroup(array $group): void { $this->group = $group; } - - public function addTaskBefore(string $task, string $addTask): void - { - $this->addTask($task, $addTask); - } - - public function addTaskAfter(string $task, string $addTask): void - { - $this->addTask($task, $addTask, 'after'); - } - - public function addTask(string $task, string $addTask, string $position = 'before'): void - { - $taskPosition = array_search($task, $this->group); - if(!$taskPosition) { - throw new \InvalidArgumentException("Task `$task` not found."); - } - - switch ($position) { - case 'before': - array_splice($this->group, $taskPosition, 0, [$addTask]); - break; - case 'after': - array_splice($this->group, $taskPosition + 1, 0, [$addTask]); - break; - } - } } diff --git a/src/Task/Task.php b/src/Task/Task.php index c7bb76287..0dab358ee 100644 --- a/src/Task/Task.php +++ b/src/Task/Task.php @@ -60,10 +60,6 @@ class Task * @var bool */ private $verbose = false; - /** - * @var bool - */ - private $spinner = true; /** * @var bool */ @@ -258,17 +254,6 @@ public function verbose(bool $verbose = true): self return $this; } - public function hasSpinner(): bool - { - return $this->spinner; - } - - public function spinner(bool $enabled = true): self - { - $this->spinner = $enabled; - return $this; - } - public function isEnabled(): bool { return $this->enabled;