| @@ 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 |
|
| @@ 185-202 (lines=18) @@ | ||
| 182 | /** |
|
| 183 | * @return SS_HTTPResponse |
|
| 184 | */ |
|
| 185 | protected function createUpdate() { |
|
| 186 | /** @var DNGitFetch $fetch */ |
|
| 187 | $fetch = DNGitFetch::create(); |
|
| 188 | $fetch->ProjectID = $this->project->ID; |
|
| 189 | $fetch->write(); |
|
| 190 | $fetch->start(); |
|
| 191 | ||
| 192 | $location = Director::absoluteBaseURL() . $this->Link() . '/update/' . $fetch->ID; |
|
| 193 | $output = [ |
|
| 194 | 'message' => 'git fetch has been queued', |
|
| 195 | 'id' => $fetch->ID, |
|
| 196 | 'location' => $location, |
|
| 197 | ]; |
|
| 198 | ||
| 199 | $response = $this->getAPIResponse($output, 201); |
|
| 200 | $response->addHeader('Location', $location); |
|
| 201 | return $response; |
|
| 202 | } |
|
| 203 | ||
| 204 | /** |
|
| 205 | * @param $project |
|