Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add redis #168

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
28 changes: 28 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,25 @@ 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']);
}
elseif ($result['json'] == 'true') {
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