| @@ 916-943 (lines=28) @@ | ||
| 913 | } |
|
| 914 | ||
| 915 | ||
| 916 | public function createenvlog(SS_HTTPRequest $request) |
|
| 917 | { |
|
| 918 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
| 919 | ||
| 920 | $params = $request->params(); |
|
| 921 | $env = DNCreateEnvironment::get()->byId($params['Identifier']); |
|
| 922 | ||
| 923 | if (!$env || !$env->ID) { |
|
| 924 | throw new SS_HTTPResponse_Exception('Log not found', 404); |
|
| 925 | } |
|
| 926 | if (!$env->canView()) { |
|
| 927 | return Security::permissionFailure(); |
|
| 928 | } |
|
| 929 | ||
| 930 | $project = $env->Project(); |
|
| 931 | ||
| 932 | if ($project->Name != $params['Project']) { |
|
| 933 | throw new LogicException("Project in URL doesn't match this deploy"); |
|
| 934 | } |
|
| 935 | ||
| 936 | $log = $env->log(); |
|
| 937 | if ($log->exists()) { |
|
| 938 | $content = $log->content(); |
|
| 939 | } else { |
|
| 940 | $content = 'Waiting for action to start'; |
|
| 941 | } |
|
| 942 | ||
| 943 | return $this->sendResponse($env->ResqueStatus(), $content); |
|
| 944 | } |
|
| 945 | ||
| 946 | /** |
|
| @@ 1724-1752 (lines=29) @@ | ||
| 1721 | * @return string |
|
| 1722 | * @throws SS_HTTPResponse_Exception |
|
| 1723 | */ |
|
| 1724 | public function transferlog(SS_HTTPRequest $request) |
|
| 1725 | { |
|
| 1726 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
| 1727 | ||
| 1728 | $params = $request->params(); |
|
| 1729 | $transfer = DNDataTransfer::get()->byId($params['Identifier']); |
|
| 1730 | ||
| 1731 | if (!$transfer || !$transfer->ID) { |
|
| 1732 | throw new SS_HTTPResponse_Exception('Transfer not found', 404); |
|
| 1733 | } |
|
| 1734 | if (!$transfer->canView()) { |
|
| 1735 | return Security::permissionFailure(); |
|
| 1736 | } |
|
| 1737 | ||
| 1738 | $environment = $transfer->Environment(); |
|
| 1739 | $project = $environment->Project(); |
|
| 1740 | ||
| 1741 | if ($project->Name != $params['Project']) { |
|
| 1742 | throw new LogicException("Project in URL doesn't match this deploy"); |
|
| 1743 | } |
|
| 1744 | ||
| 1745 | $log = $transfer->log(); |
|
| 1746 | if ($log->exists()) { |
|
| 1747 | $content = $log->content(); |
|
| 1748 | } else { |
|
| 1749 | $content = 'Waiting for action to start'; |
|
| 1750 | } |
|
| 1751 | ||
| 1752 | return $this->sendResponse($transfer->ResqueStatus(), $content); |
|
| 1753 | } |
|
| 1754 | ||
| 1755 | /** |
|