-
Notifications
You must be signed in to change notification settings - Fork 24
/
terminus.workflow.api.inc
70 lines (66 loc) · 1.8 KB
/
terminus.workflow.api.inc
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* @file
* API functions for Atlas/Ygg Workflow Integration
*/
/**
* API call to clone a database between site environments.
*/
function terminus_api_environment_clone_database($site_uuid, $env_source, $env_target, $updatedb = FALSE) {
$realm = 'site';
$path = 'environments/' . $env_target . '/database';
$method = 'POST';
$uuid = $site_uuid;
$data = array(
'clone-from-environment' => $env_source,
);
if ($updatedb) {
$data['updatedb'] = 1;
}
return terminus_request($realm, $uuid, $path, $method, $data);
}
/**
* API call to clone user files between site environments.
*/
function terminus_api_environment_clone_files($site_uuid, $env_source, $env_target) {
$realm = 'site';
$path = 'environments/' . $env_target . '/files';
$method = 'POST';
$uuid = $site_uuid;
$data = array(
'clone-from-environment' => $env_source,
);
return terminus_request($realm, $uuid, $path, $method, $data);
}
/**
* API call to deploy code to a site environment.
*/
function terminus_api_environment_deploy_code($site_uuid, $env_target, $updatedb = 0, $clearcache = 0) {
$realm = 'site';
$uuid = $site_uuid;
$path = 'environments/' . $env_target . '/code';
$arguments = array();
if ($updatedb) {
$arguments[] = 'updatedb=1';
}
if ($clearcache) {
$arguments[] = 'clearcache=1';
}
if (!empty($arguments)) {
$path .= '?' . implode('&', $arguments);
}
$method = 'POST';
$data = array();
return terminus_request($realm, $uuid, $path, $method, $data);
}
/**
* API call to wipe a site environment.
*/
function terminus_api_environment_content_wipe($site_uuid, $environment) {
$realm = 'site';
$uuid = $site_uuid;
$path ='environments/' . $environment . '/wipe';
$method = 'POST';
$data = '';
return terminus_request($realm, $uuid, $path, $method, $data);
}