@@ 314-332 (lines=19) @@ | ||
311 | * @param \SS_HTTPRequest $request |
|
312 | * @return string - HTML |
|
313 | */ |
|
314 | public function createsnapshot(\SS_HTTPRequest $request) { |
|
315 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
316 | ||
317 | // Performs canView permission check by limiting visible projects |
|
318 | $project = $this->getCurrentProject(); |
|
319 | if (!$project) { |
|
320 | return $this->project404Response(); |
|
321 | } |
|
322 | ||
323 | if (!$project->canBackup()) { |
|
324 | return new SS_HTTPResponse("Not allowed to create snapshots on any environments", 401); |
|
325 | } |
|
326 | ||
327 | return $this->customise([ |
|
328 | 'Title' => 'Create Data Snapshot', |
|
329 | 'SnapshotsSection' => 1, |
|
330 | 'DataTransferForm' => $this->getDataTransferForm($request) |
|
331 | ])->render(); |
|
332 | } |
|
333 | ||
334 | /** |
|
335 | * Action |
|
@@ 340-358 (lines=19) @@ | ||
337 | * @param \SS_HTTPRequest $request |
|
338 | * @return string - HTML |
|
339 | */ |
|
340 | public function uploadsnapshot(\SS_HTTPRequest $request) { |
|
341 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
342 | ||
343 | // Performs canView permission check by limiting visible projects |
|
344 | $project = $this->getCurrentProject(); |
|
345 | if (!$project) { |
|
346 | return $this->project404Response(); |
|
347 | } |
|
348 | ||
349 | if (!$project->canUploadArchive()) { |
|
350 | return new SS_HTTPResponse("Not allowed to upload", 401); |
|
351 | } |
|
352 | ||
353 | return $this->customise([ |
|
354 | 'SnapshotsSection' => 1, |
|
355 | 'UploadSnapshotForm' => $this->getUploadSnapshotForm($request), |
|
356 | 'PostSnapshotForm' => $this->getPostSnapshotForm($request) |
|
357 | ])->render(); |
|
358 | } |
|
359 | ||
360 | /** |
|
361 | * Return the upload limit for snapshot uploads |