| @@ 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 |
|
| @@ 230-247 (lines=18) @@ | ||
| 227 | /** |
|
| 228 | * @return SS_HTTPResponse |
|
| 229 | */ |
|
| 230 | protected function createUpdate() { |
|
| 231 | /** @var DNGitFetch $fetch */ |
|
| 232 | $fetch = DNGitFetch::create(); |
|
| 233 | $fetch->ProjectID = $this->project->ID; |
|
| 234 | $fetch->write(); |
|
| 235 | $fetch->start(); |
|
| 236 | ||
| 237 | $location = Director::absoluteBaseURL() . $this->Link() . '/update/' . $fetch->ID; |
|
| 238 | $output = [ |
|
| 239 | 'message' => 'git fetch has been queued', |
|
| 240 | 'id' => $fetch->ID, |
|
| 241 | 'location' => $location, |
|
| 242 | ]; |
|
| 243 | ||
| 244 | $response = $this->getAPIResponse($output, 201); |
|
| 245 | $response->addHeader('Location', $location); |
|
| 246 | return $response; |
|
| 247 | } |
|
| 248 | ||
| 249 | /** |
|
| 250 | * @param $project |
|