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}"); });