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

Commit b52c5f9

Browse files
hyde1antonmedv
authored andcommitted
cachetool recipe: add cachetool_bin setting to download old version (… (#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
1 parent eab3b3b commit b52c5f9

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

recipe/cachetool.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
namespace Deployer;
99

1010
set('cachetool', '');
11+
set('bin/cachetool', function(){
12+
return run("{{bin/php}} -r \"echo version_compare(phpversion(), '7.1') == -1 ? 'cachetool-3.2.1.phar' : 'cachetool.phar';\"");
13+
});
1114

1215
desc('Clearing APC system cache');
1316
task('cachetool:clear:apc', function () {
@@ -19,13 +22,13 @@
1922
}
2023

2124
cd($releasePath);
22-
$hasCachetool = run("if [ -e $releasePath/cachetool.phar ]; then echo 'true'; fi");
25+
$hasCachetool = run("if [ -e $releasePath/{{bin/cachetool}} ]; then echo 'true'; fi");
2326

2427
if ('true' !== $hasCachetool) {
25-
run("curl -sO https://gordalina.github.io/cachetool/downloads/cachetool.phar");
28+
run("curl -sO https://gordalina.github.io/cachetool/downloads/{{bin/cachetool}}");
2629
}
2730

28-
run("{{bin/php}} cachetool.phar apc:cache:clear system {$options}");
31+
run("{{bin/php}} {{bin/cachetool}} apc:cache:clear system {$options}");
2932
});
3033

3134
/**
@@ -41,11 +44,11 @@
4144
}
4245

4346
cd($releasePath);
44-
$hasCachetool = run("if [ -e $releasePath/cachetool.phar ]; then echo 'true'; fi");
47+
$hasCachetool = run("if [ -e $releasePath/{{bin/cachetool}} ]; then echo 'true'; fi");
4548

4649
if ('true' !== $hasCachetool) {
47-
run("curl -sO https://gordalina.github.io/cachetool/downloads/cachetool.phar");
50+
run("curl -sO https://gordalina.github.io/cachetool/downloads/{{bin/cachetool}}");
4851
}
4952

50-
run("{{bin/php}} cachetool.phar opcache:reset {$options}");
53+
run("{{bin/php}} {{bin/cachetool}} opcache:reset {$options}");
5154
});

0 commit comments

Comments
 (0)