DNRoot::transferlog PHP Method

transferlog() public method

Action - Get the latest deploy log
public transferlog ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string
    public function transferlog(\SS_HTTPRequest $request)
    {
        $this->setCurrentActionType(self::ACTION_SNAPSHOT);
        $params = $request->params();
        $transfer = DNDataTransfer::get()->byId($params['Identifier']);
        if (!$transfer || !$transfer->ID) {
            throw new SS_HTTPResponse_Exception('Transfer not found', 404);
        }
        if (!$transfer->canView()) {
            return Security::permissionFailure();
        }
        $environment = $transfer->Environment();
        $project = $environment->Project();
        if ($project->Name != $params['Project']) {
            throw new LogicException("Project in URL doesn't match this deploy");
        }
        $log = $transfer->log();
        if ($log->exists()) {
            $content = $log->content();
        } else {
            $content = 'Waiting for action to start';
        }
        return $this->sendResponse($transfer->ResqueStatus(), $content);
    }