From a7a90195a993d1c2bcd86a2e478f46d0dd080281 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Tue, 18 Mar 2014 22:57:05 +0700 Subject: [PATCH 1/3] ProjectController::view 404 fix --- PHPCI/Controller/ProjectController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index 19fb3149..03c8c1ac 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -17,6 +17,7 @@ use b8\Config; use b8\Controller; use b8\Store; use b8\Form; +use b8\Exception\HttpException\NotFoundException; /** * Project Controller - Allows users to create, edit and view projects. @@ -47,7 +48,11 @@ class ProjectController extends \PHPCI\Controller */ public function view($projectId) { - $project = $this->projectStore->getById($projectId); + $project = $this->projectStore->getById($projectId); + if (!$project) { + throw new NotFoundException('Project with id: ' . $projectId . ' not found'); + } + $page = $this->getParam('p', 1); $builds = $this->getLatestBuildsHtml($projectId, (($page - 1) * 10)); From 27023e157a3a115d8d47b7832e3a3ae6cc345dd2 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Tue, 18 Mar 2014 23:58:23 +0700 Subject: [PATCH 2/3] Fixed rm for windows --- PHPCI/Builder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PHPCI/Builder.php b/PHPCI/Builder.php index ba6d2e3a..6f04c9d8 100644 --- a/PHPCI/Builder.php +++ b/PHPCI/Builder.php @@ -216,7 +216,12 @@ class Builder implements LoggerAwareInterface // Clean up: $this->buildLogger->log('Removing build.'); - shell_exec(sprintf('rm -Rf "%s"', $this->buildPath)); + + $cmd = 'rm -Rf "%s"'; + if (IS_WIN) { + $cmd = 'deltree /Y "%s"'; + } + $this->executeCommand($cmd, $this->buildPath); // Update the build in the database, ping any external services, etc. $this->build->sendStatusPostback(); From 0896b683a53e544e8f7c2b338066b04301d1b346 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Wed, 19 Mar 2014 00:04:29 +0700 Subject: [PATCH 3/3] Fixed rm for windows --- PHPCI/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHPCI/Builder.php b/PHPCI/Builder.php index 6f04c9d8..34373ba8 100644 --- a/PHPCI/Builder.php +++ b/PHPCI/Builder.php @@ -219,7 +219,7 @@ class Builder implements LoggerAwareInterface $cmd = 'rm -Rf "%s"'; if (IS_WIN) { - $cmd = 'deltree /Y "%s"'; + $cmd = 'rmdir /S /Q "%s"'; } $this->executeCommand($cmd, $this->buildPath);