@@ 878-905 (lines=28) @@ | ||
875 | } |
|
876 | ||
877 | ||
878 | public function createenvlog(SS_HTTPRequest $request) { |
|
879 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
880 | ||
881 | $params = $request->params(); |
|
882 | $env = DNCreateEnvironment::get()->byId($params['Identifier']); |
|
883 | ||
884 | if(!$env || !$env->ID) { |
|
885 | throw new SS_HTTPResponse_Exception('Log not found', 404); |
|
886 | } |
|
887 | if(!$env->canView()) { |
|
888 | return Security::permissionFailure(); |
|
889 | } |
|
890 | ||
891 | $project = $env->Project(); |
|
892 | ||
893 | if($project->Name != $params['Project']) { |
|
894 | throw new LogicException("Project in URL doesn't match this deploy"); |
|
895 | } |
|
896 | ||
897 | $log = $env->log(); |
|
898 | if($log->exists()) { |
|
899 | $content = $log->content(); |
|
900 | } else { |
|
901 | $content = 'Waiting for action to start'; |
|
902 | } |
|
903 | ||
904 | return $this->sendResponse($env->ResqueStatus(), $content); |
|
905 | } |
|
906 | ||
907 | /** |
|
908 | * @param SS_HTTPRequest $request |
|
@@ 1664-1692 (lines=29) @@ | ||
1661 | * @return string |
|
1662 | * @throws SS_HTTPResponse_Exception |
|
1663 | */ |
|
1664 | public function transferlog(SS_HTTPRequest $request) { |
|
1665 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
1666 | ||
1667 | $params = $request->params(); |
|
1668 | $transfer = DNDataTransfer::get()->byId($params['Identifier']); |
|
1669 | ||
1670 | if(!$transfer || !$transfer->ID) { |
|
1671 | throw new SS_HTTPResponse_Exception('Transfer not found', 404); |
|
1672 | } |
|
1673 | if(!$transfer->canView()) { |
|
1674 | return Security::permissionFailure(); |
|
1675 | } |
|
1676 | ||
1677 | $environment = $transfer->Environment(); |
|
1678 | $project = $environment->Project(); |
|
1679 | ||
1680 | if($project->Name != $params['Project']) { |
|
1681 | throw new LogicException("Project in URL doesn't match this deploy"); |
|
1682 | } |
|
1683 | ||
1684 | $log = $transfer->log(); |
|
1685 | if($log->exists()) { |
|
1686 | $content = $log->content(); |
|
1687 | } else { |
|
1688 | $content = 'Waiting for action to start'; |
|
1689 | } |
|
1690 | ||
1691 | return $this->sendResponse($transfer->ResqueStatus(), $content); |
|
1692 | } |
|
1693 | ||
1694 | /** |
|
1695 | * Note: Submits to the same action as {@link getDataTransferForm()}, |