Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
cachetool recipe: add cachetool_bin setting to download old version (… (
Browse files Browse the repository at this point in the history
#184)

* 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
  • Loading branch information
hyde1 authored and antonmedv committed May 30, 2018
1 parent eab3b3b commit b52c5f9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions recipe/cachetool.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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}");
});

/**
Expand All @@ -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}");
});

0 comments on commit b52c5f9

Please sign in to comment.