Skip to content

Commit

Permalink
Revert "[TASK] Update TYPO3 recipe (#3674)" (#3723)
Browse files Browse the repository at this point in the history
This reverts commit 73f2b53.
  • Loading branch information
antonmedv authored Nov 7, 2023
1 parent f907111 commit 5c62c45
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 249 deletions.
143 changes: 29 additions & 114 deletions docs/recipe/typo3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -82,22 +74,21 @@ 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`.

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`.

Expand All @@ -106,103 +97,27 @@ 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'
]
```



## 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)


102 changes: 12 additions & 90 deletions recipe/typo3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,97 +33,15 @@
* Shared files
*/
set('shared_files', [
'{{typo3_webroot}}/.htaccess',
'config/system/settings.php',
'{{typo3_webroot}}/.htaccess'
]);

/**
* Writeable directories
*/
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');
2 changes: 1 addition & 1 deletion src/Deployer.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public static function run(string $version, ?string $deployFile)
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
}
self::printException($output, $exception);

exit(1);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Executor/Master.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
27 changes: 0 additions & 27 deletions src/Task/GroupTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Loading

0 comments on commit 5c62c45

Please sign in to comment.