Added 'Build with debug' button for Admin on project page. Issue #22

This commit is contained in:
Dmitry Khomutov 2017-02-19 00:52:13 +07:00
commit ebb08d868b
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
9 changed files with 29 additions and 8 deletions

View file

@ -115,8 +115,16 @@ class ProjectController extends PHPCensor\Controller
throw new NotFoundException(Lang::get('project_x_not_found', $projectId));
}
$debug = (boolean)$this->getParam('debug', false);
$extra = null;
if ($debug && $this->currentUserIsAdmin()) {
$extra = [
'debug' => true,
];
}
$email = $_SESSION['php-censor-user']->getEmail();
$build = $this->buildService->createBuild($project, null, urldecode($branch), $email);
$build = $this->buildService->createBuild($project, null, urldecode($branch), $email, null, $extra);
if ($this->buildService->queueError) {
$_SESSION['global_error'] = Lang::get('add_to_queue_failed');