From 1dcc483ccbc5ddd3e52ad27179a3ba3d7eeeb0db Mon Sep 17 00:00:00 2001 From: Marc Aschmann Date: Tue, 15 Jul 2014 11:28:16 +0200 Subject: [PATCH 01/13] resolves #497 added feature to disable auth with a default user --- PHPCI/Application.php | 26 +++++++++++- PHPCI/Controller/SettingsController.php | 53 +++++++++++++++++++++++++ PHPCI/View/Settings/index.phtml | 21 ++++++++++ 3 files changed, 98 insertions(+), 2 deletions(-) diff --git a/PHPCI/Application.php b/PHPCI/Application.php index 3e15686e..6e90a76f 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -14,6 +14,7 @@ use b8\Exception\HttpException; use b8\Http\Response; use b8\Http\Response\RedirectResponse; use b8\View; +use Symfony\Component\Yaml\Parser; /** * PHPCI Front Controller @@ -43,11 +44,32 @@ class Application extends b8\Application return false; }; + // load settings to check if there's a configured default user and auth disabled + $skipAuth = function () { + $parser = new Parser(); + $yaml = file_get_contents(APPLICATION_PATH . 'PHPCI/config.yml'); + $settings = $parser->parse($yaml); + if ((!empty($settings['phpci']['authentication_settings']['state']) + && 1 == (int)$settings['phpci']['authentication_settings']['state']) + && !empty($settings['phpci']['authentication_settings']['user_id']) + ) { + $user = b8\Store\Factory::getStore('User') + ->getByPrimaryKey($settings['phpci']['authentication_settings']['user_id']); + + if ($user) { + $_SESSION['user'] = $user; + return true; + } + } + + return false; + }; + // Handler for the route we're about to register, checks for a valid session where necessary: - $routeHandler = function (&$route, Response &$response) use (&$request, $validateSession) { + $routeHandler = function (&$route, Response &$response) use (&$request, $validateSession, $skipAuth) { $skipValidation = in_array($route['controller'], array('session', 'webhook', 'build-status')); - if (!$skipValidation && !$validateSession()) { + if (!$skipValidation && !$validateSession() && !$skipAuth()) { if ($request->isAjax()) { $response->setResponseCode(401); $response->setContent(''); diff --git a/PHPCI/Controller/SettingsController.php b/PHPCI/Controller/SettingsController.php index ebcab7e8..51edf749 100644 --- a/PHPCI/Controller/SettingsController.php +++ b/PHPCI/Controller/SettingsController.php @@ -41,13 +41,19 @@ class SettingsController extends Controller $this->view->settings = $this->settings; $emailSettings = array(); + $authenticationSettings = array(); if (isset($this->settings['phpci']['email_settings'])) { $emailSettings = $this->settings['phpci']['email_settings']; } + if (isset($this->settings['phpci']['authentication_settings'])) { + $authenticationSettings = $this->settings['phpci']['authentication_settings']; + } + $this->view->github = $this->getGithubForm(); $this->view->emailSettings = $this->getEmailForm($emailSettings); + $this->view->authenticationSettings = $this->getAuthenticationForm($authenticationSettings); $this->view->isWriteable = $this->canWriteConfig(); if (!empty($this->settings['phpci']['github']['token'])) { @@ -86,6 +92,23 @@ class SettingsController extends Controller die; } + public function authentication() + { + $this->settings['phpci']['authentication_settings']['state'] = $this->getParam('disable_authentication', 0); + $this->settings['phpci']['authentication_settings']['user_id'] = $_SESSION['user_id']; + + $error = $this->storeSettings(); + + if ($error) { + header('Location: ' . PHPCI_URL . 'settings?saved=2'); + } else { + header('Location: ' . PHPCI_URL . 'settings?saved=1'); + } + + die; + } + + /** * Github redirects users back to this URL when t */ @@ -236,6 +259,36 @@ class SettingsController extends Controller return $form; } + protected function getAuthenticationForm($values = array()) + { + $form = new Form(); + $form->setMethod('POST'); + $form->setAction(PHPCI_URL . 'settings/authentication'); + $form->addField(new Form\Element\Csrf('csrf')); + + $field = new Form\Element\Checkbox('disable_authentication'); + $field->setCheckedValue(1); + $field->setRequired(false); + $field->setLabel('Disable Authentication?'); + $field->setContainerClass('form-group'); + $field->setValue(0); + + if (isset($values['state'])) { + $field->setValue((int)$values['state']); + } + + $form->addField($field); + + $field = new Form\Element\Submit(); + $field->setValue('Save »'); + $field->setClass('btn btn-success pull-right'); + $form->addField($field); + + $form->setValues($values); + + return $form; + } + protected function getGithubUser($token) { $http = new HttpClient('https://api.github.com'); diff --git a/PHPCI/View/Settings/index.phtml b/PHPCI/View/Settings/index.phtml index 322206c4..462a2977 100644 --- a/PHPCI/View/Settings/index.phtml +++ b/PHPCI/View/Settings/index.phtml @@ -96,6 +96,27 @@ +
+ +
+ + + +
+
+
+

Authentication Settings

+ +

+ Be careful: This setting disables authentication and uses your preconfigured admin account for all actions within phpci with admin rights. +

+ +
+ +
+ +
+
From effd6909aa3ca7d52ff8b9244151faa698668e01 Mon Sep 17 00:00:00 2001 From: Marc Aschmann Date: Sun, 7 Dec 2014 17:51:00 +0100 Subject: [PATCH 02/13] reimplemented disable user --- PHPCI/Application.php | 37 +++++--- PHPCI/Controller/SettingsController.php | 110 ++++++++++++++++++++---- PHPCI/View/Settings/index.phtml | 32 +++---- 3 files changed, 129 insertions(+), 50 deletions(-) diff --git a/PHPCI/Application.php b/PHPCI/Application.php index 60aef140..9accc5fc 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -22,6 +22,9 @@ use PHPCI\Model\Build; */ class Application extends b8\Application { + /** + * init + */ public function init() { $request =& $this->request; @@ -44,24 +47,22 @@ class Application extends b8\Application return false; }; - // load settings to check if there's a configured default user and auth disabled + // Check settings for disable_authentication enabled and user_id $skipAuth = function () { - /** $parser = new Parser(); - $yaml = file_get_contents(APPLICATION_PATH . 'PHPCI/config.yml'); - $settings = $parser->parse($yaml); - if ((!empty($settings['phpci']['authentication_settings']['state']) - && 1 == (int)$settings['phpci']['authentication_settings']['state']) - && !empty($settings['phpci']['authentication_settings']['user_id']) - ) { + $config = b8\Config::getInstance(); + $state = (bool)$config->get('phpci.authentication_settings.state', false); + $id = $config->get('phpci.authentication_settings.user_id', 0); + + if (false !== $state && 0 != (int)$id) { $user = b8\Store\Factory::getStore('User') - ->getByPrimaryKey($settings['phpci']['authentication_settings']['user_id']); + ->getByPrimaryKey($id); if ($user) { - $_SESSION['user'] = $user; + $_SESSION['phpci_user'] = $user; return true; } } -*/ + return false; }; @@ -88,9 +89,12 @@ class Application extends b8\Application $this->router->clearRoutes(); $this->router->register($route, $opts, $routeHandler); } + /** - * Handle an incoming web request. - */ + * Handle an incoming web request. + * + * @return b8\b8\Http\Response|Response + */ public function handleRequest() { try { @@ -123,6 +127,10 @@ class Application extends b8\Application return $this->response; } + /** + * @param $class + * @return mixed + */ protected function loadController($class) { $controller = parent::loadController($class); @@ -133,6 +141,9 @@ class Application extends b8\Application return $controller; } + /** + * @param View $layout + */ protected function setLayoutVariables(View &$layout) { /** @var \PHPCI\Store\ProjectStore $projectStore */ diff --git a/PHPCI/Controller/SettingsController.php b/PHPCI/Controller/SettingsController.php index 7dd15f27..067ba914 100644 --- a/PHPCI/Controller/SettingsController.php +++ b/PHPCI/Controller/SettingsController.php @@ -19,23 +19,34 @@ use Symfony\Component\Yaml\Parser; /** * Settings Controller + * * @author Dan Cryer * @package PHPCI * @subpackage Web */ class SettingsController extends Controller { + + /** + * @var array + */ protected $settings; + /** + * + */ public function init() { parent::init(); - $parser = new Parser(); - $yaml = file_get_contents(APPLICATION_PATH . 'PHPCI/config.yml'); + $parser = new Parser(); + $yaml = file_get_contents(APPLICATION_PATH . 'PHPCI/config.yml'); $this->settings = $parser->parse($yaml); } + /** + * @return string + */ public function index() { $this->view->settings = $this->settings; @@ -50,10 +61,16 @@ class SettingsController extends Controller $buildSettings = $this->settings['phpci']['build']; } - $this->view->github = $this->getGithubForm(); - $this->view->emailSettings = $this->getEmailForm($emailSettings); - $this->view->buildSettings = $this->getBuildForm($buildSettings); - $this->view->isWriteable = $this->canWriteConfig(); + $authenticationSettings = array(); + if (isset($this->settings['phpci']['authentication_settings'])) { + $authenticationSettings = $this->settings['phpci']['authentication_settings']; + } + + $this->view->github = $this->getGithubForm(); + $this->view->emailSettings = $this->getEmailForm($emailSettings); + $this->view->buildSettings = $this->getBuildForm($buildSettings); + $this->view->isWriteable = $this->canWriteConfig(); + $this->view->authenticationSettings = $this->getAuthenticationForm($authenticationSettings); if (!empty($this->settings['phpci']['github']['token'])) { $this->view->githubUser = $this->getGithubUser($this->settings['phpci']['github']['token']); @@ -62,13 +79,16 @@ class SettingsController extends Controller return $this->view->render(); } + /** + * @throws \PHPCI\ForbiddenException + */ public function github() { $this->requireAdmin(); - $this->settings['phpci']['github']['id'] = $this->getParam('githubid', ''); + $this->settings['phpci']['github']['id'] = $this->getParam('githubid', ''); $this->settings['phpci']['github']['secret'] = $this->getParam('githubsecret', ''); - $error = $this->storeSettings(); + $error = $this->storeSettings(); if ($error) { header('Location: ' . PHPCI_URL . 'settings?saved=2'); @@ -79,11 +99,14 @@ class SettingsController extends Controller die; } + /** + * @throws \PHPCI\ForbiddenException + */ public function email() { $this->requireAdmin(); - $this->settings['phpci']['email_settings'] = $this->getParams(); + $this->settings['phpci']['email_settings'] = $this->getParams(); $this->settings['phpci']['email_settings']['smtp_encryption'] = $this->getParam('smtp_encryption', 0); $error = $this->storeSettings(); @@ -97,6 +120,9 @@ class SettingsController extends Controller die; } + /** + * @throws \PHPCI\ForbiddenException + */ public function build() { $this->requireAdmin(); @@ -114,19 +140,42 @@ class SettingsController extends Controller die; } + /** + * Handle authentication settings + * + * @throws \PHPCI\ForbiddenException + */ + public function authentication() + { + $this->requireAdmin(); + + $this->settings['phpci']['authentication_settings']['state'] = $this->getParam('disable_authentication', 0); + $this->settings['phpci']['authentication_settings']['user_id'] = $_SESSION['phpci_user_id']; + + $error = $this->storeSettings(); + + if ($error) { + header('Location: ' . PHPCI_URL . 'settings?saved=2'); + } else { + header('Location: ' . PHPCI_URL . 'settings?saved=1'); + } + + die; + } + /** * Github redirects users back to this URL when t */ public function githubCallback() { - $code = $this->getParam('code', null); + $code = $this->getParam('code', null); $github = $this->settings['phpci']['github']; if (!is_null($code)) { - $http = new HttpClient(); - $url = 'https://github.com/login/oauth/access_token'; + $http = new HttpClient(); + $url = 'https://github.com/login/oauth/access_token'; $params = array('client_id' => $github['id'], 'client_secret' => $github['secret'], 'code' => $code); - $resp = $http->post($url, $params); + $resp = $http->post($url, $params); if ($resp['success']) { parse_str($resp['body'], $resp); @@ -146,12 +195,13 @@ class SettingsController extends Controller /** * Convert config to yaml and store to file. + * * @return mixed */ protected function storeSettings() { $dumper = new Dumper(); - $yaml = $dumper->dump($this->settings, 4); + $yaml = $dumper->dump($this->settings, 4); file_put_contents(APPLICATION_PATH . 'PHPCI/config.yml', $yaml); if (error_get_last()) { @@ -160,6 +210,9 @@ class SettingsController extends Controller } } + /** + * @return Form + */ protected function getGithubForm() { $form = new Form(); @@ -199,6 +252,10 @@ class SettingsController extends Controller return $form; } + /** + * @param array $values + * @return Form + */ protected function getEmailForm($values = array()) { $form = new Form(); @@ -269,6 +326,10 @@ class SettingsController extends Controller return $form; } + /** + * @param $token + * @return mixed + */ protected function getGithubUser($token) { $http = new HttpClient('https://api.github.com'); @@ -277,11 +338,18 @@ class SettingsController extends Controller return $user['body']; } + /** + * @return bool + */ protected function canWriteConfig() { return is_writeable(APPLICATION_PATH . 'PHPCI/config.yml'); } + /** + * @param array $values + * @return Form + */ protected function getBuildForm($values = array()) { $form = new Form(); @@ -294,10 +362,10 @@ class SettingsController extends Controller $field->setClass('form-control'); $field->setContainerClass('form-group'); $field->setOptions([ - 300 => '5 Minutes', - 900 => '15 Minutes', - 1800 => '30 Minutes', - 3600 => '1 Hour', + 300 => '5 Minutes', + 900 => '15 Minutes', + 1800 => '30 Minutes', + 3600 => '1 Hour', 10800 => '3 Hours', ]); $field->setValue(1800); @@ -314,6 +382,12 @@ class SettingsController extends Controller return $form; } + /** + * Form for disabling user authentication while using a default user + * + * @param array $values + * @return Form + */ protected function getAuthenticationForm($values = array()) { $form = new Form(); diff --git a/PHPCI/View/Settings/index.phtml b/PHPCI/View/Settings/index.phtml index 11dc58b8..e88a3001 100644 --- a/PHPCI/View/Settings/index.phtml +++ b/PHPCI/View/Settings/index.phtml @@ -106,23 +106,17 @@
-
-
-
-

Authentication Settings

- -

- Be careful: This setting disables authentication and uses your preconfigured admin account for all actions within phpci with admin rights. -

- -
- -
- -
- -
- -
+
+
+

Authentication Settings

-
\ No newline at end of file + +
+

+ Be careful: This setting disables authentication and uses your current admin account for all actions within phpci with admin rights. +

+ + + +
+
From 036501b3637b186973206be6b48bd0b64e3c7807 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 11 Dec 2014 14:35:07 +0000 Subject: [PATCH 03/13] Removing apparently redundant requirement for mcrypt. --- Dockerfile | 2 +- PHPCI/Command/InstallCommand.php | 2 +- PHPCI/Controller/PluginController.php | 1 - composer.json | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f0c8b605..af646d09 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C E5267A6C 0 RUN apt-get update # Install PHP: -RUN apt-get install -qy git-core php5-common php5-cli php5-curl php5-imap php5-mcrypt php5-mysqlnd +RUN apt-get install -qy git-core php5-common php5-cli php5-curl php5-imap php5-mysqlnd # Give Git some fake user details to prevent it asking when trying to test merges: RUN git config --global user.name "PHPCI" diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index a4a0c4bb..29024090 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -118,7 +118,7 @@ class InstallCommand extends Command } // Check required extensions are present: - $requiredExtensions = array('PDO', 'pdo_mysql', 'mcrypt'); + $requiredExtensions = array('PDO', 'pdo_mysql'); foreach ($requiredExtensions as $extension) { if (!extension_loaded($extension)) { diff --git a/PHPCI/Controller/PluginController.php b/PHPCI/Controller/PluginController.php index 12aa18fc..31dfdf91 100644 --- a/PHPCI/Controller/PluginController.php +++ b/PHPCI/Controller/PluginController.php @@ -25,7 +25,6 @@ class PluginController extends \PHPCI\Controller { protected $required = array( 'php', - 'ext-mcrypt', 'ext-pdo', 'ext-pdo_mysql', 'block8/b8framework', diff --git a/composer.json b/composer.json index dbced983..899bc083 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,6 @@ "require": { "php": ">=5.3.8", - "ext-mcrypt": "*", "ext-pdo": "*", "ext-pdo_mysql": "*", "block8/b8framework": "~1.0", From 82ecb97fba88d3160f6a518b03bd007468f89c2c Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 11 Dec 2014 14:35:16 +0000 Subject: [PATCH 04/13] Updating composer.lock --- composer.lock | 141 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 92 insertions(+), 49 deletions(-) diff --git a/composer.lock b/composer.lock index b56848df..9b790913 100644 --- a/composer.lock +++ b/composer.lock @@ -1,9 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" ], - "hash": "650fe5576922dea4ac3b1be72d882a58", + "hash": "8b68ffb25f62f3245d64c9e97e8cd70e", "packages": [ { "name": "block8/b8framework", @@ -311,16 +312,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.3.0", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "b86b927dfefdb56ab0b22d1350033d9a38e9f205" + "reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/b86b927dfefdb56ab0b22d1350033d9a38e9f205", - "reference": "b86b927dfefdb56ab0b22d1350033d9a38e9f205", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/c5f963e7f9d6f6438fda4f22d5cc2db296ec621a", + "reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a", "shasum": "" }, "require": { @@ -359,7 +360,7 @@ "mail", "mailer" ], - "time": "2014-10-04 05:53:18" + "time": "2014-12-05 14:17:14" }, { "name": "symfony/class-loader", @@ -721,25 +722,25 @@ }, { "name": "pdepend/pdepend", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "dc582a3c0180664a8fbfc5a34efaf4cc13fccc60" + "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/dc582a3c0180664a8fbfc5a34efaf4cc13fccc60", - "reference": "dc582a3c0180664a8fbfc5a34efaf4cc13fccc60", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/1b0acf162da4f30237987e61e177a57f78e3d87e", + "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e", "shasum": "" }, "require": { - "symfony/config": "@stable", - "symfony/dependency-injection": "@stable", - "symfony/filesystem": "@stable" + "symfony/config": ">=2.4", + "symfony/dependency-injection": ">=2.4", + "symfony/filesystem": ">=2.4" }, "require-dev": { - "phpunit/phpunit": "3.*@stable", + "phpunit/phpunit": "4.*@stable", "squizlabs/php_codesniffer": "@stable" }, "bin": [ @@ -756,7 +757,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2014-10-08 06:54:50" + "time": "2014-12-04 12:38:39" }, { "name": "phpdocumentor/reflection-docblock", @@ -1252,16 +1253,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.3.5", + "version": "4.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1" + "reference": "bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1", - "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0", + "reference": "bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0", "shasum": "" }, "require": { @@ -1278,8 +1279,9 @@ "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.0", "sebastian/diff": "~1.1", - "sebastian/environment": "~1.0", + "sebastian/environment": "~1.1", "sebastian/exporter": "~1.0", + "sebastian/global-state": "~1.0", "sebastian/version": "~1.0", "symfony/yaml": "~2.0" }, @@ -1292,7 +1294,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3.x-dev" + "dev-master": "4.4.x-dev" } }, "autoload": { @@ -1301,10 +1303,6 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "", - "../../symfony/yaml/" - ], "license": [ "BSD-3-Clause" ], @@ -1316,13 +1314,13 @@ } ], "description": "The PHP Unit Testing framework.", - "homepage": "http://www.phpunit.de/", + "homepage": "https://phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], - "time": "2014-11-11 10:11:09" + "time": "2014-12-05 06:49:03" }, { "name": "phpunit/phpunit-mock-objects", @@ -1381,16 +1379,16 @@ }, { "name": "sebastian/comparator", - "version": "1.0.1", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" + "reference": "c484a80f97573ab934e37826dba0135a3301b26a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/c484a80f97573ab934e37826dba0135a3301b26a", + "reference": "c484a80f97573ab934e37826dba0135a3301b26a", "shasum": "" }, "require": { @@ -1404,7 +1402,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -1441,7 +1439,7 @@ "compare", "equality" ], - "time": "2014-05-11 23:00:21" + "time": "2014-11-16 21:32:38" }, { "name": "sebastian/diff", @@ -1695,6 +1693,57 @@ ], "time": "2013-08-04 09:35:29" }, + { + "name": "sebastian/global-state", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2014-10-06 09:23:50" + }, { "name": "sebastian/version", "version": "1.0.3", @@ -1732,16 +1781,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "1.5.5", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5d973e59cf58a0c847f298de84374c96b42b17b3" + "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5d973e59cf58a0c847f298de84374c96b42b17b3", - "reference": "5d973e59cf58a0c847f298de84374c96b42b17b3", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6f3e42d311b882b25b4d409d23a289f4d3b803d5", + "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5", "shasum": "" }, "require": { @@ -1803,7 +1852,7 @@ "phpcs", "standards" ], - "time": "2014-09-25 03:33:46" + "time": "2014-12-04 22:32:15" }, { "name": "symfony/dependency-injection", @@ -1950,20 +1999,14 @@ "time": "2014-09-13 10:57:19" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], + "stability-flags": [], + "prefer-stable": false, "platform": { "php": ">=5.3.8", - "ext-mcrypt": "*", "ext-pdo": "*", "ext-pdo_mysql": "*" }, - "platform-dev": [ - - ] + "platform-dev": [] } From 977a37173d5dd2214da2d1e6f9f5e11d47a5014b Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Fri, 12 Dec 2014 14:57:19 +0000 Subject: [PATCH 05/13] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e2c155fa..759f715d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ We have a chat room for discussing PHPCI, you can access it here: [![Gitter](htt * Clones your project from Github, Bitbucket or a local path * Allows you to set up and tear down test databases. * Installs your project's Composer dependencies. -* Runs through any combination of the [supported plugins](https://github.com/Block8/PHPCI/wiki#plugins). +* Runs through any combination of the [supported plugins](https://www.phptesting.org/wiki#plugins). * You can mark directories for the plugins to ignore. * You can mark certain plugins as being allowed to fail (but still run.) @@ -27,10 +27,10 @@ We have a chat room for discussing PHPCI, you can access it here: [![Gitter](htt * Deployments. ## Getting Started: -We've got documentation on our wiki on [installing PHPCI](https://github.com/Block8/PHPCI/wiki/Installing-PHPCI) and [adding support for PHPCI to your projects](https://github.com/Block8/PHPCI/wiki/Adding-PHPCI-Support-to-Your-Projects). +We've got documentation on our website on [installing PHPCI](https://www.phptesting.org/install-phpci) and [adding support for PHPCI to your projects](https://www.phptesting.org/wiki/Adding-PHPCI-Support-to-Your-Projects). ##Contributing -Contributions from others would be very much appreciated! Please read our [guide to contributing](https://github.com/Block8/PHPCI/wiki/Contributing-to-PHPCI) for more information on how to get involved. +Contributions from others would be very much appreciated! Please read our [guide to contributing](https://www.phptesting.org/wiki/Contributing-to-PHPCI) for more information on how to get involved. ##Questions? Your best place to go is the [mailing list](https://groups.google.com/forum/#!forum/php-ci), if you're already a member of the mailing list, you can simply email php-ci@googlegroups.com. From 965636efde8ae3029bd497902dc4c2e645cef807 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 18 Dec 2014 09:34:07 +0000 Subject: [PATCH 06/13] Fix checking of environment variable for PHPCI config file. --- bootstrap.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index c2f9c69b..bee42220 100755 --- a/bootstrap.php +++ b/bootstrap.php @@ -20,12 +20,9 @@ if (empty($timezone)) { // env for an alternative config path. $configFile = dirname(__FILE__) . '/PHPCI/config.yml'; -if (!file_exists($configFile)) { - $configEnv = getenv('phpci_config_file'); - - if (!empty($configEnv)) { - $configFile = $configEnv; - } +$configEnv = getenv('phpci_config_file'); +if (!empty($configEnv)) { + $configFile = $configEnv; } // If we don't have a config file at all, fail at this point and tell the user to install: From 67b2348a7ad489d9881459342c837b5880bda815 Mon Sep 17 00:00:00 2001 From: Alex Davyskiba Date: Sat, 13 Dec 2014 10:42:55 +0200 Subject: [PATCH 07/13] Fix word wrapping on public key. Closes #703 --- PHPCI/View/Project/view.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHPCI/View/Project/view.phtml b/PHPCI/View/Project/view.phtml index 38cfcc4c..3259c71c 100644 --- a/PHPCI/View/Project/view.phtml +++ b/PHPCI/View/Project/view.phtml @@ -91,7 +91,7 @@ getSshPublicKey()): ?>
-
getSshPublicKey(); ?>
+
getSshPublicKey(); ?>
From f37c3450e3031ef2528bc006acff0a5fbdf9e776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= Date: Thu, 18 Dec 2014 09:48:45 +0100 Subject: [PATCH 08/13] In build view, only show meta of builds for the branch of the selected build. --- PHPCI/Controller/BuildController.php | 2 +- PHPCI/Store/BuildStore.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index cc2f9cb3..18377ee9 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -120,7 +120,7 @@ class BuildController extends \PHPCI\Controller $data = null; if ($key && $build) { - $data = $this->buildStore->getMeta($key, $build->getProjectId(), $buildId, $numBuilds); + $data = $this->buildStore->getMeta($key, $build->getProjectId(), $buildId, $build->getBranch(), $numBuilds); } die(json_encode($data)); diff --git a/PHPCI/Store/BuildStore.php b/PHPCI/Store/BuildStore.php index fc445f54..4f849fa6 100644 --- a/PHPCI/Store/BuildStore.php +++ b/PHPCI/Store/BuildStore.php @@ -114,21 +114,28 @@ class BuildStore extends BuildStoreBase * @param $key * @param $projectId * @param null $buildId + * @param null $branch * @param int $numResults * @return array|null */ - public function getMeta($key, $projectId, $buildId = null, $numResults = 1) + public function getMeta($key, $projectId, $buildId = null, $branch = null, $numResults = 1) { - $select = '`build_id`, `meta_key`, `meta_value`'; - $and = $numResults > 1 ? ' AND (`build_id` <= :buildId) ' : ' AND (`build_id` = :buildId) '; - $where = '`meta_key` = :key AND `project_id` = :projectId ' . $and; - $query = 'SELECT '.$select.' FROM `build_meta` WHERE '.$where.' ORDER BY id DESC LIMIT :numResults'; + $select = '`bm`.`build_id`, `bm`.`meta_key`, `bm`.`meta_value`'; + $and = $numResults > 1 ? ' AND (`bm`.`build_id` <= :buildId) ' : ' AND (`bm`.`build_id` = :buildId) '; + $where = '`bm`.`meta_key` = :key AND `bm`.`project_id` = :projectId ' . $and; + $from = ' `build_meta` AS `bm`'; + if($branch !== null) { + $where .= ' AND `b`.`branch` = :branch AND `b`.`id`= `bm`.`build_id` '; + $from .= ', `build` AS `b`'; + } + $query = 'SELECT '.$select.' FROM '.$from.' WHERE '.$where.' ORDER BY `bm`.id DESC LIMIT :numResults'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bindValue(':key', $key, \PDO::PARAM_STR); $stmt->bindValue(':projectId', (int)$projectId, \PDO::PARAM_INT); $stmt->bindValue(':buildId', (int)$buildId, \PDO::PARAM_INT); $stmt->bindValue(':numResults', (int)$numResults, \PDO::PARAM_INT); + $stmt->bindValue(':branch', $branch, \PDO::PARAM_STR); if ($stmt->execute()) { $rtn = $stmt->fetchAll(\PDO::FETCH_ASSOC); From 0beb77113aa41d4dacb497668233baf15ff96938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= Date: Wed, 17 Dec 2014 16:53:47 +0100 Subject: [PATCH 09/13] Have the PhpUnit plugin reports an explicit error when no test are configured. Closes #711 --- PHPCI/Plugin/PhpUnit.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PHPCI/Plugin/PhpUnit.php b/PHPCI/Plugin/PhpUnit.php index 0d7a7ba8..48874919 100644 --- a/PHPCI/Plugin/PhpUnit.php +++ b/PHPCI/Plugin/PhpUnit.php @@ -142,6 +142,11 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin */ public function execute() { + if (empty($this->xmlConfigFile) && empty($this->directory)) { + $this->phpci->logFailure('Neither configuration file nor test directory found.'); + return false; + } + $success = true; $this->phpci->logExecOutput(false); From a2e97c69ac0491858958b914c83873f498173295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= Date: Wed, 17 Dec 2014 15:41:49 +0100 Subject: [PATCH 10/13] Prepend the build path to ignored directories in PhpParallelLint.php. Closes #710 --- PHPCI/Plugin/PhpParallelLint.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PHPCI/Plugin/PhpParallelLint.php b/PHPCI/Plugin/PhpParallelLint.php index 2b37b956..022d006f 100644 --- a/PHPCI/Plugin/PhpParallelLint.php +++ b/PHPCI/Plugin/PhpParallelLint.php @@ -105,10 +105,11 @@ class PhpParallelLint implements \PHPCI\Plugin */ protected function getFlags() { - $ignore = ''; - if (count($this->ignore)) { - $ignore = ' --exclude ' . implode(' --exclude ', $this->ignore); + $ignoreFlags = array(); + foreach ($this->ignore as $ignoreDir) { + $ignoreFlags[] = '--exclude "' . $this->phpci->buildPath . $ignoreDir . '"'; } + $ignore = implode(' ', $ignoreFlags); return array($ignore); } From 768a8a180c23efcf7407903c772c24d1e89ea115 Mon Sep 17 00:00:00 2001 From: Stephen Ball Date: Thu, 11 Dec 2014 14:41:00 +0000 Subject: [PATCH 11/13] New plugin to support PHP TAL linting. Closes #701 --- PHPCI/Plugin/Lint.php | 4 + PHPCI/Plugin/PhpTalLint.php | 266 +++++++++++++++++++ composer.json | 3 +- public/assets/js/build-plugins/phptallint.js | 79 ++++++ public/assets/js/build-plugins/warnings.js | 6 +- 5 files changed, 355 insertions(+), 3 deletions(-) create mode 100644 PHPCI/Plugin/PhpTalLint.php create mode 100644 public/assets/js/build-plugins/phptallint.js diff --git a/PHPCI/Plugin/Lint.php b/PHPCI/Plugin/Lint.php index 90436d70..65a3a2e3 100644 --- a/PHPCI/Plugin/Lint.php +++ b/PHPCI/Plugin/Lint.php @@ -68,6 +68,8 @@ class Lint implements PHPCI\Plugin $success = true; $php = $this->phpci->findBinary('php'); + + $this->phpci->logExecOutput(false); foreach ($this->directories as $dir) { if (!$this->lintDirectory($php, $dir)) { @@ -76,6 +78,8 @@ class Lint implements PHPCI\Plugin } $this->phpci->quiet = false; + + $this->phpci->logExecOutput(true); return $success; } diff --git a/PHPCI/Plugin/PhpTalLint.php b/PHPCI/Plugin/PhpTalLint.php new file mode 100644 index 00000000..01e70b3e --- /dev/null +++ b/PHPCI/Plugin/PhpTalLint.php @@ -0,0 +1,266 @@ + + * @package PHPCI + * @subpackage Plugins + */ +class PhpTalLint implements PHPCI\Plugin +{ + protected $directories; + protected $recursive = true; + protected $suffixes; + protected $ignore; + + /** + * @var \PHPCI\Builder + */ + protected $phpci; + + /** + * @var \PHPCI\Model\Build + */ + protected $build; + + /** + * @var string The path to a file contain custom phptal_tales_ functions + */ + protected $tales; + + /** + * @var int + */ + protected $allowed_warnings; + + /** + * @var int + */ + protected $allowed_errors; + + /** + * @var array The results of the lint scan + */ + protected $failedPaths = array(); + + /** + * Standard Constructor + * + * @param Builder $phpci + * @param Build $build + * @param array $options + */ + public function __construct(Builder $phpci, Build $build, array $options = array()) + { + $this->phpci = $phpci; + $this->build = $build; + $this->directories = array(''); + $this->suffixes = array('zpt'); + $this->ignore = $phpci->ignore; + + $this->allowed_warnings = 0; + $this->allowed_errors = 0; + + if (!empty($options['directory'])) { + $this->directories = array($options['directory']); + } + + if (isset($options['suffixes'])) { + $this->suffixes = (array)$options['suffixes']; + } + + $this->setOptions($options); + } + + /** + * Handle this plugin's options. + * @param $options + */ + protected function setOptions($options) + { + foreach (array('directories', 'tales', 'allowed_warnings', 'allowed_errors') as $key) { + if (array_key_exists($key, $options)) { + $this->{$key} = $options[$key]; + } + } + } + + /** + * Executes phptal lint + */ + public function execute() + { + $this->phpci->quiet = true; + $this->phpci->logExecOutput(false); + + foreach ($this->directories as $dir) { + $this->lintDirectory($dir); + } + + $this->phpci->quiet = false; + $this->phpci->logExecOutput(true); + + $errors = 0; + $warnings = 0; + + foreach ($this->failedPaths as $path) { + if ($path['type'] == 'error') { + $errors++; + } else { + $warnings++; + } + } + + $this->build->storeMeta('phptallint-warnings', $warnings); + $this->build->storeMeta('phptallint-errors', $errors); + $this->build->storeMeta('phptallint-data', $this->failedPaths); + + $success = true; + + if ($this->allowed_warnings != -1 && $warnings > $this->allowed_warnings) { + $success = false; + } + + if ($this->allowed_errors != -1 && $errors > $this->allowed_errors) { + $success = false; + } + + return $success; + } + + /** + * Lint an item (file or directory) by calling the appropriate method. + * @param $item + * @param $itemPath + * @return bool + */ + protected function lintItem($item, $itemPath) + { + $success = true; + + if ($item->isFile() && in_array(strtolower($item->getExtension()), $this->suffixes)) { + if (!$this->lintFile($itemPath)) { + $success = false; + } + } elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . '/')) { + $success = false; + } + + return $success; + } + + /** + * Run phptal lint against a directory of files. + * @param $path + * @return bool + */ + protected function lintDirectory($path) + { + $success = true; + $directory = new \DirectoryIterator($this->phpci->buildPath . $path); + + foreach ($directory as $item) { + if ($item->isDot()) { + continue; + } + + $itemPath = $path . $item->getFilename(); + + if (in_array($itemPath, $this->ignore)) { + continue; + } + + if (!$this->lintItem($item, $itemPath)) { + $success = false; + } + } + + return $success; + } + + /** + * Run phptal lint against a specific file. + * @param $path + * @return bool + */ + protected function lintFile($path) + { + $success = true; + + list($suffixes, $tales) = $this->getFlags(); + + // FIXME: Find a way to clean this up + $lint = dirname(__FILE__) . '/../../vendor/phptal/phptal/tools/phptal_lint.php'; + $cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"'; + + $this->phpci->executeCommand($cmd, $suffixes, $tales, $this->phpci->buildPath . $path); + + $output = $this->phpci->getLastOutput(); + + // FIXME: This is very messy, clean it up + if (preg_match('/Found (.+?) (error|warning)/i', $output, $matches)) { + + $rows = explode(PHP_EOL, $output); + + unset($rows[0]); + unset($rows[1]); + unset($rows[2]); + unset($rows[3]); + + foreach ($rows as $row) { + $name = basename($path); + + $row = str_replace('(use -i to include your custom modifier functions)', '', $row); + $message = str_replace($name . ': ', '', $row); + + $parts = explode(' (line ', $message); + + $message = trim($parts[0]); + $line = str_replace(')', '', $parts[1]); + + $this->failedPaths[] = array( + 'file' => $path, + 'line' => $line, + 'type' => $matches[2], + 'message' => $message + ); + } + + $success = false; + } + + return $success; + } + + /** + * Process options and produce an arguments string for PHPTAL Lint. + * @return array + */ + protected function getFlags() + { + $tales = ''; + if (!empty($this->tales)) { + $tales = ' -i ' . $this->phpci->buildPath . $this->tales; + } + + $suffixes = ''; + if (count($this->suffixes)) { + $suffixes = ' -e ' . implode(',', $this->suffixes); + } + + return array($suffixes, $tales); + } +} diff --git a/composer.json b/composer.json index 899bc083..f7d1115d 100644 --- a/composer.json +++ b/composer.json @@ -63,6 +63,7 @@ "atoum/atoum": "Atoum", "jakub-onderka/php-parallel-lint": "Parallel Linting Tool", "behat/behat": "Behat BDD Testing", - "hipchat/hipchat-php": "Hipchat integration" + "hipchat/hipchat-php": "Hipchat integration", + "phptal/phptal": "PHPTAL templating engine" } } diff --git a/public/assets/js/build-plugins/phptallint.js b/public/assets/js/build-plugins/phptallint.js new file mode 100644 index 00000000..9d981c53 --- /dev/null +++ b/public/assets/js/build-plugins/phptallint.js @@ -0,0 +1,79 @@ +var phptalPlugin = ActiveBuild.UiPlugin.extend({ + id: 'build-phptal', + css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12', + title: 'PHPTAL Lint', + lastData: null, + box: true, + rendered: false, + + register: function() { + var self = this; + var query = ActiveBuild.registerQuery('phptallint-data', -1, {key: 'phptallint-data'}) + + $(window).on('phptallint-data', function(data) { + self.onUpdate(data); + }); + + $(window).on('build-updated', function() { + if (!self.rendered) { + query(); + } + }); + }, + + render: function() { + return $('' + + '' + + '' + + ' ' + + ' ' + + ' ' + + '' + + '
FileLineMessage
'); + }, + + onUpdate: function(e) { + if (!e.queryData) { + $('#build-phptal').hide(); + return; + } + + this.rendered = true; + this.lastData = e.queryData; + + var errors = this.lastData[0].meta_value; + var tbody = $('#phptal-data tbody'); + tbody.empty(); + + if (errors.length == 0) { + $('#build-phptal').hide(); + return; + } + + for (var i in errors) { + var file = errors[i].file; + + if (ActiveBuild.fileLinkTemplate) { + var fileLink = ActiveBuild.fileLinkTemplate.replace('{FILE}', file); + fileLink = fileLink.replace('{LINE}', errors[i].line); + + file = '' + file + ''; + } + + var row = $('' + + ''+file+'' + + ''+errors[i].line+'' + + ''+errors[i].message+''); + + if (errors[i].type == 'error') { + row.addClass('danger'); + } + + tbody.append(row); + } + + $('#build-phptal').show(); + } +}); + +ActiveBuild.registerPlugin(new phptalPlugin()); diff --git a/public/assets/js/build-plugins/warnings.js b/public/assets/js/build-plugins/warnings.js index 8d09d762..0a072d59 100644 --- a/public/assets/js/build-plugins/warnings.js +++ b/public/assets/js/build-plugins/warnings.js @@ -8,7 +8,9 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ 'phpcs-errors': 'PHPCS Errors', 'phplint-errors': 'PHPLint Errors', 'phpunit-errors': 'PHPUnit Errors', - 'phpdoccheck-warnings': 'PHP Docblock Checker Warnings' + 'phpdoccheck-warnings': 'PHP Docblock Checker Warnings', + 'phptallint-errors': 'PHPTAL Lint Errors', + 'phptallint-warnings': 'PHPTAL Lint Warnings' }, data: {}, displayOnUpdate: false, @@ -22,7 +24,7 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ queries.push(ActiveBuild.registerQuery(key, -1, {num_builds: 10, key: key})); } - $(window).on('phpmd-warnings phpcs-warnings phpcs-errors phplint-errors phpunit-errors phpdoccheck-warnings', function(data) { + $(window).on('phpmd-warnings phpcs-warnings phptallint-warnings phptallint-errors phpcs-errors phplint-errors phpunit-errors phpdoccheck-warnings', function(data) { self.onUpdate(data); }); From e4bf5ee27d1021e28a7b6f57e4dc42189d1a2e71 Mon Sep 17 00:00:00 2001 From: Lucas Gois Date: Thu, 11 Dec 2014 11:56:50 -0200 Subject: [PATCH 12/13] Added support for gitlab merge requests Added function to verify if a gitlab merge request is sent. If yes, then will create a build for the source branch of the request. Closes #699 --- PHPCI/Controller/WebhookController.php | 15 +++++++++++++++ composer.lock | 8 +++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/PHPCI/Controller/WebhookController.php b/PHPCI/Controller/WebhookController.php index d1bf35bb..56ac0bff 100644 --- a/PHPCI/Controller/WebhookController.php +++ b/PHPCI/Controller/WebhookController.php @@ -256,6 +256,21 @@ class WebhookController extends \PHPCI\Controller try { + + // build on merge request events + if (isset($payload['object_kind']) && $payload['object_kind'] == 'merge_request') { + $attributes = $payload['object_attributes']; + if ( $attributes['state'] == 'opened' || $attributes['state'] == 'reopened') { + + $branch = $attributes['source_branch']; + $commit = $attributes['last_commit']; + $committer = $commit['author']['email']; + + $this->createBuild($project, $commit['id'], $branch, $committer, $commit['message'] ); + } + } + + // build on push events if (isset($payload['commits']) && is_array($payload['commits'])) { // If we have a list of commits, then add them all as builds to be tested: diff --git a/composer.lock b/composer.lock index 9b790913..f5e1b0a0 100644 --- a/composer.lock +++ b/composer.lock @@ -172,12 +172,12 @@ "version": "v1.1.1", "source": { "type": "git", - "url": "https://github.com/fabpot/Pimple.git", + "url": "https://github.com/silexphp/Pimple.git", "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d", "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d", "shasum": "" }, @@ -202,9 +202,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", From d2505dcef6598cbd72dc8dfe895e667621d6d237 Mon Sep 17 00:00:00 2001 From: Alex Davyskiba Date: Sat, 13 Dec 2014 10:00:12 +0200 Subject: [PATCH 13/13] Update Gitlab URL parsing to no longer require a project namespace. Closes #702 --- PHPCI/Service/ProjectService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PHPCI/Service/ProjectService.php b/PHPCI/Service/ProjectService.php index a0b4837f..22e940ac 100644 --- a/PHPCI/Service/ProjectService.php +++ b/PHPCI/Service/ProjectService.php @@ -115,12 +115,12 @@ class ProjectService if ($project->getType() == 'gitlab') { $info = array(); - if (preg_match('`^(.*)@(.*):([0-9]+)?/?(.*)/(.*)\.git`', $reference, $matches)) { + if (preg_match('`^(.+)@(.+):([0-9]*)\/?(.+)\.git`', $reference, $matches)) { $info['user'] = $matches[1]; $info['domain'] = $matches[2]; $info['port'] = $matches[3]; - $project->setReference($matches[4] . '/' . $matches[5]); + $project->setReference($matches[4]); } $project->setAccessInformation($info);