APIEnvironment::createDeploy PHP Метод

createDeploy() защищенный Метод

Устаревший: 2.0.0 - moved to DeployDispatcher
protected createDeploy ( ) : SS_HTTPResponse
Результат SS_HTTPResponse
    protected function createDeploy()
    {
        if (!$this->record->canDeploy($this->getMember())) {
            return $this->message('You are not authorized to do that on this environment', 403);
        }
        $reqBody = $this->getRequestBody();
        if ($reqBody === null) {
            return $this->message('the request body did not contain a valid JSON object.', 400);
        }
        if (empty($reqBody['release'])) {
            return $this->message('deploy requires a {"release": "sha1"} in the body of the request.', 400);
        }
        $strategy = new DeploymentStrategy($this->record, array('sha' => $reqBody['release']));
        $deploy = $strategy->createDeployment();
        $deploy->start();
        $location = Director::absoluteBaseURL() . $this->Link() . '/deploy/' . $deploy->ID;
        $output = array('message' => 'Deploy queued as job ' . $deploy->ResqueToken, 'href' => $location);
        $response = $this->getAPIResponse($output);
        $response->setStatusCode(201);
        $response->addHeader('Location', $location);
        return $response;
    }