Skip to content

Commit d3a83ac

Browse files
committed
Add rebuild with debug button. Issue #208.
1 parent 1b81591 commit d3a83ac

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

src/Controller/BuildController.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,19 @@ public function view($buildId)
126126
$rebuild = Lang::get('rebuild_now');
127127
$rebuildLink = APP_URL . 'build/rebuild/' . $build->getId();
128128

129+
$rebuildDebug = Lang::get('rebuild_now_debug');
130+
129131
$delete = Lang::get('delete_build');
130132
$deleteLink = APP_URL . 'build/delete/' . $build->getId();
131133

132134
$project = Factory::getStore('Project')->getByPrimaryKey($build->getProjectId());
133135

134136
$actions = '';
135137
if (!$project->getArchived()) {
136-
$actions .= "<a class=\"btn btn-default\" href=\"{$rebuildLink}\">{$rebuild}</a> ";
138+
if ($this->currentUserIsAdmin()) {
139+
$actions .= "<a class=\"btn btn-danger\" href=\"{$rebuildLink}?debug=1\">{$rebuildDebug}</a> ";
140+
}
141+
$actions .= "<a class=\"btn btn-success\" href=\"{$rebuildLink}\">{$rebuild}</a> ";
137142
}
138143

139144
if ($this->currentUserIsAdmin()) {
@@ -239,8 +244,13 @@ protected function getPaginatorHtml($buildId, $plugin, $severity, $isNew, $total
239244
}
240245

241246
/**
242-
* Create a build using an existing build as a template:
243-
*/
247+
* Create a build using an existing build as a template:
248+
*
249+
* @param $buildId
250+
*
251+
* @return RedirectResponse
252+
* @throws NotFoundException
253+
*/
244254
public function rebuild($buildId)
245255
{
246256
$copy = BuildFactory::getBuildById($buildId);
@@ -250,6 +260,12 @@ public function rebuild($buildId)
250260
throw new NotFoundException(Lang::get('build_x_not_found', $buildId));
251261
}
252262

263+
$debug = (boolean)$this->getParam('debug', false);
264+
265+
if ($debug && $this->currentUserIsAdmin()) {
266+
$copy->addExtraValue('debug', true);
267+
}
268+
253269
$build = $this->buildService->createDuplicateBuild($copy);
254270

255271
if ($this->buildService->queueError) {

src/Controller/ProjectController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ public function build($projectId)
208208
}
209209

210210
$extra = null;
211-
212211
if ($debug && $this->currentUserIsAdmin()) {
213212
$extra = [
214213
'debug' => true,

src/Languages/lang.en.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@
194194
'new' => 'New',
195195
'build_x_not_found' => 'Build with ID %d does not exist.',
196196
'build_n' => 'Build %d',
197-
'rebuild_now' => 'Rebuild Now',
197+
'rebuild_now' => 'Rebuild now',
198+
'rebuild_now_debug' => 'Rebuild now with debug',
198199

199200
'all_errors' => 'All errors',
200201
'only_new' => 'Only new errors',

src/Languages/lang.ru.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@
187187
'is_new' => 'Новая?',
188188
'build_x_not_found' => 'Сборки с ID %d не существует.',
189189
'build_n' => 'Сборка %d',
190-
'rebuild_now' => 'Пересобрать сейчас',
190+
'rebuild_now' => 'Пересобрать',
191+
'rebuild_now_debug' => 'Пересобрать в режиме отладки',
191192

192193
'all_errors' => 'Все ошибки',
193194
'only_new' => 'Только новые',

0 commit comments

Comments
 (0)