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