From 601b626f17477afbdb13509a74eaf047225517be Mon Sep 17 00:00:00 2001 From: ameotoko Date: Mon, 27 Nov 2023 01:21:36 +0100 Subject: [PATCH 1/2] Fix version variables in Contao recipe --- docs/recipe/contao.md | 4 +++- recipe/contao.php | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/recipe/contao.md b/docs/recipe/contao.md index a4ca70782..11a973cd9 100644 --- a/docs/recipe/contao.md +++ b/docs/recipe/contao.md @@ -84,7 +84,9 @@ return '{{bin/php}} {{release_or_current_path}}/vendor/bin/contao-console'; ```php title="Default value" -return run('{{bin/console}} contao:version'); +$result = run('{{bin/console}} --version'); +preg_match_all('/(\d+\.?)+/', $result, $matches); +return $matches[0][0] ?? 'n/a'; ``` diff --git a/recipe/contao.php b/recipe/contao.php index 81f7b63f4..c26414c8f 100644 --- a/recipe/contao.php +++ b/recipe/contao.php @@ -31,7 +31,15 @@ }); set('contao_version', function () { - return run('{{bin/console}} contao:version'); + $result = run('{{bin/console}} --version'); + preg_match_all('/(\d+\.?)+/', $result, $matches); + return $matches[0][0] ?? 'n/a'; +}); + +set('symfony_version', function () { + $result = run('{{bin/console}} about'); + preg_match_all('/(\d+\.?)+/', $result, $matches); + return $matches[0][0] ?? 5.0; }); // This task updates the database. A database backup is saved automatically as a default. From 539fa7a492c3d015dc19f03f86855e2866065e0b Mon Sep 17 00:00:00 2001 From: ameotoko Date: Mon, 27 Nov 2023 01:44:20 +0100 Subject: [PATCH 2/2] update docs --- docs/recipe/contao.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/docs/recipe/contao.md b/docs/recipe/contao.md index 11a973cd9..38fab2043 100644 --- a/docs/recipe/contao.md +++ b/docs/recipe/contao.md @@ -90,11 +90,25 @@ return $matches[0][0] ?? 'n/a'; ``` +### symfony_version +[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L39) + +Overrides [symfony_version](/docs/recipe/symfony.md#symfony_version) from `recipe/symfony.php`. + + + +```php title="Default value" +$result = run('{{bin/console}} about'); +preg_match_all('/(\d+\.?)+/', $result, $matches); +return $matches[0][0] ?? 5.0; +``` + + ## Tasks ### contao:migrate -[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L47) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L55) Run Contao migrations. @@ -110,7 +124,7 @@ task('contao:migrate', function () { ### contao:manager:download -[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L53) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L61) Download the Contao Manager. @@ -118,7 +132,7 @@ Downloads the `contao-manager.phar.php` into the public path. ### contao:install:lock -[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L59) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L67) Lock the Contao Install Tool. @@ -126,7 +140,7 @@ Locks the Contao install tool which is useful if you don't use it. ### contao:manager:lock -[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L65) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L73) Lock the Contao Manager. @@ -134,7 +148,7 @@ Locks the Contao Manager which is useful if you only need the API of the Manager ### contao:maintenance:enable -[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L71) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L79) Enable maintenance mode. @@ -142,7 +156,7 @@ Enable maintenance mode. ### contao:maintenance:disable -[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L86) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L94) Disable maintenance mode. @@ -150,7 +164,7 @@ Disable maintenance mode. ### deploy -[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L98) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L106) Deploy the project.