Skip to content

Commit 3834add

Browse files
committed
Redis cache clear should error when not available
1 parent 9a7a609 commit 3834add

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

php/Terminus/Site.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ public function bindings($type=null) {
4949
}
5050
}
5151
if ($type) {
52-
return $this->bindings[$type];
52+
if (isset($this->bindings[$type])) {
53+
return $this->bindings[$type];
54+
} else {
55+
return false;
56+
}
5357
}
5458
return $this->bindings;
5559
}

php/commands/site.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,9 @@ public function redis($args, $assoc_args) {
10931093
switch ($action) {
10941094
case 'clear':
10951095
$bindings = $site->bindings('cacheserver');
1096+
if (empty($bindings)) {
1097+
\Terminus::error("Redis cache not enabled");
1098+
}
10961099
$commands = array();
10971100
foreach($bindings as $binding) {
10981101
if ( @$env AND $env != $binding->environment) continue;

0 commit comments

Comments
 (0)