From b52c5f93d6ad38ab84666dcc740d50472141ab2a Mon Sep 17 00:00:00 2001 From: Marc Legay Date: Wed, 30 May 2018 09:54:18 +0200 Subject: [PATCH] =?UTF-8?q?cachetool=20recipe:=20add=20cachetool=5Fbin=20s?= =?UTF-8?q?etting=20to=20download=20old=20version=20(=E2=80=A6=20(#184)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * cachetool recipe: add cachetool_bin setting to download old version (4.0.0 is only compatible with php >=7.1) * cachetool: use {{bin/php}} instead of hardcoded path * cachetool: rename setting for bin path --- recipe/cachetool.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/recipe/cachetool.php b/recipe/cachetool.php index c2d3f18..c80b80c 100644 --- a/recipe/cachetool.php +++ b/recipe/cachetool.php @@ -8,6 +8,9 @@ namespace Deployer; set('cachetool', ''); +set('bin/cachetool', function(){ + return run("{{bin/php}} -r \"echo version_compare(phpversion(), '7.1') == -1 ? 'cachetool-3.2.1.phar' : 'cachetool.phar';\""); +}); desc('Clearing APC system cache'); task('cachetool:clear:apc', function () { @@ -19,13 +22,13 @@ } cd($releasePath); - $hasCachetool = run("if [ -e $releasePath/cachetool.phar ]; then echo 'true'; fi"); + $hasCachetool = run("if [ -e $releasePath/{{bin/cachetool}} ]; then echo 'true'; fi"); if ('true' !== $hasCachetool) { - run("curl -sO https://gordalina.github.io/cachetool/downloads/cachetool.phar"); + run("curl -sO https://gordalina.github.io/cachetool/downloads/{{bin/cachetool}}"); } - run("{{bin/php}} cachetool.phar apc:cache:clear system {$options}"); + run("{{bin/php}} {{bin/cachetool}} apc:cache:clear system {$options}"); }); /** @@ -41,11 +44,11 @@ } cd($releasePath); - $hasCachetool = run("if [ -e $releasePath/cachetool.phar ]; then echo 'true'; fi"); + $hasCachetool = run("if [ -e $releasePath/{{bin/cachetool}} ]; then echo 'true'; fi"); if ('true' !== $hasCachetool) { - run("curl -sO https://gordalina.github.io/cachetool/downloads/cachetool.phar"); + run("curl -sO https://gordalina.github.io/cachetool/downloads/{{bin/cachetool}}"); } - run("{{bin/php}} cachetool.phar opcache:reset {$options}"); + run("{{bin/php}} {{bin/cachetool}} opcache:reset {$options}"); });