Skip to content

Commit

Permalink
Redis enable
Browse files Browse the repository at this point in the history
  • Loading branch information
ari-gold committed Sep 5, 2014
1 parent 881add3 commit 297f9cc
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
14 changes: 14 additions & 0 deletions terminus.code.api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,17 @@ function terminus_api_code_upstream_update($site_uuid, $updatedb = FALSE, $overw

return terminus_request($realm, $site_uuid, $path, $method, $data);
}

/**
* API Call to Enable Redis
*/
function terminus_api_site_redis_enable($site_uuid) {
$realm = 'site';
$path = 'settings';
$method = 'PUT';
$data = array(
'allow_cacheserver' => true,
);

return terminus_request($realm, $site_uuid, $path, $method, $data);
}
29 changes: 29 additions & 0 deletions terminus.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,15 @@ function terminus_drush_command() {
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);

$items['pantheon-site-redis-enable'] = array(
'description' => 'Enables redis cache server for site. Requires additional configuration. See http://helpdesk.getpantheon.com/customer/portal/articles/401317-redis/',
'arguments' => array(
'site' => 'UUID or name of the site.',
),
'aliases' => array('psite-redis-enable'),
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);

$items['pantheon-site-environment-redis-clear'] = array(
'description' => 'Clear redis cache of a site environment.',
'arguments' => array(
Expand Down Expand Up @@ -1737,6 +1746,26 @@ function terminus_notification_poll($site_uuid, $type) {
}
}

/**
* Enable redis validate
*/
function drush_terminus_pantheon_site_redis_enable_validate($site_uuid = FALSE) {
return terminus_validate_session_data() && terminus_validate_site_uuid_input($site_uuid);
}

/* Enable redis */
function drush_terminus_pantheon_site_redis_enable($site_uuid) {
$site_uuid = drush_get_option('site_uuid');
$result = terminus_api_site_redis_enable($site_uuid);
if (drush_get_option('json')) {
drush_print($result['json']);
}
else {
$redis = json_decode($result['json']);
drush_print('Redis cacheserver enabled. Requires additional configuration. Please see http://helpdesk.getpantheon.com/customer/portal/articles/401317-redis');
}
}

/**
* Validation prior to clearing a site environment's redis cache.
*/
Expand Down

0 comments on commit 297f9cc

Please sign in to comment.