| @@ 83-100 (lines=18) @@ | ||
| 80 | /** |
|
| 81 | * @return SS_HTTPResponse |
|
| 82 | */ |
|
| 83 | protected function createFetch() { |
|
| 84 | /** @var DNGitFetch $fetch */ |
|
| 85 | $fetch = DNGitFetch::create(); |
|
| 86 | $fetch->ProjectID = $this->record->ID; |
|
| 87 | $fetch->write(); |
|
| 88 | $fetch->start(); |
|
| 89 | ||
| 90 | $location = Director::absoluteBaseURL() . $this->Link() . '/fetch/' . $fetch->ID; |
|
| 91 | $output = array( |
|
| 92 | 'message' => 'Fetch queued as job ' . $fetch->ResqueToken, |
|
| 93 | 'href' => $location, |
|
| 94 | ); |
|
| 95 | ||
| 96 | $response = $this->getAPIResponse($output); |
|
| 97 | $response->setStatusCode(201); |
|
| 98 | $response->addHeader('Location', $location); |
|
| 99 | return $response; |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * @return string |
|
| @@ 212-229 (lines=18) @@ | ||
| 209 | /** |
|
| 210 | * @return SS_HTTPResponse |
|
| 211 | */ |
|
| 212 | protected function createUpdate() { |
|
| 213 | /** @var DNGitFetch $fetch */ |
|
| 214 | $fetch = DNGitFetch::create(); |
|
| 215 | $fetch->ProjectID = $this->project->ID; |
|
| 216 | $fetch->write(); |
|
| 217 | $fetch->start(); |
|
| 218 | ||
| 219 | $location = Director::absoluteBaseURL() . $this->Link() . '/update/' . $fetch->ID; |
|
| 220 | $output = [ |
|
| 221 | 'message' => 'git fetch has been queued', |
|
| 222 | 'id' => $fetch->ID, |
|
| 223 | 'location' => $location, |
|
| 224 | ]; |
|
| 225 | ||
| 226 | $response = $this->getAPIResponse($output, 201); |
|
| 227 | $response->addHeader('Location', $location); |
|
| 228 | return $response; |
|
| 229 | } |
|
| 230 | ||
| 231 | /** |
|
| 232 | * @param $project |
|