forked from deployphp/recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cachetool.php
51 lines (39 loc) · 1.32 KB
/
cachetool.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/* (c) Samuel Gordalina <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
set('cachetool', '');
desc('Clearing APC system cache');
task('cachetool:clear:apc', function () {
$releasePath = get('release_path');
$options = get('cachetool');
if (strlen($options)) {
$options = "--fcgi={$options}";
}
cd($releasePath);
$hasCachetool = run("if [ -e $releasePath/cachetool.phar ]; then echo 'true'; fi");
if ('true' !== $hasCachetool) {
run("curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar");
}
run("{{bin/php}} cachetool.phar apc:cache:clear system {$options}");
});
/**
* Clear opcache cache
*/
desc('Clearing OPcode cache');
task('cachetool:clear:opcache', function () {
$releasePath = get('release_path');
$options = get('cachetool');
if (strlen($options)) {
$options = "--fcgi={$options}";
}
cd($releasePath);
$hasCachetool = run("if [ -e $releasePath/cachetool.phar ]; then echo 'true'; fi");
if ('true' !== $hasCachetool) {
run("curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar");
}
run("{{bin/php}} cachetool.phar opcache:reset {$options}");
});