diff --git a/src/PHPCensor/Controller/ProjectController.php b/src/PHPCensor/Controller/ProjectController.php index 5ea02dcf..bb17db0c 100644 --- a/src/PHPCensor/Controller/ProjectController.php +++ b/src/PHPCensor/Controller/ProjectController.php @@ -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'); diff --git a/src/PHPCensor/Languages/lang.en.php b/src/PHPCensor/Languages/lang.en.php index 6da0e0ee..e54c11a4 100644 --- a/src/PHPCensor/Languages/lang.en.php +++ b/src/PHPCensor/Languages/lang.en.php @@ -66,7 +66,8 @@ PHP Censor', 'manage_users' => 'Manage Users', 'plugins' => 'Plugins', 'view' => 'View', - 'build_now' => 'Build Now', + 'build_now' => 'Build now', + 'build_now_debug' => 'Build now with debug', 'edit_project' => 'Edit Project', 'delete_project' => 'Delete Project', diff --git a/src/PHPCensor/Languages/lang.ru.php b/src/PHPCensor/Languages/lang.ru.php index 50e3f34f..9a1cad9a 100644 --- a/src/PHPCensor/Languages/lang.ru.php +++ b/src/PHPCensor/Languages/lang.ru.php @@ -65,6 +65,7 @@ PHP Censor', 'plugins' => 'Плагины', 'view' => 'Отчет', 'build_now' => 'Собрать', + 'build_now_debug' => 'Собрать в режиме отладки', 'edit_project' => 'Редактировать проект', 'delete_project' => 'Удалить проект', diff --git a/src/PHPCensor/Logging/BuildLogger.php b/src/PHPCensor/Logging/BuildLogger.php index ac9efee0..b1e58c83 100644 --- a/src/PHPCensor/Logging/BuildLogger.php +++ b/src/PHPCensor/Logging/BuildLogger.php @@ -38,7 +38,7 @@ class BuildLogger implements LoggerAwareInterface public function __construct(LoggerInterface $logger, Build $build) { $this->logger = $logger; - $this->build = $build; + $this->build = $build; } /** @@ -101,7 +101,10 @@ class BuildLogger implements LoggerAwareInterface */ public function logDebug($message) { - if (defined('DEBUG_MODE') && DEBUG_MODE) { + if ( + (defined('DEBUG_MODE') && DEBUG_MODE) || + ((boolean)$this->build->getExtra('debug')) + ) { $this->log("\033[0;36m" . $message . "\033[0m"); } } diff --git a/src/PHPCensor/Migrations/20170218175400_fixed_build_error_message_column.php b/src/PHPCensor/Migrations/20170218175400_fixed_build_error_message_column.php new file mode 100644 index 00000000..c142fd5c --- /dev/null +++ b/src/PHPCensor/Migrations/20170218175400_fixed_build_error_message_column.php @@ -0,0 +1,18 @@ +table('build_error') + ->changeColumn('message', 'text') + ->save(); + } + + public function down() + { + } +} diff --git a/src/PHPCensor/View/Project/view.phtml b/src/PHPCensor/View/Project/view.phtml index f01bc5f7..e2fe6ca5 100644 --- a/src/PHPCensor/View/Project/view.phtml +++ b/src/PHPCensor/View/Project/view.phtml @@ -16,7 +16,13 @@