public function deploySummary(\SS_HTTPRequest $request)
{
// Performs canView permission check by limiting visible projects
$project = $this->getCurrentProject();
if (!$project) {
return $this->project404Response();
}
// Performs canView permission check by limiting visible projects
$environment = $this->getCurrentEnvironment($project);
if (!$environment) {
return $this->environment404Response();
}
// Plan the deployment.
$strategy = $environment->getDeployStrategy($request);
$data = $strategy->toArray();
// Add in a URL for comparing from->to code changes. Ensure that we have
// two proper 40 character SHAs, otherwise we can't show the compare link.
$interface = $project->getRepositoryInterface();
if (!empty($interface) && !empty($interface->URL) && !empty($data['changes']['Code version']['from']) && strlen($data['changes']['Code version']['from']) == '40' && !empty($data['changes']['Code version']['to']) && strlen($data['changes']['Code version']['to']) == '40') {
$compareurl = sprintf('%s/compare/%s...%s', $interface->URL, $data['changes']['Code version']['from'], $data['changes']['Code version']['to']);
$data['changes']['Code version']['compareUrl'] = $compareurl;
}
// Append json to response
$token = SecurityToken::inst();
$data['SecurityID'] = $token->getValue();
$this->extend('updateDeploySummary', $data);
return json_encode($data);
}