DNRoot::deploylog PHP Method

deploylog() public method

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