diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index c2f33e73..00000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,41 +0,0 @@ -Contributions to PHPCI are very much encouraged, and we do our best to make it as welcoming and simple as possible. - -### Before You Start -Before you start, please make sure that you are aware of, and agree to, the following conditions of contribution: - -* By making a contribution to PHPCI, you accept that you are granting copyright ownership for that contribution to Block 8 Limited - the company responsible for PHPCI. In countries where copyright reassignment is not permitted, you grant Block 8 Limited a perpetual, non-exclusive licence to use your contribution in any way and for any purpose. - -* By making a contribution to PHPCI, you accept that your code will be released under the open-source [BSD 2-Clause Licence](https://github.com/Block8/PHPCI/blob/master/LICENSE.md). - -Block 8 are committed to PHPCI being a truly free and open source project, providing easy to use continuous integration and testing to as many developers as possible. We may, at our sole discretion, provide paid services based upon PHPCI - but PHPCI will always remain free (as in cost, and freedom) and open source. - -### The Contribution Process - -1. If you are thinking of making a large change or feature addition, [open an issue](/Block8/PHPCI/issues) titled "Intent to implement: ". Describe your idea in detail and discuss it with the community. It might be that someone already has a plan, could help you out, or your idea may simply not be suitable for the project at this time. -2. Fork the PHPCI project on Github -3. Add a feature or fix a bug - We recommend that you do this on a branch within your repository. -4. Create a pull request containing just the one change you want to contribute back to PHPCI. If you have more than one feature or bug fix, please create separate branches within your repository, and then submit a separate pull request for each one. Your pull request should use the template detailed below. -5. We'll then review your pull request and give any necessary feedback, this could be: - * Suggestions to improve your implementation - * Questions - * Issues/bugs related to the change - * Coding standards pointers -6. Once everyone is happy with the submission, we'll merge it back into PHPCI. Your change will then be included in the next project release. - -### Not sure what to start with? -We maintain two labels within our issue tracker that may be of interest to new contributors: - -* [The "Easy Fix" List](https://github.com/Block8/PHPCI/labels/flag:easy-fix) -* [The "Priority" List](https://github.com/Block8/PHPCI/labels/flag:priority) - -### Coding Standards -We require that all contributions meet at least the following guidelines: - -* PSR-1 & PSR-2 compliance for all code -* Doc-blocks for all classes and methods -* All files must contain the standard file-level docblock, including the copyright, license and link tags. - -All pull requests will be checked against these standards. If you're modifying a file as part of your change which does not comply with the above, please make the necessary changes to bring it into compliance prior to submitting the pull request. - -### Other Requirements -When you're adding new features or functionality, or you're updating existing functionality, please ensure that the relevant documentation is also either created or updated on the Wiki. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 16692061..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,28 +0,0 @@ -Before submitting your issue, please make sure that you've checked all of the checkboxes below. - -- [ ] You're running the [latest release](https://github.com/Block8/PHPCI/releases/latest) version of PHPCI. -- [ ] Ensure that you're running at least PHP 5.3.6, you can check this by running `php -v` -- [ ] You've run `composer install --no-dev -o` from the root of your installation. -- [ ] You have set up either the PHPCI [Worker](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Worker), [Daemon](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Daemon) or [Cron Job](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-Cron) to run builds. - -To help us better understand your issue, please answer the following. - -### Expected behaviour - -*Please describe what you're expecting to see happen.* - -### Actual behaviour - -*Please describe what you're actually seeing happen.* - -### Steps to reproduce - -*If your issue requires any specific steps to reproduce, please outline them here.* - -### Environment info -Operating System: -PHP Version: -MySQL Version: - -### Logs or other output that would be helpful -(If logs are large, please upload as attachment). \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 65d060ab..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,23 +0,0 @@ -Contribution Type: bug fix | new plugin | new feature | refactor | cosmetic -Link to Intent to Implement: -Link to Bug: - -This pull request affects the following areas: - -* [ ] Front-End -* [ ] Builder -* [ ] Build Plugins - -**In raising this pull request, I confirm the following (please check boxes):** - -- [ ] I have read and understood the [contributing guidelines](/.github/CONTRIBUTING.md)? -- [ ] I have checked that another pull request for this purpose does not exist. -- [ ] I have considered, and confirmed that this submission will be valuable to others. -- [ ] I have created or updated the relevant documentation for this change on the PHPCI Wiki. -- [ ] Do the PHPCI tests pass? - - -Detailed description of change: - - - diff --git a/.gitignore b/.gitignore index 63e81c5b..fbfc1a28 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,3 @@ PHPCI/Model/Migration.php PHPCI/Model/Base/MigrationBase.php PHPCI/Store/MigrationStore.php PHPCI/Store/Base/MigrationStoreBase.php -local_vars.php -Tests/PHPCI/config.yml diff --git a/Dockerfile b/Dockerfile index 5fb6df83..f0c8b605 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-mysqlnd +RUN apt-get install -qy git-core php5-common php5-cli php5-curl php5-imap php5-mcrypt php5-mysqlnd # Give Git some fake user details to prevent it asking when trying to test merges: RUN git config --global user.name "PHPCI" @@ -15,7 +15,4 @@ RUN git config --global user.email "hello@php.ci" ADD ./ /phpci -RUN php -r "readfile('https://getcomposer.org/installer');" | php -RUN mv composer.phar /phpci/composer - CMD /phpci/daemonise phpci:daemonise diff --git a/LICENSE.md b/LICENSE.md index 4c4f6952..1df52b9c 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -6,4 +6,4 @@ Redistribution and use in source and binary forms, with or without modification, - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/PHPCI/Application.php b/PHPCI/Application.php index a6eb646c..16fab7cf 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 PHPCI\Model\Build; /** * PHPCI Front Controller @@ -21,14 +22,6 @@ use b8\View; */ class Application extends b8\Application { - /** - * @var \PHPCI\Controller - */ - protected $controller; - - /** - * Initialise PHPCI - Handles session verification, routing, etc. - */ public function init() { $request =& $this->request; @@ -51,13 +44,11 @@ class Application extends b8\Application return false; }; - $skipAuth = array($this, 'shouldSkipAuth'); - // Handler for the route we're about to register, checks for a valid session where necessary: - $routeHandler = function (&$route, Response &$response) use (&$request, $validateSession, $skipAuth) { + $routeHandler = function (&$route, Response &$response) use (&$request, $validateSession) { $skipValidation = in_array($route['controller'], array('session', 'webhook', 'build-status')); - if (!$skipValidation && !$validateSession() && (!is_callable($skipAuth) || !$skipAuth())) { + if (!$skipValidation && !$validateSession()) { if ($request->isAjax()) { $response->setResponseCode(401); $response->setContent(''); @@ -76,12 +67,9 @@ class Application extends b8\Application $this->router->clearRoutes(); $this->router->register($route, $opts, $routeHandler); } - /** - * Handle an incoming web request. - * - * @return b8\b8\Http\Response|Response - */ + * Handle an incoming web request. + */ public function handleRequest() { try { @@ -104,7 +92,7 @@ class Application extends b8\Application $this->response->setContent($view->render()); } - if ($this->response->hasLayout() && $this->controller->layout) { + if ($this->response->hasLayout()) { $this->setLayoutVariables($this->controller->layout); $this->controller->layout->content = $this->response->getContent(); @@ -114,11 +102,6 @@ class Application extends b8\Application return $this->response; } - /** - * Loads a particular controller, and injects our layout view into it. - * @param $class - * @return mixed - */ protected function loadController($class) { $controller = parent::loadController($class); @@ -129,46 +112,10 @@ class Application extends b8\Application return $controller; } - /** - * Injects variables into the layout before rendering it. - * @param View $layout - */ protected function setLayoutVariables(View &$layout) { - $groups = array(); - $groupStore = b8\Store\Factory::getStore('ProjectGroup'); - $groupList = $groupStore->getWhere(array(), 100, 0, array(), array('title' => 'ASC')); - - foreach ($groupList['items'] as $group) { - $thisGroup = array('title' => $group->getTitle()); - $projects = b8\Store\Factory::getStore('Project')->getByGroupId($group->getId()); - $thisGroup['projects'] = $projects['items']; - $groups[] = $thisGroup; - } - - $layout->groups = $groups; - } - - /** - * Check whether we should skip auth (because it is disabled) - * @return bool - */ - protected function shouldSkipAuth() - { - $config = b8\Config::getInstance(); - $state = (bool)$config->get('phpci.authentication_settings.state', false); - $userId = $config->get('phpci.authentication_settings.user_id', 0); - - if (false !== $state && 0 != (int)$userId) { - $user = b8\Store\Factory::getStore('User') - ->getByPrimaryKey($userId); - - if ($user) { - $_SESSION['phpci_user'] = $user; - return true; - } - } - - return false; + /** @var \PHPCI\Store\ProjectStore $projectStore */ + $projectStore = b8\Store\Factory::getStore('Project'); + $layout->projects = $projectStore->getAll(); } } diff --git a/PHPCI/BuildFactory.php b/PHPCI/BuildFactory.php index 91e618a8..4825047d 100644 --- a/PHPCI/BuildFactory.php +++ b/PHPCI/BuildFactory.php @@ -36,44 +36,35 @@ class BuildFactory /** * Takes a generic build and returns a type-specific build model. - * @param Build $build The build from which to get a more specific build type. + * @param Build $base The build from which to get a more specific build type. * @return Build */ - public static function getBuild(Build $build) + public static function getBuild(Build $base) { - $project = $build->getProject(); - - if (!empty($project)) { - switch ($project->getType()) { - case 'remote': - $type = 'RemoteGitBuild'; - break; - case 'local': - $type = 'LocalBuild'; - break; - case 'github': - $type = 'GithubBuild'; - break; - case 'bitbucket': - $type = 'BitbucketBuild'; - break; - case 'gitlab': - $type = 'GitlabBuild'; - break; - case 'hg': - $type = 'MercurialBuild'; - break; - case 'svn': - $type = 'SubversionBuild'; - break; - default: - return $build; - } - - $class = '\\PHPCI\\Model\\Build\\' . $type; - $build = new $class($build->getDataArray()); + switch($base->getProject()->getType()) + { + case 'remote': + $type = 'RemoteGitBuild'; + break; + case 'local': + $type = 'LocalBuild'; + break; + case 'github': + $type = 'GithubBuild'; + break; + case 'bitbucket': + $type = 'BitbucketBuild'; + break; + case 'gitlab': + $type = 'GitlabBuild'; + break; + case 'hg': + $type = 'MercurialBuild'; + break; } - return $build; + $type = '\\PHPCI\\Model\\Build\\' . $type; + + return new $type($base->getDataArray()); } } diff --git a/PHPCI/Builder.php b/PHPCI/Builder.php index 1aed3d3f..69e23ff1 100644 --- a/PHPCI/Builder.php +++ b/PHPCI/Builder.php @@ -10,7 +10,6 @@ namespace PHPCI; use PHPCI\Helper\BuildInterpolator; -use PHPCI\Helper\Lang; use PHPCI\Helper\MailerFactory; use PHPCI\Logging\BuildLogger; use PHPCI\Model\Build; @@ -136,7 +135,7 @@ class Builder implements LoggerAwareInterface public function setConfigArray($config) { if (is_null($config) || !is_array($config)) { - throw new \Exception(Lang::get('missing_phpci_yml')); + throw new \Exception('This project does not contain a phpci.yml file, or it is empty.'); } $this->config = $config; @@ -188,14 +187,6 @@ class Builder implements LoggerAwareInterface $this->build->sendStatusPostback(); $success = true; - $previous_build = $this->build->getProject()->getPreviousBuild($this->build->getBranch()); - - $previous_state = Build::STATUS_NEW; - - if ($previous_build) { - $previous_state = $previous_build->getStatus(); - } - try { // Set up the build: $this->setupBuild(); @@ -213,41 +204,34 @@ class Builder implements LoggerAwareInterface $this->build->setStatus(Build::STATUS_FAILED); } + // Complete stage plugins are always run + $this->pluginExecutor->executePlugins($this->config, 'complete'); if ($success) { $this->pluginExecutor->executePlugins($this->config, 'success'); - - if ($previous_state == Build::STATUS_FAILED) { - $this->pluginExecutor->executePlugins($this->config, 'fixed'); - } - - $this->buildLogger->logSuccess(Lang::get('build_success')); + $this->buildLogger->logSuccess('BUILD SUCCESSFUL!'); } else { $this->pluginExecutor->executePlugins($this->config, 'failure'); - - if ($previous_state == Build::STATUS_SUCCESS || $previous_state == Build::STATUS_NEW) { - $this->pluginExecutor->executePlugins($this->config, 'broken'); - } - - $this->buildLogger->logFailure(Lang::get('build_failed')); + $this->buildLogger->logFailure("BUILD FAILURE"); } + + // Clean up: + $this->buildLogger->log('Removing build.'); + + $cmd = 'rm -Rf "%s"'; + if (IS_WIN) { + $cmd = 'rmdir /S /Q "%s"'; + } + $this->executeCommand($cmd, $this->buildPath); } catch (\Exception $ex) { $this->build->setStatus(Build::STATUS_FAILED); - $this->buildLogger->logFailure(Lang::get('exception') . $ex->getMessage()); - }finally{ - // Complete stage plugins are always run - $this->pluginExecutor->executePlugins($this->config, 'complete'); + $this->buildLogger->logFailure('Exception: ' . $ex->getMessage()); } // Update the build in the database, ping any external services, etc. $this->build->sendStatusPostback(); $this->build->setFinished(new \DateTime()); - - // Clean up: - $this->buildLogger->log(Lang::get('removing_build')); - $this->build->removeBuildDirectory(); - $this->store->save($this->build); } @@ -267,10 +251,6 @@ class Builder implements LoggerAwareInterface return $this->commandExecutor->getLastOutput(); } - /** - * Specify whether exec output should be logged. - * @param bool $enableLog - */ public function logExecOutput($enableLog = true) { $this->commandExecutor->logExecOutput = $enableLog; @@ -278,14 +258,12 @@ class Builder implements LoggerAwareInterface /** * Find a binary required by a plugin. - * @param string $binary - * @param bool $quiet - * + * @param $binary * @return null|string */ - public function findBinary($binary, $quiet = false) + public function findBinary($binary) { - return $this->commandExecutor->findBinary($binary, $quiet = false); + return $this->commandExecutor->findBinary($binary, $this->buildPath); } /** @@ -304,7 +282,8 @@ class Builder implements LoggerAwareInterface */ protected function setupBuild() { - $this->buildPath = $this->build->getBuildPath(); + $this->buildPath = PHPCI_DIR . 'PHPCI/build/' . $this->build->getId() . '/'; + $this->build->currentBuildPath = $this->buildPath; $this->interpolator->setupInterpolationVars( $this->build, @@ -312,11 +291,9 @@ class Builder implements LoggerAwareInterface PHPCI_URL ); - $this->commandExecutor->setBuildPath($this->buildPath); - // Create a working copy of the project: if (!$this->build->createWorkingCopy($this, $this->buildPath)) { - throw new \Exception(Lang::get('could_not_create_working')); + throw new \Exception('Could not create a working copy.'); } // Does the project's phpci.yml request verbose mode? @@ -329,7 +306,7 @@ class Builder implements LoggerAwareInterface $this->ignore = $this->config['build_settings']['ignore']; } - $this->buildLogger->logSuccess(Lang::get('working_copy_created', $this->buildPath)); + $this->buildLogger->logSuccess('Working copy created: ' . $this->buildPath); return true; } @@ -344,12 +321,6 @@ class Builder implements LoggerAwareInterface $this->buildLogger->setLogger($logger); } - /** - * Write to the build log. - * @param $message - * @param string $level - * @param array $context - */ public function log($message, $level = LogLevel::INFO, $context = array()) { $this->buildLogger->log($message, $level, $context); diff --git a/PHPCI/Command/CreateAdminCommand.php b/PHPCI/Command/CreateAdminCommand.php index 265f03b4..fc40c307 100644 --- a/PHPCI/Command/CreateAdminCommand.php +++ b/PHPCI/Command/CreateAdminCommand.php @@ -10,73 +10,116 @@ namespace PHPCI\Command; use PHPCI\Service\UserService; -use PHPCI\Helper\Lang; -use PHPCI\Store\UserStore; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use b8\Store\Factory; +use PHPCI\Builder; /** - * Create admin command - creates an admin user - * @author Wogan May (@woganmay) - * @package PHPCI - * @subpackage Console - */ +* Create admin command - creates an admin user +* @author Wogan May (@woganmay) +* @package PHPCI +* @subpackage Console +*/ class CreateAdminCommand extends Command { - /** - * @var UserStore - */ - protected $userStore; - - /** - * @param UserStore $userStore - */ - public function __construct(UserStore $userStore) - { - parent::__construct(); - - $this->userStore = $userStore; - } - protected function configure() { $this ->setName('phpci:create-admin') - ->setDescription(Lang::get('create_admin_user')); + ->setDescription('Create an admin user'); } /** - * Creates an admin user in the existing PHPCI database - * - * {@inheritDoc} - */ + * Creates an admin user in the existing PHPCI database + */ protected function execute(InputInterface $input, OutputInterface $output) { - $userService = new UserService($this->userStore); + $userStore = Factory::getStore('User'); + $userService = new UserService($userStore); - /** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */ - $dialog = $this->getHelperSet()->get('dialog'); + require(PHPCI_DIR . 'bootstrap.php'); - // Function to validate mail address. - $mailValidator = function ($answer) { - if (!filter_var($answer, FILTER_VALIDATE_EMAIL)) { - throw new \InvalidArgumentException(Lang::get('must_be_valid_email')); - } + // Try to create a user account: + $adminEmail = $this->ask('Admin email address: ', true, FILTER_VALIDATE_EMAIL); - return $answer; - }; + if (empty($adminEmail)) { + return; + } - $adminEmail = $dialog->askAndValidate($output, Lang::get('enter_email'), $mailValidator, false); - $adminName = $dialog->ask($output, Lang::get('enter_name')); - $adminPass = $dialog->askHiddenResponse($output, Lang::get('enter_password')); + $adminPass = $this->ask('Admin password: '); + $adminName = $this->ask('Admin name: '); try { - $userService->createUser($adminName, $adminEmail, $adminPass, true); - $output->writeln(Lang::get('user_created')); - } catch (\Exception $e) { - $output->writeln(sprintf('%s', Lang::get('failed_to_create'))); - $output->writeln(sprintf('%s', $e->getMessage())); + $userService->createUser($adminName, $adminEmail, $adminPass, 1); + print 'User account created!' . PHP_EOL; + } catch (\Exception $ex) { + print 'There was a problem creating your account. :(' . PHP_EOL; + print $ex->getMessage(); + print PHP_EOL; } } + + protected function ask($question, $emptyOk = false, $validationFilter = null) + { + print $question . ' '; + + $rtn = ''; + $stdin = fopen('php://stdin', 'r'); + $rtn = fgets($stdin); + fclose($stdin); + + $rtn = trim($rtn); + + if (!$emptyOk && empty($rtn)) { + $rtn = $this->ask($question, $emptyOk, $validationFilter); + } elseif ($validationFilter != null && ! empty($rtn)) { + if (! $this -> controlFormat($rtn, $validationFilter, $statusMessage)) { + print $statusMessage; + $rtn = $this->ask($question, $emptyOk, $validationFilter); + } + } + + return $rtn; + } + protected function controlFormat($valueToInspect, $filter, &$statusMessage) + { + $filters = !(is_array($filter))? array($filter) : $filter; + $statusMessage = ''; + $status = true; + $options = array(); + + foreach ($filters as $filter) { + if (! is_int($filter)) { + $regexp = $filter; + $filter = FILTER_VALIDATE_REGEXP; + $options = array( + 'options' => array( + 'regexp' => $regexp, + ) + ); + } + if (! filter_var($valueToInspect, $filter, $options)) { + $status = false; + + switch ($filter) + { + case FILTER_VALIDATE_URL: + $statusMessage = 'Incorrect url format.' . PHP_EOL; + break; + case FILTER_VALIDATE_EMAIL: + $statusMessage = 'Incorrect e-mail format.' . PHP_EOL; + break; + case FILTER_VALIDATE_REGEXP: + $statusMessage = 'Incorrect format.' . PHP_EOL; + break; + } + } + } + + return $status; + } } diff --git a/PHPCI/Command/CreateBuildCommand.php b/PHPCI/Command/CreateBuildCommand.php deleted file mode 100644 index 01260080..00000000 --- a/PHPCI/Command/CreateBuildCommand.php +++ /dev/null @@ -1,85 +0,0 @@ -projectStore = $projectStore; - $this->buildService = $buildService; - } - - /** - * {@inheritDoc} - */ - protected function configure() - { - $this - ->setName('phpci:create-build') - ->setDescription(Lang::get('create_build_project')) - ->addArgument('projectId', InputArgument::REQUIRED, Lang::get('project_id_argument')) - ->addOption('commit', null, InputOption::VALUE_OPTIONAL, Lang::get('commit_id_option')) - ->addOption('branch', null, InputOption::VALUE_OPTIONAL, Lang::get('branch_name_option')); - } - - /** - * {@inheritDoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $projectId = $input->getArgument('projectId'); - $commitId = $input->getOption('commit'); - $branch = $input->getOption('branch'); - - $project = $this->projectStore->getById($projectId); - if (empty($project)) { - throw new \InvalidArgumentException('Project does not exist: ' . $projectId); - } - - try { - $this->buildService->createBuild($project, $commitId, $branch); - $output->writeln(Lang::get('build_created')); - } catch (\Exception $e) { - $output->writeln(sprintf('%s', Lang::get('failed'))); - $output->writeln(sprintf('%s', $e->getMessage())); - } - } -} diff --git a/PHPCI/Command/DaemonCommand.php b/PHPCI/Command/DaemonCommand.php index cb303eff..79925fbd 100644 --- a/PHPCI/Command/DaemonCommand.php +++ b/PHPCI/Command/DaemonCommand.php @@ -1,5 +1,4 @@ - * @package PHPCI - * @subpackage Console - */ +* Daemon that loops and call the run-command. +* @author Gabriel Baker +* @package PHPCI +* @subpackage Console +*/ class DaemonCommand extends Command { - /** - * @var Logger + * @var \Monolog\Logger */ protected $logger; - /** - * @var string - */ - protected $pidFilePath; - - /** - * @var string - */ - protected $logFilePath; - - /** - * @var ProcessControlInterface - */ - protected $processControl; - - public function __construct(Logger $logger, ProcessControlInterface $processControl = null, $name = null) + public function __construct(Logger $logger, $name = null) { parent::__construct($name); $this->logger = $logger; - $this->processControl = $processControl ?: Factory::getInstance(); } protected function configure() @@ -61,30 +45,17 @@ class DaemonCommand extends Command ->setName('phpci:daemon') ->setDescription('Initiates the daemon to run commands.') ->addArgument( - 'state', InputArgument::REQUIRED, 'start|stop|status' - ) - ->addOption( - 'pid-file', 'p', InputOption::VALUE_REQUIRED, - 'Path of the PID file', - implode(DIRECTORY_SEPARATOR, - array(PHPCI_DIR, 'daemon', 'daemon.pid')) - ) - ->addOption( - 'log-file', 'l', InputOption::VALUE_REQUIRED, - 'Path of the log file', - implode(DIRECTORY_SEPARATOR, - array(PHPCI_DIR, 'daemon', 'daemon.log')) - ); + 'state', + InputArgument::REQUIRED, + 'start|stop|status' + ); } /** - * Loops through running. - */ + * Loops through running. + */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->pidFilePath = $input->getOption('pid-file'); - $this->logFilePath = $input->getOption('log-file'); - $state = $input->getArgument('state'); switch ($state) { @@ -95,108 +66,64 @@ class DaemonCommand extends Command $this->stopDaemon(); break; case 'status': - $this->statusDaemon($output); + $this->statusDaemon(); break; default: - $this->output->writeln("Not a valid choice, please use start, stop or status"); + echo "Not a valid choice, please use start stop or status"; break; } + } protected function startDaemon() { - $pid = $this->getRunningPid(); - if ($pid) { - $this->logger->notice("Daemon already started", array('pid' => $pid)); + + if (file_exists(PHPCI_DIR.'/daemon/daemon.pid')) { + echo "Already started\n"; + $this->logger->warning("Daemon already started"); return "alreadystarted"; } - $this->logger->info("Trying to start the daemon"); - + $logfile = PHPCI_DIR."/daemon/daemon.log"; $cmd = "nohup %s/daemonise phpci:daemonise > %s 2>&1 &"; - $command = sprintf($cmd, PHPCI_DIR, $this->logFilePath); - $output = $exitCode = null; - exec($command, $output, $exitCode); - - if ($exitCode !== 0) { - $this->logger->error(sprintf("daemonise exited with status %d", $exitCode)); - return "notstarted"; - } - - for ($i = 0; !($pid = $this->getRunningPid()) && $i < 5; $i++) { - sleep(1); - } - - if (!$pid) { - $this->logger->error("Could not start the daemon"); - return "notstarted"; - } - - $this->logger->notice("Daemon started", array('pid' => $pid)); - return "started"; + $command = sprintf($cmd, PHPCI_DIR, $logfile); + $this->logger->info("Daemon started"); + exec($command); } protected function stopDaemon() { - $pid = $this->getRunningPid(); - if (!$pid) { - $this->logger->notice("Cannot stop the daemon as it is not started"); + + if (!file_exists(PHPCI_DIR.'/daemon/daemon.pid')) { + echo "Not started\n"; + $this->logger->warning("Can't stop daemon as not started"); return "notstarted"; } - $this->logger->info("Trying to terminate the daemon", array('pid' => $pid)); - $this->processControl->kill($pid); - - for ($i = 0; ($pid = $this->getRunningPid()) && $i < 5; $i++) { - sleep(1); - } - - if ($pid) { - $this->logger->warning("The daemon is resiting, trying to kill it", array('pid' => $pid)); - $this->processControl->kill($pid, true); - - for ($i = 0; ($pid = $this->getRunningPid()) && $i < 5; $i++) { - sleep(1); - } - } - - if (!$pid) { - $this->logger->notice("Daemon stopped"); - return "stopped"; - } - - $this->logger->error("Could not stop the daemon"); + $cmd = "kill $(cat %s/daemon/daemon.pid)"; + $command = sprintf($cmd, PHPCI_DIR); + exec($command); + $this->logger->info("Daemon stopped"); + unlink(PHPCI_DIR.'/daemon/daemon.pid'); } - protected function statusDaemon(OutputInterface $output) + protected function statusDaemon() { - $pid = $this->getRunningPid(); - if ($pid) { - $output->writeln(sprintf('The daemon is running, PID: %d', $pid)); + + if (!file_exists(PHPCI_DIR.'/daemon/daemon.pid')) { + echo "Not running\n"; + return "notrunning"; + } + + $pid = trim(file_get_contents(PHPCI_DIR.'/daemon/daemon.pid')); + $pidcheck = sprintf("/proc/%s", $pid); + if (is_dir($pidcheck)) { + echo "Running\n"; return "running"; } - $output->writeln('The daemon is not running'); + unlink(PHPCI_DIR.'/daemon/daemon.pid'); + echo "Not running\n"; return "notrunning"; } - - /** Check if there is a running daemon - * - * @return int|null - */ - protected function getRunningPid() - { - if (!file_exists($this->pidFilePath)) { - return; - } - - $pid = intval(trim(file_get_contents($this->pidFilePath))); - - if($this->processControl->isRunning($pid, true)) { - return $pid; - } - - // Not found, remove the stale PID file - unlink($this->pidFilePath); - } } diff --git a/PHPCI/Command/DaemoniseCommand.php b/PHPCI/Command/DaemoniseCommand.php index eadd334e..915890bd 100644 --- a/PHPCI/Command/DaemoniseCommand.php +++ b/PHPCI/Command/DaemoniseCommand.php @@ -12,7 +12,9 @@ namespace PHPCI\Command; use Monolog\Logger; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** @@ -74,7 +76,7 @@ class DaemoniseCommand extends Command $this->sleep = 0; $runner = new RunCommand($this->logger); $runner->setMaxBuilds(1); - $runner->setDaemon(true); + $runner->setIsDaemon(true); $emptyInput = new ArgvInput(array()); @@ -85,8 +87,7 @@ class DaemoniseCommand extends Command try { $buildCount = $runner->run($emptyInput, $output); } catch (\Exception $e) { - $output->writeln('Exception: ' . $e->getMessage() . ''); - $output->writeln('Line: ' . $e->getLine() . ' - File: ' . $e->getFile() . ''); + var_dump($e); } if (0 == $buildCount && $this->sleep < 15) { diff --git a/PHPCI/Command/GenerateCommand.php b/PHPCI/Command/GenerateCommand.php index ddd227d9..07307686 100644 --- a/PHPCI/Command/GenerateCommand.php +++ b/PHPCI/Command/GenerateCommand.php @@ -10,7 +10,9 @@ namespace PHPCI\Command; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use b8\Database; use b8\Database\CodeGenerator; diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index 5f5cbd67..a4a0c4bb 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -13,15 +13,15 @@ use Exception; use PDO; use b8\Config; +use b8\Database; use b8\Store\Factory; -use PHPCI\Helper\Lang; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Helper\DialogHelper; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Helper\DialogHelper; use PHPCI\Service\UserService; -use Symfony\Component\Console\Question\ConfirmationQuestion; /** * Install console command - Installs PHPCI. @@ -39,19 +39,16 @@ class InstallCommand extends Command $this ->setName('phpci:install') - ->addOption('url', null, InputOption::VALUE_OPTIONAL, Lang::get('installation_url')) - ->addOption('db-host', null, InputOption::VALUE_OPTIONAL, Lang::get('db_host')) - ->addOption('db-name', null, InputOption::VALUE_OPTIONAL, Lang::get('db_name')) - ->addOption('db-user', null, InputOption::VALUE_OPTIONAL, Lang::get('db_user')) - ->addOption('db-pass', null, InputOption::VALUE_OPTIONAL, Lang::get('db_pass')) - ->addOption('admin-name', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_name')) - ->addOption('admin-pass', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_pass')) - ->addOption('admin-mail', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_email')) - ->addOption('config-path', null, InputOption::VALUE_OPTIONAL, Lang::get('config_path'), $defaultPath) - ->addOption('queue-disabled', null, InputOption::VALUE_NONE, 'Don\'t ask for queue details') - ->addOption('queue-server', null, InputOption::VALUE_OPTIONAL, 'Beanstalkd queue server hostname') - ->addOption('queue-name', null, InputOption::VALUE_OPTIONAL, 'Beanstalkd queue name') - ->setDescription(Lang::get('install_phpci')); + ->addOption('url', null, InputOption::VALUE_OPTIONAL, 'PHPCI Installation URL') + ->addOption('db-host', null, InputOption::VALUE_OPTIONAL, 'Database hostname') + ->addOption('db-name', null, InputOption::VALUE_OPTIONAL, 'Database name') + ->addOption('db-user', null, InputOption::VALUE_OPTIONAL, 'Database username') + ->addOption('db-pass', null, InputOption::VALUE_OPTIONAL, 'Database password') + ->addOption('admin-name', null, InputOption::VALUE_OPTIONAL, 'Admin username') + ->addOption('admin-pass', null, InputOption::VALUE_OPTIONAL, 'Admin password') + ->addOption('admin-mail', null, InputOption::VALUE_OPTIONAL, 'Admin e-mail') + ->addOption('config-path', null, InputOption::VALUE_OPTIONAL, 'Config file path', $defaultPath) + ->setDescription('Install PHPCI.'); } /** @@ -61,19 +58,17 @@ class InstallCommand extends Command { $this->configFilePath = $input->getOption('config-path'); - if (!$this->verifyNotInstalled($output)) { - return; - } + $this->verifyNotInstalled($output); $output->writeln(''); $output->writeln('******************'); - $output->writeln(' '.Lang::get('welcome_to_phpci').''); + $output->writeln(' Welcome to PHPCI'); $output->writeln('******************'); $output->writeln(''); $this->checkRequirements($output); - $output->writeln(Lang::get('please_answer')); + $output->writeln('Please answer the following questions:'); $output->writeln('-------------------------------------'); $output->writeln(''); @@ -100,7 +95,7 @@ class InstallCommand extends Command $this->writeConfigFile($conf); $this->setupDatabase($output); - $admin = $this->getAdminInformation($input, $output); + $admin = $this->getAdminInforamtion($input, $output); $this->createAdminUser($admin, $output); } @@ -116,19 +111,19 @@ class InstallCommand extends Command $errors = false; // Check PHP version: - if (!(version_compare(PHP_VERSION, '5.3.8') >= 0)) { + if (!(version_compare(PHP_VERSION, '5.3.3') >= 0)) { $output->writeln(''); - $output->writeln(''.Lang::get('phpci_php_req').''); + $output->writeln('PHPCI requires at least PHP 5.3.3 to function.'); $errors = true; } // Check required extensions are present: - $requiredExtensions = array('PDO', 'pdo_mysql'); + $requiredExtensions = array('PDO', 'pdo_mysql', 'mcrypt'); foreach ($requiredExtensions as $extension) { if (!extension_loaded($extension)) { $output->writeln(''); - $output->writeln(''.Lang::get('extension_required', $extension).''); + $output->writeln(''.$extension.' extension must be installed.'); $errors = true; } } @@ -139,22 +134,22 @@ class InstallCommand extends Command foreach ($requiredFunctions as $function) { if (!function_exists($function)) { $output->writeln(''); - $output->writeln(''.Lang::get('function_required', $function).''); + $output->writeln('PHPCI needs to be able to call the '.$function.'() function. Is it disabled in php.ini?'); $errors = true; } } if (!function_exists('password_hash')) { $output->writeln(''); - $output->writeln(''.Lang::get('function_required', $function).''); + $output->writeln('PHPCI requires the password_hash() function available in PHP 5.4, or the password_compat library by ircmaxell.'); $errors = true; } if ($errors) { - throw new Exception(Lang::get('requirements_not_met')); + throw new Exception('PHPCI cannot be installed, as not all requirements are met. Please review the errors above before continuing.'); } - $output->writeln(' '.Lang::get('ok').''); + $output->writeln(' OK'); $output->writeln(''); } @@ -165,7 +160,7 @@ class InstallCommand extends Command * @param OutputInterface $output * @return array */ - protected function getAdminInformation(InputInterface $input, OutputInterface $output) + protected function getAdminInforamtion(InputInterface $input, OutputInterface $output) { $admin = array(); @@ -175,9 +170,9 @@ class InstallCommand extends Command $dialog = $this->getHelperSet()->get('dialog'); // Function to validate mail address. - $mailValidator = function ($answer) { + $mailValidator =function ($answer) { if (!filter_var($answer, FILTER_VALIDATE_EMAIL)) { - throw new \InvalidArgumentException(Lang::get('must_be_valid_email')); + throw new Exception('Must be a valid email address.'); } return $answer; @@ -186,13 +181,13 @@ class InstallCommand extends Command if ($adminEmail = $input->getOption('admin-mail')) { $adminEmail = $mailValidator($adminEmail); } else { - $adminEmail = $dialog->askAndValidate($output, Lang::get('enter_email'), $mailValidator, false); + $adminEmail = $dialog->askAndValidate($output, 'Your email address: ', $mailValidator, false); } if (!$adminName = $input->getOption('admin-name')) { - $adminName = $dialog->ask($output, Lang::get('enter_name')); + $adminName = $dialog->ask($output, 'Enter your name: '); } if (!$adminPass = $input->getOption('admin-pass')) { - $adminPass = $dialog->askHiddenResponse($output, Lang::get('enter_password')); + $adminPass = $dialog->askHiddenResponse($output, 'Enter your desired admin password: '); } $admin['mail'] = $adminEmail; @@ -221,7 +216,7 @@ class InstallCommand extends Command // FUnction do validate URL. $urlValidator = function ($answer) { if (!filter_var($answer, FILTER_VALIDATE_URL)) { - throw new Exception(Lang::get('must_be_valid_url')); + throw new Exception('Must be a valid URL'); } return rtrim($answer, '/'); @@ -230,49 +225,14 @@ class InstallCommand extends Command if ($url = $input->getOption('url')) { $url = $urlValidator($url); } else { - $url = $dialog->askAndValidate($output, Lang::get('enter_phpci_url'), $urlValidator, false); + $url = $dialog->askAndValidate($output, 'Your PHPCI URL ("http://phpci.local" for example): ', $urlValidator, false); } $phpci['url'] = $url; - $phpci['worker'] = $this->getQueueInformation($input, $output, $dialog); return $phpci; } - /** - * If the user wants to use a queue, get the necessary details. - * @param InputInterface $input - * @param OutputInterface $output - * @param DialogHelper $dialog - * @return array - */ - protected function getQueueInformation(InputInterface $input, OutputInterface $output, DialogHelper $dialog) - { - if ($input->getOption('queue-disabled')) { - return null; - } - - $rtn = []; - - $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion('Use beanstalkd to manage build queue? ', true); - - if (!$helper->ask($input, $output, $question)) { - $output->writeln('Skipping beanstalkd configuration.'); - return null; - } - - if (!$rtn['host'] = $input->getOption('queue-server')) { - $rtn['host'] = $dialog->ask($output, 'Enter your beanstalkd hostname [localhost]: ', 'localhost'); - } - - if (!$rtn['queue'] = $input->getOption('queue-name')) { - $rtn['queue'] = $dialog->ask($output, 'Enter the queue (tube) name to use [phpci]: ', 'phpci'); - } - - return $rtn; - } - /** * Load configuration for DB form CLI options or ask info to user. * @@ -290,19 +250,19 @@ class InstallCommand extends Command $dialog = $this->getHelperSet()->get('dialog'); if (!$dbHost = $input->getOption('db-host')) { - $dbHost = $dialog->ask($output, Lang::get('enter_db_host'), 'localhost'); + $dbHost = $dialog->ask($output, 'Please enter your MySQL host [localhost]: ', 'localhost'); } if (!$dbName = $input->getOption('db-name')) { - $dbName = $dialog->ask($output, Lang::get('enter_db_name'), 'phpci'); + $dbName = $dialog->ask($output, 'Please enter your database name [phpci]: ', 'phpci'); } if (!$dbUser = $input->getOption('db-user')) { - $dbUser = $dialog->ask($output, Lang::get('enter_db_user'), 'phpci'); + $dbUser = $dialog->ask($output, 'Please enter your database username [phpci]: ', 'phpci'); } if (!$dbPass = $input->getOption('db-pass')) { - $dbPass = $dialog->askHiddenResponse($output, Lang::get('enter_db_pass')); + $dbPass = $dialog->askHiddenResponse($output, 'Please enter your database password: '); } $db['servers']['read'] = $dbHost; @@ -335,12 +295,10 @@ class InstallCommand extends Command ) ); - unset($pdo); - return true; } catch (Exception $ex) { - $output->writeln(''.Lang::get('could_not_connect').''); + $output->writeln('PHPCI could not connect to MySQL with the details provided. Please try again.'); $output->writeln('' . $ex->getMessage() . ''); } @@ -361,13 +319,11 @@ class InstallCommand extends Command protected function setupDatabase(OutputInterface $output) { - $output->write(Lang::get('setting_up_db')); + $output->write('Setting up your database... '); - $phinxBinary = escapeshellarg(PHPCI_DIR . 'vendor/bin/phinx'); - $phinxScript = escapeshellarg(PHPCI_DIR . 'phinx.php'); - shell_exec($phinxBinary . ' migrate -c ' . $phinxScript); + shell_exec(PHPCI_DIR . 'vendor/bin/phinx migrate -c "' . PHPCI_DIR . 'phinx.php"'); - $output->writeln(''.Lang::get('ok').''); + $output->writeln('OK'); } /** @@ -385,10 +341,11 @@ class InstallCommand extends Command $userService = new UserService($userStore); $userService->createUser($admin['name'], $admin['mail'], $admin['pass'], 1); - $output->writeln(''.Lang::get('user_created').''); + $output->writeln('User account created!'); } catch (\Exception $ex) { - $output->writeln(''.Lang::get('failed_to_create').''); + $output->writeln('PHPCI failed to create your admin account.'); $output->writeln('' . $ex->getMessage() . ''); + die; } } @@ -403,7 +360,6 @@ class InstallCommand extends Command /** * @param OutputInterface $output - * @return bool */ protected function verifyNotInstalled(OutputInterface $output) { @@ -411,12 +367,10 @@ class InstallCommand extends Command $content = file_get_contents($this->configFilePath); if (!empty($content)) { - $output->writeln(''.Lang::get('config_exists').''); - $output->writeln(''.Lang::get('update_instead').''); - return false; + $output->writeln('The PHPCI config file exists and is not empty.'); + $output->writeln('If you were trying to update PHPCI, please use phpci:update instead.'); + die; } } - - return true; } } diff --git a/PHPCI/Command/PollCommand.php b/PHPCI/Command/PollCommand.php index a8729515..f108a35b 100644 --- a/PHPCI/Command/PollCommand.php +++ b/PHPCI/Command/PollCommand.php @@ -12,9 +12,10 @@ namespace PHPCI\Command; use b8\Store\Factory; use b8\HttpClient; use Monolog\Logger; -use PHPCI\Helper\Lang; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Parser; use PHPCI\Model\Build; @@ -42,7 +43,7 @@ class PollCommand extends Command { $this ->setName('phpci:poll-github') - ->setDescription(Lang::get('poll_github')); + ->setDescription('Poll github to check if we need to start a build.'); } /** @@ -57,16 +58,16 @@ class PollCommand extends Command $token = $this->settings['phpci']['github']['token']; if (!$token) { - $this->logger->error(Lang::get('no_token')); - return; + $this->logger->error("No github token found"); + exit(); } $buildStore = Factory::getStore('Build'); - $this->logger->addInfo(Lang::get('finding_projects')); + $this->logger->addInfo("Finding projects to poll"); $projectStore = Factory::getStore('Project'); $result = $projectStore->getWhere(); - $this->logger->addInfo(Lang::get('found_n_projects', count($result['items']))); + $this->logger->addInfo(sprintf("Found %d projects", count($result['items']))); foreach ($result['items'] as $project) { $http = new HttpClient('https://api.github.com'); @@ -76,11 +77,11 @@ class PollCommand extends Command $last_committer = $commits['body'][0]['commit']['committer']['email']; $message = $commits['body'][0]['commit']['message']; - $this->logger->info(Lang::get('last_commit_is', $project->getTitle(), $last_commit)); + $this->logger->info("Last commit to github for " . $project->getTitle() . " is " . $last_commit); if ($project->getLastCommit() != $last_commit && $last_commit != "") { $this->logger->info( - Lang::get('adding_new_build') + "Last commit is different from database, adding new build for " . $project->getTitle() ); $build = new Build(); @@ -100,6 +101,6 @@ class PollCommand extends Command } } - $this->logger->addInfo(Lang::get('finished_processing_builds')); + $this->logger->addInfo("Finished processing builds"); } } diff --git a/PHPCI/Command/RebuildCommand.php b/PHPCI/Command/RebuildCommand.php deleted file mode 100644 index 4c24b359..00000000 --- a/PHPCI/Command/RebuildCommand.php +++ /dev/null @@ -1,93 +0,0 @@ - -* @package PHPCI -* @subpackage Console -*/ -class RebuildCommand extends Command -{ - /** - * @var Logger - */ - protected $logger; - - /** - * @var OutputInterface - */ - protected $output; - - /** - * @var boolean - */ - protected $run; - - /** - * @var int - */ - protected $sleep; - - /** - * @param \Monolog\Logger $logger - * @param string $name - */ - public function __construct(Logger $logger, $name = null) - { - parent::__construct($name); - $this->logger = $logger; - } - - protected function configure() - { - $this - ->setName('phpci:rebuild') - ->setDescription('Re-runs the last run build.'); - } - - /** - * Loops through running. - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $runner = new RunCommand($this->logger); - $runner->setMaxBuilds(1); - $runner->setDaemon(false); - - /** @var \PHPCI\Store\BuildStore $store */ - $store = Factory::getStore('Build'); - $service = new BuildService($store); - - $builds = $store->getLatestBuilds(null, 1); - $lastBuild = array_shift($builds); - $service->createDuplicateBuild($lastBuild); - - $runner->run(new ArgvInput(array()), $output); - } - - /** - * Called when log entries are made in Builder / the plugins. - * @see \PHPCI\Builder::log() - */ - public function logCallback($log) - { - $this->output->writeln($log); - } -} diff --git a/PHPCI/Command/RebuildQueueCommand.php b/PHPCI/Command/RebuildQueueCommand.php deleted file mode 100644 index 4b0af6d8..00000000 --- a/PHPCI/Command/RebuildQueueCommand.php +++ /dev/null @@ -1,85 +0,0 @@ - -* @package PHPCI -* @subpackage Console -*/ -class RebuildQueueCommand extends Command -{ - /** - * @var OutputInterface - */ - protected $output; - - /** - * @var Logger - */ - protected $logger; - - /** - * @param \Monolog\Logger $logger - * @param string $name - */ - public function __construct(Logger $logger, $name = null) - { - parent::__construct($name); - $this->logger = $logger; - } - - protected function configure() - { - $this - ->setName('phpci:rebuild-queue') - ->setDescription('Rebuilds the PHPCI worker queue.'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $this->output = $output; - - // For verbose mode we want to output all informational and above - // messages to the symphony output interface. - if ($input->hasOption('verbose') && $input->getOption('verbose')) { - $this->logger->pushHandler( - new OutputLogHandler($this->output, Logger::INFO) - ); - } - - $store = Factory::getStore('Build'); - $result = $store->getByStatus(0); - - $this->logger->addInfo(Lang::get('found_n_builds', count($result['items']))); - - $buildService = new BuildService($store); - - while (count($result['items'])) { - $build = array_shift($result['items']); - $build = BuildFactory::getBuild($build); - - $this->logger->addInfo('Added build #' . $build->getId() . ' to queue.'); - $buildService->addBuildToQueue($build); - } - } -} diff --git a/PHPCI/Command/RunCommand.php b/PHPCI/Command/RunCommand.php index c2c352e6..b384100d 100644 --- a/PHPCI/Command/RunCommand.php +++ b/PHPCI/Command/RunCommand.php @@ -11,12 +11,14 @@ namespace PHPCI\Command; use b8\Config; use Monolog\Logger; -use PHPCI\Helper\Lang; use PHPCI\Logging\BuildDBLogHandler; use PHPCI\Logging\LoggedBuildContextTidier; use PHPCI\Logging\OutputLogHandler; +use Psr\Log\LoggerAwareInterface; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use b8\Store\Factory; use PHPCI\Builder; @@ -44,7 +46,7 @@ class RunCommand extends Command /** * @var int */ - protected $maxBuilds = 100; + protected $maxBuilds = null; /** * @var bool @@ -65,7 +67,7 @@ class RunCommand extends Command { $this ->setName('phpci:run-builds') - ->setDescription(Lang::get('run_all_pending')); + ->setDescription('Run all pending PHPCI builds.'); } /** @@ -86,10 +88,10 @@ class RunCommand extends Command $running = $this->validateRunningBuilds(); $this->logger->pushProcessor(new LoggedBuildContextTidier()); - $this->logger->addInfo(Lang::get('finding_builds')); + $this->logger->addInfo("Finding builds to process"); $store = Factory::getStore('Build'); $result = $store->getByStatus(0, $this->maxBuilds); - $this->logger->addInfo(Lang::get('found_n_builds', count($result['items']))); + $this->logger->addInfo(sprintf("Found %d builds", count($result['items']))); $builds = 0; @@ -99,7 +101,7 @@ class RunCommand extends Command // Skip build (for now) if there's already a build running in that project: if (!$this->isFromDaemon && in_array($build->getProjectId(), $running)) { - $this->logger->addInfo(Lang::get('skipping_build', $build->getId())); + $this->logger->addInfo('Skipping Build #'.$build->getId() . ' - Project build already in progress.'); $result['items'][] = $build; // Re-run build validator: @@ -130,7 +132,7 @@ class RunCommand extends Command } - $this->logger->addInfo(Lang::get('finished_processing_builds')); + $this->logger->addInfo("Finished processing builds"); return $builds; } @@ -140,7 +142,7 @@ class RunCommand extends Command $this->maxBuilds = (int)$numBuilds; } - public function setDaemon($fromDaemon) + public function setIsDaemon($fromDaemon) { $this->isFromDaemon = (bool)$fromDaemon; } @@ -162,11 +164,11 @@ class RunCommand extends Command $start = $build->getStarted()->getTimestamp(); if (($now - $start) > $timeout) { - $this->logger->addInfo(Lang::get('marked_as_failed', $build->getId())); + $this->logger->addInfo('Build #'.$build->getId().' marked as failed due to timeout.'); $build->setStatus(Build::STATUS_FAILED); $build->setFinished(new \DateTime()); $store->save($build); - $build->removeBuildDirectory(); + $this->removeBuildDirectory($build); continue; } @@ -175,4 +177,19 @@ class RunCommand extends Command return $rtn; } + + protected function removeBuildDirectory($build) + { + $buildPath = PHPCI_DIR . 'PHPCI/build/' . $build->getId() . '/'; + + if (is_dir($buildPath)) { + $cmd = 'rm -Rf "%s"'; + + if (IS_WIN) { + $cmd = 'rmdir /S /Q "%s"'; + } + + shell_exec($cmd); + } + } } diff --git a/PHPCI/Command/UpdateCommand.php b/PHPCI/Command/UpdateCommand.php index 13e31f79..1b8becb1 100644 --- a/PHPCI/Command/UpdateCommand.php +++ b/PHPCI/Command/UpdateCommand.php @@ -9,11 +9,12 @@ namespace PHPCI\Command; -use b8\Config; use Monolog\Logger; -use PHPCI\Helper\Lang; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** @@ -39,7 +40,7 @@ class UpdateCommand extends Command { $this ->setName('phpci:update') - ->setDescription(Lang::get('update_phpci')); + ->setDescription('Update the database to reflect modified models.'); } /** @@ -47,22 +48,28 @@ class UpdateCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - if (!$this->verifyInstalled($output)) { - return; - } + $this->verifyInstalled($output); - $output->write(Lang::get('updating_phpci')); + $output->write('Updating PHPCI database: '); shell_exec(PHPCI_DIR . 'vendor/bin/phinx migrate -c "' . PHPCI_DIR . 'phinx.php"'); - $output->writeln(''.Lang::get('ok').''); + $output->writeln('Done!'); } protected function verifyInstalled(OutputInterface $output) { - $config = Config::getInstance(); - $phpciUrl = $config->get('phpci.url'); + if (!file_exists(PHPCI_DIR . 'PHPCI/config.yml')) { + $output->writeln('PHPCI does not appear to be installed.'); + $output->writeln('Please install PHPCI via phpci:install instead.'); + die; + } - return !empty($phpciUrl); + $content = file_get_contents(PHPCI_DIR . 'PHPCI/config.yml'); + if (empty($content)) { + $output->writeln('PHPCI does not appear to be installed.'); + $output->writeln('Please install PHPCI via phpci:install instead.'); + die; + } } } diff --git a/PHPCI/Command/WorkerCommand.php b/PHPCI/Command/WorkerCommand.php deleted file mode 100644 index 5ceb6a84..00000000 --- a/PHPCI/Command/WorkerCommand.php +++ /dev/null @@ -1,87 +0,0 @@ - -* @package PHPCI -* @subpackage Console -*/ -class WorkerCommand extends Command -{ - /** - * @var OutputInterface - */ - protected $output; - - /** - * @var Logger - */ - protected $logger; - - /** - * @param \Monolog\Logger $logger - * @param string $name - */ - public function __construct(Logger $logger, $name = null) - { - parent::__construct($name); - $this->logger = $logger; - } - - protected function configure() - { - $this - ->setName('phpci:worker') - ->setDescription('Runs the PHPCI build worker.') - ->addOption('debug', null, null, 'Run PHPCI in Debug Mode'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $this->output = $output; - - // For verbose mode we want to output all informational and above - // messages to the symphony output interface. - if ($input->hasOption('verbose') && $input->getOption('verbose')) { - $this->logger->pushHandler( - new OutputLogHandler($this->output, Logger::INFO) - ); - } - - // Allow PHPCI to run in "debug mode" - if ($input->hasOption('debug') && $input->getOption('debug')) { - $output->writeln('Debug mode enabled.'); - define('PHPCI_DEBUG_MODE', true); - } - - $config = Config::getInstance()->get('phpci.worker', []); - - if (empty($config['host']) || empty($config['queue'])) { - $error = 'The worker is not configured. You must set a host and queue in your config.yml file.'; - throw new \Exception($error); - } - - $worker = new BuildWorker($config['host'], $config['queue']); - $worker->setLogger($this->logger); - $worker->setMaxJobs(Config::getInstance()->get('phpci.worker.max_jobs', -1)); - $worker->startWorker(); - } -} diff --git a/PHPCI/Controller.php b/PHPCI/Controller.php index 68b1c845..57ed81f2 100644 --- a/PHPCI/Controller.php +++ b/PHPCI/Controller.php @@ -10,15 +10,10 @@ namespace PHPCI; use b8\Config; -use b8\Exception\HttpException\ForbiddenException; use b8\Http\Request; use b8\Http\Response; use b8\View; -/** - * PHPCI Base Controller - * @package PHPCI - */ class Controller extends \b8\Controller { /** @@ -31,24 +26,11 @@ class Controller extends \b8\Controller */ protected $view; - /** - * @var \b8\View - */ - public $layout; - - /** - * Initialise the controller. - */ public function init() { // Extended by actual controllers. } - /** - * @param Config $config - * @param Request $request - * @param Response $response - */ public function __construct(Config $config, Request $request, Response $response) { parent::__construct($config, $request, $response); @@ -58,9 +40,6 @@ class Controller extends \b8\Controller $this->setControllerView(); } - /** - * Set the view that this controller should use. - */ protected function setControllerView() { if (View::exists($this->className)) { @@ -70,10 +49,6 @@ class Controller extends \b8\Controller } } - /** - * Set the view that this controller action should use. - * @param $action - */ protected function setView($action) { if (View::exists($this->className . '/' . $action)) { @@ -81,21 +56,11 @@ class Controller extends \b8\Controller } } - /** - * Handle the incoming request. - * @param $action - * @param $actionParams - * @return \b8\b8\Http\Response|Response - */ public function handleAction($action, $actionParams) { $this->setView($action); $response = parent::handleAction($action, $actionParams); - if ($response instanceof Response) { - return $response; - } - if (is_string($response)) { $this->controllerView->content = $response; } elseif (isset($this->view)) { diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index 55ccbb37..a46a094a 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -11,10 +11,7 @@ namespace PHPCI\Controller; use b8; use b8\Exception\HttpException\NotFoundException; -use b8\Http\Response\JsonResponse; use PHPCI\BuildFactory; -use PHPCI\Helper\AnsiConverter; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; use PHPCI\Model\Project; use PHPCI\Service\BuildService; @@ -36,10 +33,7 @@ class BuildController extends \PHPCI\Controller * @var \PHPCI\Service\BuildService */ protected $buildService; - - /** - * Initialise the controller, set up stores and services. - */ + public function init() { $this->buildStore = b8\Store\Factory::getStore('Build'); @@ -58,53 +52,31 @@ class BuildController extends \PHPCI\Controller } if (empty($build)) { - throw new NotFoundException(Lang::get('build_x_not_found', $buildId)); + throw new NotFoundException('Build with ID: ' . $buildId . ' does not exist.'); } $this->view->plugins = $this->getUiPlugins(); $this->view->build = $build; $this->view->data = $this->getBuildData($build); - $this->layout->title = Lang::get('build_n', $buildId); + $this->layout->title = 'Build #' . $build->getId(); $this->layout->subtitle = $build->getProjectTitle(); - switch ($build->getStatus()) { - case 0: - $this->layout->skin = 'blue'; - break; - - case 1: - $this->layout->skin = 'yellow'; - break; - - case 2: - $this->layout->skin = 'green'; - break; - - case 3: - $this->layout->skin = 'red'; - break; - } - - $rebuild = Lang::get('rebuild_now'); - $rebuildLink = PHPCI_URL . 'build/rebuild/' . $build->getId(); - - $delete = Lang::get('delete_build'); - $deleteLink = PHPCI_URL . 'build/delete/' . $build->getId(); - - $actions = "{$rebuild} "; + $nav = array( + 'title' => 'Build '.$build->getId(), + 'icon' => 'cog', + 'links' => array( + 'build/rebuild/' . $build->getId() => 'Rebuild Now', + ), + ); if ($this->currentUserIsAdmin()) { - $actions .= " {$delete}"; + $nav['links']['build/delete/' . $build->getId()] = 'Delete Build'; } - $this->layout->actions = $actions; + $this->layout->nav = $nav; } - /** - * Returns an array of the JS plugins to include. - * @return array - */ protected function getUiPlugins() { $rtn = array(); @@ -127,17 +99,7 @@ class BuildController extends \PHPCI\Controller */ public function data($buildId) { - $response = new JsonResponse(); - $build = BuildFactory::getBuildById($buildId); - - if (!$build) { - $response->setResponseCode(404); - $response->setContent(array()); - return $response; - } - - $response->setContent($this->getBuildData($build)); - return $response; + die($this->getBuildData(BuildFactory::getBuildById($buildId))); } /** @@ -151,18 +113,16 @@ class BuildController extends \PHPCI\Controller $data = null; if ($key && $build) { - $data = $this->buildStore->getMeta($key, $build->getProjectId(), $buildId, $build->getBranch(), $numBuilds); + $data = $this->buildStore->getMeta($key, $build->getProjectId(), $buildId, $numBuilds); } - $response = new JsonResponse(); - $response->setContent($data); - return $response; + die(json_encode($data)); } /** * Get build data from database and json encode it: */ - protected function getBuildData(Build $build) + protected function getBuildData($build) { $data = array(); $data['status'] = (int)$build->getStatus(); @@ -170,21 +130,8 @@ class BuildController extends \PHPCI\Controller $data['created'] = !is_null($build->getCreated()) ? $build->getCreated()->format('Y-m-d H:i:s') : null; $data['started'] = !is_null($build->getStarted()) ? $build->getStarted()->format('Y-m-d H:i:s') : null; $data['finished'] = !is_null($build->getFinished()) ? $build->getFinished()->format('Y-m-d H:i:s') : null; - $data['duration'] = $build->getDuration(); - /** @var \PHPCI\Store\BuildErrorStore $errorStore */ - $errorStore = b8\Store\Factory::getStore('BuildError'); - $errors = $errorStore->getErrorsForBuild($build->getId(), $this->getParam('since', null)); - - $errorView = new b8\View('Build/errors'); - $errorView->build = $build; - $errorView->errors = $errors; - - $data['errors'] = $errorStore->getErrorTotalForBuild($build->getId()); - $data['error_html'] = $errorView->render(); - $data['since'] = (new \DateTime())->format('Y-m-d H:i:s'); - - return $data; + return json_encode($data); } /** @@ -195,18 +142,13 @@ class BuildController extends \PHPCI\Controller $copy = BuildFactory::getBuildById($buildId); if (empty($copy)) { - throw new NotFoundException(Lang::get('build_x_not_found', $buildId)); + throw new NotFoundException('Build with ID: ' . $buildId . ' does not exist.'); } $build = $this->buildService->createDuplicateBuild($copy); - if ($this->buildService->queueError) { - $_SESSION['global_error'] = Lang::get('add_to_queue_failed'); - } - - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId()); - return $response; + header('Location: '.PHPCI_URL.'build/view/' . $build->getId()); + exit; } /** @@ -219,14 +161,13 @@ class BuildController extends \PHPCI\Controller $build = BuildFactory::getBuildById($buildId); if (empty($build)) { - throw new NotFoundException(Lang::get('build_x_not_found', $buildId)); + throw new NotFoundException('Build with ID: ' . $buildId . ' does not exist.'); } $this->buildService->deleteBuild($build); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'project/view/' . $build->getProjectId()); - return $response; + header('Location: '.PHPCI_URL.'project/view/' . $build->getProjectId()); + exit; } /** @@ -234,12 +175,13 @@ class BuildController extends \PHPCI\Controller */ protected function cleanLog($log) { - return AnsiConverter::convert($log); + $log = str_replace('[0;32m', '', $log); + $log = str_replace('[0;31m', '', $log); + $log = str_replace('[0m', '', $log); + + return $log; } - /** - * Allows the UI to poll for the latest running and pending builds. - */ public function latest() { $rtn = array( @@ -247,16 +189,11 @@ class BuildController extends \PHPCI\Controller 'running' => $this->formatBuilds($this->buildStore->getByStatus(Build::STATUS_RUNNING)), ); - $response = new JsonResponse(); - $response->setContent($rtn); - return $response; + if ($this->request->isAjax()) { + die(json_encode($rtn)); + } } - /** - * Formats a list of builds into rows suitable for the dropdowns in the PHPCI header bar. - * @param $builds - * @return array - */ protected function formatBuilds($builds) { Project::$sleepable = array('id', 'title', 'reference', 'type'); diff --git a/PHPCI/Controller/BuildStatusController.php b/PHPCI/Controller/BuildStatusController.php index 62cb9ba7..5b6cdfd9 100644 --- a/PHPCI/Controller/BuildStatusController.php +++ b/PHPCI/Controller/BuildStatusController.php @@ -15,7 +15,6 @@ use b8\Store; use PHPCI\BuildFactory; use PHPCI\Model\Project; use PHPCI\Model\Build; -use PHPCI\Service\BuildStatusService; /** * Build Status Controller - Allows external access to build status information / images. @@ -25,14 +24,12 @@ use PHPCI\Service\BuildStatusService; */ class BuildStatusController extends \PHPCI\Controller { - /* @var \PHPCI\Store\ProjectStore */ + /** + * @var \PHPCI\Store\ProjectStore + */ protected $projectStore; - /* @var \PHPCI\Store\BuildStore */ protected $buildStore; - /** - * Initialise the controller, set up stores and services. - */ public function init() { $this->response->disableLayout(); @@ -53,7 +50,7 @@ class BuildStatusController extends \PHPCI\Controller $status = 'passing'; if (!$project->getAllowPublicStatus()) { - return null; + die(); } if (isset($project) && $project instanceof Project) { @@ -70,98 +67,18 @@ class BuildStatusController extends \PHPCI\Controller return $status; } - /** - * Displays projects information in ccmenu format - * - * @param $projectId - * @return bool - * @throws \Exception - * @throws b8\Exception\HttpException - */ - public function ccxml($projectId) - { - /* @var Project $project */ - $project = $this->projectStore->getById($projectId); - $xml = new \SimpleXMLElement(''); - - if (!$project instanceof Project || !$project->getAllowPublicStatus()) { - return $this->renderXml($xml); - } - - try { - $branchList = $this->buildStore->getBuildBranches($projectId); - - if (!$branchList) { - $branchList = array($project->getBranch()); - } - - foreach ($branchList as $branch) { - $buildStatusService = new BuildStatusService($branch, $project, $project->getLatestBuild($branch)); - if ($attributes = $buildStatusService->toArray()) { - $projectXml = $xml->addChild('Project'); - foreach ($attributes as $attributeKey => $attributeValue) { - $projectXml->addAttribute($attributeKey, $attributeValue); - } - } - } - } catch (\Exception $e) { - $xml = new \SimpleXMLElement(''); - } - - return $this->renderXml($xml); - } - - /** - * @param \SimpleXMLElement $xml - * @return bool - */ - protected function renderXml(\SimpleXMLElement $xml = null) - { - $this->response->setHeader('Content-Type', 'text/xml'); - $this->response->setContent($xml->asXML()); - $this->response->flush(); - echo $xml->asXML(); - - return true; - } - /** * Returns the appropriate build status image in SVG format for a given project. */ public function image($projectId) { - $style = $this->getParam('style', 'plastic'); - $label = $this->getParam('label', 'build'); - $status = $this->getStatus($projectId); - - if (is_null($status)) { - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', '/'); - return $response; - } - $color = ($status == 'passing') ? 'green' : 'red'; - $image = file_get_contents(sprintf( - 'http://img.shields.io/badge/%s-%s-%s.svg?style=%s', - $label, - $status, - $color, - $style - )); - - $this->response->disableLayout(); - $this->response->setHeader('Content-Type', 'image/svg+xml'); - $this->response->setContent($image); - return $this->response; + + header('Content-Type: image/svg+xml'); + die(file_get_contents('http://img.shields.io/badge/build-' . $status . '-' . $color . '.svg')); } - /** - * View the public status page of a given project, if enabled. - * @param $projectId - * @return string - * @throws \b8\Exception\HttpException\NotFoundException - */ public function view($projectId) { $project = $this->projectStore->getById($projectId); diff --git a/PHPCI/Controller/GroupController.php b/PHPCI/Controller/GroupController.php deleted file mode 100644 index 898f9e41..00000000 --- a/PHPCI/Controller/GroupController.php +++ /dev/null @@ -1,120 +0,0 @@ - - * @package PHPCI - * @subpackage Web - */ -class GroupController extends Controller -{ - /** - * @var \PHPCI\Store\ProjectGroupStore - */ - protected $groupStore; - - /** - * Set up this controller. - */ - public function init() - { - $this->groupStore = b8\Store\Factory::getStore('ProjectGroup'); - } - - /** - * List project groups. - */ - public function index() - { - $this->requireAdmin(); - - $groups = array(); - $groupList = $this->groupStore->getWhere(array(), 100, 0, array(), array('title' => 'ASC')); - - foreach ($groupList['items'] as $group) { - $thisGroup = array( - 'title' => $group->getTitle(), - 'id' => $group->getId(), - ); - $projects = b8\Store\Factory::getStore('Project')->getByGroupId($group->getId()); - $thisGroup['projects'] = $projects['items']; - $groups[] = $thisGroup; - } - - $this->view->groups = $groups; - } - - /** - * Add or edit a project group. - * @param null $groupId - * @return void|b8\Http\Response\RedirectResponse - */ - public function edit($groupId = null) - { - $this->requireAdmin(); - - if (!is_null($groupId)) { - $group = $this->groupStore->getById($groupId); - } else { - $group = new ProjectGroup(); - } - - if ($this->request->getMethod() == 'POST') { - $group->setTitle($this->getParam('title')); - $this->groupStore->save($group); - - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'group'); - return $response; - } - - $form = new Form(); - $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'group/edit' . (!is_null($groupId) ? '/' . $groupId : '')); - - $title = new Form\Element\Text('title'); - $title->setContainerClass('form-group'); - $title->setClass('form-control'); - $title->setLabel('Group Title'); - $title->setValue($group->getTitle()); - - $submit = new Form\Element\Submit(); - $submit->setValue('Save Group'); - - $form->addField($title); - $form->addField($submit); - - $this->view->form = $form; - } - - /** - * Delete a project group. - * @param $groupId - * @return b8\Http\Response\RedirectResponse - */ - public function delete($groupId) - { - $this->requireAdmin(); - $group = $this->groupStore->getById($groupId); - - $this->groupStore->delete($group); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'group'); - return $response; - } -} diff --git a/PHPCI/Controller/HomeController.php b/PHPCI/Controller/HomeController.php index 4241d324..0bb176dc 100644 --- a/PHPCI/Controller/HomeController.php +++ b/PHPCI/Controller/HomeController.php @@ -11,7 +11,6 @@ namespace PHPCI\Controller; use b8; use PHPCI\BuildFactory; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -23,28 +22,19 @@ use PHPCI\Model\Build; class HomeController extends \PHPCI\Controller { /** - * @var \PHPCI\Store\BuildStore + * @var \b8\Store\BuildStore */ protected $buildStore; /** - * @var \PHPCI\Store\ProjectStore + * @var \b8\Store\ProjectStore */ protected $projectStore; - /** - * @var \PHPCI\Store\ProjectGroupStore - */ - protected $groupStore; - - /** - * Initialise the controller, set up stores and services. - */ public function init() { $this->buildStore = b8\Store\Factory::getStore('Build'); $this->projectStore = b8\Store\Factory::getStore('Project'); - $this->groupStore = b8\Store\Factory::getStore('ProjectGroup'); } /** @@ -52,7 +42,10 @@ class HomeController extends \PHPCI\Controller */ public function index() { - $this->layout->title = Lang::get('dashboard'); + $this->layout->title = 'Dashboard'; + + $projects = $this->projectStore->getWhere(array(), 50, 0, array(), array('title' => 'ASC')); + $builds = $this->buildStore->getLatestBuilds(null, 10); foreach ($builds as &$build) { @@ -60,7 +53,8 @@ class HomeController extends \PHPCI\Controller } $this->view->builds = $builds; - $this->view->groups = $this->getGroupInfo(); + $this->view->projects = $projects['items']; + $this->view->summary = $this->getSummaryHtml($projects); return $this->view->render(); } @@ -70,46 +64,24 @@ class HomeController extends \PHPCI\Controller */ public function latest() { - $this->response->disableLayout(); - $this->response->setContent($this->getLatestBuildsHtml()); - return $this->response; + die($this->getLatestBuildsHtml()); } - /** - * Ajax request for the project overview section of the dashboard. - */ public function summary() { - $this->response->disableLayout(); $projects = $this->projectStore->getWhere(array(), 50, 0, array(), array('title' => 'ASC')); - $this->response->setContent($this->getSummaryHtml($projects)); - return $this->response; + die($this->getSummaryHtml($projects)); } - /** - * Generate the HTML for the project overview section of the dashboard. - * @param $projects - * @return string - */ protected function getSummaryHtml($projects) { $summaryBuilds = array(); - $successes = array(); - $failures = array(); - $counts = array(); + $successes = array(); + $failures = array(); - foreach ($projects as $project) { + foreach ($projects['items'] as $project) { $summaryBuilds[$project->getId()] = $this->buildStore->getLatestBuilds($project->getId()); - $count = $this->buildStore->getWhere( - array('project_id' => $project->getId()), - 1, - 0, - array(), - array('id' => 'DESC') - ); - $counts[$project->getId()] = $count['count']; - $success = $this->buildStore->getLastBuildByStatus($project->getId(), Build::STATUS_SUCCESS); $failure = $this->buildStore->getLastBuildByStatus($project->getId(), Build::STATUS_FAILED); @@ -118,11 +90,10 @@ class HomeController extends \PHPCI\Controller } $summaryView = new b8\View('SummaryTable'); - $summaryView->projects = $projects; - $summaryView->builds = $summaryBuilds; + $summaryView->projects = $projects['items']; + $summaryView->builds = $summaryBuilds; $summaryView->successful = $successes; - $summaryView->failed = $failures; - $summaryView->counts = $counts; + $summaryView->failed = $failures; return $summaryView->render(); } @@ -143,24 +114,4 @@ class HomeController extends \PHPCI\Controller return $view->render(); } - - /** - * Get a summary of the project groups we have, and what projects they have in them. - * @return array - */ - protected function getGroupInfo() - { - $rtn = array(); - $groups = $this->groupStore->getWhere(array(), 100, 0, array(), array('title' => 'ASC')); - - foreach ($groups['items'] as $group) { - $thisGroup = array('title' => $group->getTitle()); - $projects = $this->projectStore->getByGroupId($group->getId()); - $thisGroup['projects'] = $projects['items']; - $thisGroup['summary'] = $this->getSummaryHtml($thisGroup['projects']); - $rtn[] = $thisGroup; - } - - return $rtn; - } } diff --git a/PHPCI/Controller/PluginController.php b/PHPCI/Controller/PluginController.php index 64cb1463..de9f5e0f 100644 --- a/PHPCI/Controller/PluginController.php +++ b/PHPCI/Controller/PluginController.php @@ -10,7 +10,7 @@ namespace PHPCI\Controller; use b8; -use PHPCI\Helper\Lang; +use PHPCI\Model\Build; use PHPCI\Plugin\Util\ComposerPluginInformation; use PHPCI\Plugin\Util\FilesPluginInformation; use PHPCI\Plugin\Util\PluginInformationCollection; @@ -23,16 +23,35 @@ use PHPCI\Plugin\Util\PluginInformationCollection; */ class PluginController extends \PHPCI\Controller { - /** - * List all enabled plugins, installed and recommend packages. - * @return string - */ + protected $required = array( + 'php', + 'ext-mcrypt', + 'ext-pdo', + 'ext-pdo_mysql', + 'block8/b8framework', + 'ircmaxell/password-compat', + 'swiftmailer/swiftmailer', + 'symfony/yaml', + 'symfony/console', + 'psr/log', + 'monolog/monolog', + 'pimple/pimple', + 'robmorgan/phinx', + ); + + protected $canInstall; + protected $composerPath; + public function index() { $this->requireAdmin(); + $this->view->canWrite = is_writable(APPLICATION_PATH . 'composer.json'); + $this->view->required = $this->required; + $json = $this->getComposerJson(); $this->view->installedPackages = $json['require']; + $this->view->suggestedPackages = $json['suggest']; $pluginInfo = new PluginInformationCollection(); $pluginInfo->add(FilesPluginInformation::newFromDir( @@ -44,18 +63,112 @@ class PluginController extends \PHPCI\Controller $this->view->plugins = $pluginInfo->getInstalledPlugins(); - $this->layout->title = Lang::get('plugins'); + $this->layout->title = 'Plugins'; return $this->view->render(); } - /** - * Get the json-decoded contents of the composer.json file. - * @return mixed - */ + public function remove() + { + $this->requireAdmin(); + + $package = $this->getParam('package', null); + $json = $this->getComposerJson(); + + if (!in_array($package, $this->required)) { + unset($json['require'][$package]); + $this->setComposerJson($json); + + header('Location: ' . PHPCI_URL . 'plugin?r=' . $package); + die; + } + + header('Location: ' . PHPCI_URL); + die; + } + + public function install() + { + $this->requireAdmin(); + + $package = $this->getParam('package', null); + $version = $this->getParam('version', '*'); + + $json = $this->getComposerJson(); + $json['require'][$package] = $version; + $this->setComposerJson($json); + + header('Location: ' . PHPCI_URL . 'plugin?w=' . $package); + die; + } + protected function getComposerJson() { $json = file_get_contents(APPLICATION_PATH . 'composer.json'); return json_decode($json, true); } + + /** + * Convert array to json and save composer.json + * + * @param $array + */ + protected function setComposerJson($array) + { + if (defined('JSON_PRETTY_PRINT')) { + $json = json_encode($array, JSON_PRETTY_PRINT); + } else { + $json = json_encode($array); + } + + file_put_contents(APPLICATION_PATH . 'composer.json', $json); + } + + protected function findBinary($binary) + { + if (is_string($binary)) { + $binary = array($binary); + } + + foreach ($binary as $bin) { + // Check project root directory: + if (is_file(APPLICATION_PATH . $bin)) { + return APPLICATION_PATH . $bin; + } + + // Check Composer bin dir: + if (is_file(APPLICATION_PATH . 'vendor/bin/' . $bin)) { + return APPLICATION_PATH . 'vendor/bin/' . $bin; + } + + // Use "which" + $which = trim(shell_exec('which ' . $bin)); + + if (!empty($which)) { + return $which; + } + } + + return null; + } + + public function packagistSearch() + { + $searchQuery = $this->getParam('q', ''); + $http = new \b8\HttpClient(); + $http->setHeaders(array('User-Agent: PHPCI/1.0 (+https://www.phptesting.org)')); + $res = $http->get('https://packagist.org/search.json', array('q' => $searchQuery)); + + die(json_encode($res['body'])); + } + + public function packagistVersions() + { + $name = $this->getParam('p', ''); + $http = new \b8\HttpClient(); + $http->setHeaders(array('User-Agent: PHPCI/1.0 (+https://www.phptesting.org)')); + $res = $http->get('https://packagist.org/packages/'.$name.'.json'); + + die(json_encode($res['body'])); + } } diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index 72be46e5..69d8b95e 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -10,14 +10,16 @@ namespace PHPCI\Controller; use b8; +use b8\Controller; use b8\Form; +use b8\Exception\HttpException\ForbiddenException; use b8\Exception\HttpException\NotFoundException; use b8\Store; -use PHPCI; use PHPCI\BuildFactory; use PHPCI\Helper\Github; -use PHPCI\Helper\Lang; use PHPCI\Helper\SshKey; +use PHPCI\Model\Build; +use PHPCI\Model\Project; use PHPCI\Service\BuildService; use PHPCI\Service\ProjectService; @@ -27,7 +29,7 @@ use PHPCI\Service\ProjectService; * @package PHPCI * @subpackage Web */ -class ProjectController extends PHPCI\Controller +class ProjectController extends \PHPCI\Controller { /** * @var \PHPCI\Store\ProjectStore @@ -49,9 +51,6 @@ class ProjectController extends PHPCI\Controller */ protected $buildService; - /** - * Initialise the controller, set up stores and services. - */ public function init() { $this->buildStore = Store\Factory::getStore('Build'); @@ -69,7 +68,7 @@ class ProjectController extends PHPCI\Controller $project = $this->projectStore->getById($projectId); if (empty($project)) { - throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); + throw new NotFoundException('Project with id: ' . $projectId . ' not found'); } $per_page = 10; @@ -78,15 +77,13 @@ class ProjectController extends PHPCI\Controller $pages = $builds[1] == 0 ? 1 : ceil($builds[1] / $per_page); if ($page > $pages) { - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'project/view/'.$projectId); - return $response; + throw new NotFoundException('Page with number: ' . $page . ' not found'); } $this->view->builds = $builds[0]; $this->view->total = $builds[1]; $this->view->project = $project; - $this->view->branch = urldecode($branch); + $this->view->branch = urldecode($branch); $this->view->branches = $this->projectStore->getKnownBranches($projectId); $this->view->page = $page; $this->view->pages = $pages; @@ -110,19 +107,14 @@ class ProjectController extends PHPCI\Controller } if (empty($project)) { - throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); + throw new NotFoundException('Project with id: ' . $projectId . ' not found'); } $email = $_SESSION['phpci_user']->getEmail(); $build = $this->buildService->createBuild($project, null, urldecode($branch), $email); - if ($this->buildService->queueError) { - $_SESSION['global_error'] = Lang::get('add_to_queue_failed'); - } - - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId()); - return $response; + header('Location: '.PHPCI_URL.'build/view/' . $build->getId()); + exit; } /** @@ -135,9 +127,8 @@ class ProjectController extends PHPCI\Controller $project = $this->projectStore->getById($projectId); $this->projectService->deleteProject($project); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL); - return $response; + header('Location: '.PHPCI_URL); + exit; } /** @@ -147,10 +138,7 @@ class ProjectController extends PHPCI\Controller { $branch = $this->getParam('branch', ''); $builds = $this->getLatestBuildsHtml($projectId, urldecode($branch)); - - $this->response->disableLayout(); - $this->response->setContent($builds[0]); - return $this->response; + die($builds[0]); } /** @@ -186,7 +174,7 @@ class ProjectController extends PHPCI\Controller */ public function add() { - $this->layout->title = Lang::get('add_project'); + $this->layout->title = 'Add Project'; $this->requireAdmin(); $method = $this->request->getMethod(); @@ -224,14 +212,11 @@ class ProjectController extends PHPCI\Controller 'build_config' => $this->getParam('build_config', null), 'allow_public_status' => $this->getParam('allow_public_status', 0), 'branch' => $this->getParam('branch', null), - 'group' => $this->getParam('group_id', null), ); $project = $this->projectService->createProject($title, $type, $reference, $options); - - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'project/view/' . $project->getId()); - return $response; + header('Location: '.PHPCI_URL.'project/view/' . $project->getId()); + die; } } @@ -246,11 +231,10 @@ class ProjectController extends PHPCI\Controller $project = $this->projectStore->getById($projectId); if (empty($project)) { - throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); + throw new NotFoundException('Project with id: ' . $projectId . ' not found'); } - $this->layout->title = $project->getTitle(); - $this->layout->subtitle = Lang::get('edit_project'); + $this->config->set('page_title', 'Edit: ' . $project->getTitle()); $values = $project->getDataArray(); $values['key'] = $values['ssh_private_key']; @@ -273,12 +257,12 @@ class ProjectController extends PHPCI\Controller $view->type = 'edit'; $view->project = $project; $view->form = $form; - $view->key = $values['pubkey']; + $view->key = null; return $view->render(); } - $title = $this->getParam('title', Lang::get('new_project')); + $title = $this->getParam('title', 'New Project'); $reference = $this->getParam('reference', null); $type = $this->getParam('type', null); @@ -287,16 +271,13 @@ class ProjectController extends PHPCI\Controller 'ssh_public_key' => $this->getParam('pubkey', null), 'build_config' => $this->getParam('build_config', null), 'allow_public_status' => $this->getParam('allow_public_status', 0), - 'archived' => $this->getParam('archived', 0), 'branch' => $this->getParam('branch', null), - 'group' => $this->getParam('group_id', null), ); $project = $this->projectService->updateProject($project, $title, $type, $reference, $options); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'project/view/' . $project->getId()); - return $response; + header('Location: '.PHPCI_URL.'project/view/' . $project->getId()); + die; } /** @@ -311,18 +292,17 @@ class ProjectController extends PHPCI\Controller $form->addField(new Form\Element\Hidden('pubkey')); $options = array( - 'choose' => Lang::get('select_repository_type'), - 'github' => Lang::get('github'), - 'bitbucket' => Lang::get('bitbucket'), - 'gitlab' => Lang::get('gitlab'), - 'remote' => Lang::get('remote'), - 'local' => Lang::get('local'), - 'hg' => Lang::get('hg'), - 'svn' => Lang::get('svn'), + 'choose' => 'Select repository type...', + 'github' => 'Github', + 'bitbucket' => 'Bitbucket', + 'gitlab' => 'Gitlab', + 'remote' => 'Remote URL', + 'local' => 'Local Path', + 'hg' => 'Mercurial', ); - $field = Form\Element\Select::create('type', Lang::get('where_hosted'), true); - $field->setPattern('^(github|bitbucket|gitlab|remote|local|hg|svn)'); + $field = Form\Element\Select::create('type', 'Where is your project hosted?', true); + $field->setPattern('^(github|bitbucket|gitlab|remote|local|hg)'); $field->setOptions($options); $field->setClass('form-control')->setContainerClass('form-group'); $form->addField($field); @@ -330,62 +310,45 @@ class ProjectController extends PHPCI\Controller $container = new Form\ControlGroup('github-container'); $container->setClass('github-container'); - $field = Form\Element\Select::create('github', Lang::get('choose_github'), false); + $field = Form\Element\Select::create('github', 'Choose a Github repository:', false); $field->setClass('form-control')->setContainerClass('form-group'); $container->addField($field); $form->addField($container); - $field = Form\Element\Text::create('reference', Lang::get('repo_name'), true); + $field = Form\Element\Text::create('reference', 'Repository Name / URL (Remote) or Path (Local)', true); $field->setValidator($this->getReferenceValidator($values)); $field->setClass('form-control')->setContainerClass('form-group'); $form->addField($field); - $field = Form\Element\Text::create('title', Lang::get('project_title'), true); + $field = Form\Element\Text::create('title', 'Project Title', true); $field->setClass('form-control')->setContainerClass('form-group'); $form->addField($field); - $field = Form\Element\TextArea::create('key', Lang::get('project_private_key'), false); + $title = 'Private key to use to access repository (leave blank for local and/or anonymous remotes)'; + $field = Form\Element\TextArea::create('key', $title, false); $field->setClass('form-control')->setContainerClass('form-group'); $field->setRows(6); $form->addField($field); - $field = Form\Element\TextArea::create('build_config', Lang::get('build_config'), false); + $label = 'PHPCI build config for this project (if you cannot add a phpci.yml file in the project repository)'; + $field = Form\Element\TextArea::create('build_config', $label, false); $field->setClass('form-control')->setContainerClass('form-group'); $field->setRows(6); $form->addField($field); - $field = Form\Element\Text::create('branch', Lang::get('default_branch'), true); + $field = Form\Element\Text::create('branch', 'Default branch name', true); $field->setClass('form-control')->setContainerClass('form-group')->setValue('master'); $form->addField($field); - $field = Form\Element\Select::create('group_id', 'Project Group', true); - $field->setClass('form-control')->setContainerClass('form-group')->setValue(1); - - $groups = array(); - $groupStore = b8\Store\Factory::getStore('ProjectGroup'); - $groupList = $groupStore->getWhere(array(), 100, 0, array(), array('title' => 'ASC')); - - foreach ($groupList['items'] as $group) { - $groups[$group->getId()] = $group->getTitle(); - } - - $field->setOptions($groups); - $form->addField($field); - - $field = Form\Element\Checkbox::create('allow_public_status', Lang::get('allow_public_status'), false); - $field->setContainerClass('form-group'); - $field->setCheckedValue(1); - $field->setValue(0); - $form->addField($field); - - $field = Form\Element\Checkbox::create('archived', Lang::get('archived'), false); + $label = 'Enable public status page and image for this project?'; + $field = Form\Element\Checkbox::create('allow_public_status', $label, false); $field->setContainerClass('form-group'); $field->setCheckedValue(1); $field->setValue(0); $form->addField($field); $field = new Form\Element\Submit(); - $field->setValue(Lang::get('save_project')); + $field->setValue('Save Project'); $field->setContainerClass('form-group'); $field->setClass('btn-success'); $form->addField($field); @@ -400,17 +363,9 @@ class ProjectController extends PHPCI\Controller protected function githubRepositories() { $github = new Github(); - - $response = new b8\Http\Response\JsonResponse(); - $response->setContent($github->getRepositories()); - return $response; + die(json_encode($github->getRepositories())); } - /** - * Get the validator to use to check project references. - * @param $values - * @return callable - */ protected function getReferenceValidator($values) { return function ($val) use ($values) { @@ -419,30 +374,30 @@ class ProjectController extends PHPCI\Controller $validators = array( 'hg' => array( 'regex' => '/^(https?):\/\//', - 'message' => Lang::get('error_mercurial') + 'message' => 'Mercurial repository URL must be start with http:// or https://' ), 'remote' => array( 'regex' => '/^(git|https?):\/\//', - 'message' => Lang::get('error_remote') + 'message' => 'Repository URL must be start with git://, http:// or https://' ), 'gitlab' => array( 'regex' => '`^(.*)@(.*):(.*)/(.*)\.git`', - 'message' => Lang::get('error_gitlab') + 'message' => 'GitLab Repository name must be in the format "user@domain.tld:owner/repo.git"' ), 'github' => array( 'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/', - 'message' => Lang::get('error_github') + 'message' => 'Repository name must be in the format "owner/repo"' ), 'bitbucket' => array( 'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/', - 'message' => Lang::get('error_bitbucket') + 'message' => 'Repository name must be in the format "owner/repo"' ), ); if (in_array($type, $validators) && !preg_match($validators[$type]['regex'], $val)) { throw new \Exception($validators[$type]['message']); } elseif ($type == 'local' && !is_dir($val)) { - throw new \Exception(Lang::get('error_path')); + throw new \Exception('The path you specified does not exist.'); } return true; diff --git a/PHPCI/Controller/SessionController.php b/PHPCI/Controller/SessionController.php index b68d61f7..f7bfa982 100644 --- a/PHPCI/Controller/SessionController.php +++ b/PHPCI/Controller/SessionController.php @@ -11,7 +11,6 @@ namespace PHPCI\Controller; use b8; use PHPCI\Helper\Email; -use PHPCI\Helper\Lang; /** * Session Controller - Handles user login / logout. @@ -26,9 +25,6 @@ class SessionController extends \PHPCI\Controller */ protected $userStore; - /** - * Initialise the controller, set up stores and services. - */ public function init() { $this->response->disableLayout(); @@ -43,23 +39,14 @@ class SessionController extends \PHPCI\Controller $isLoginFailure = false; if ($this->request->getMethod() == 'POST') { - $token = $this->getParam('token'); - if (!isset($token, $_SESSION['login_token']) || $token !== $_SESSION['login_token']) { - $isLoginFailure = true; + $user = $this->userStore->getByEmail($this->getParam('email')); + + if ($user && password_verify($this->getParam('password', ''), $user->getHash())) { + $_SESSION['phpci_user_id'] = $user->getId(); + header('Location: ' . $this->getLoginRedirect()); + die; } else { - unset($_SESSION['login_token']); - - $user = $this->userStore->getByEmail($this->getParam('email')); - - if ($user && password_verify($this->getParam('password', ''), $user->getHash())) { - session_regenerate_id(true); - $_SESSION['phpci_user_id'] = $user->getId(); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', $this->getLoginRedirect()); - return $response; - } else { - $isLoginFailure = true; - } + $isLoginFailure = true; } } @@ -68,33 +55,27 @@ class SessionController extends \PHPCI\Controller $form->setAction(PHPCI_URL.'session/login'); $email = new b8\Form\Element\Email('email'); - $email->setLabel(Lang::get('email_address')); + $email->setLabel('Email Address'); $email->setRequired(true); $email->setContainerClass('form-group'); $email->setClass('form-control'); $form->addField($email); $pwd = new b8\Form\Element\Password('password'); - $pwd->setLabel(Lang::get('password')); + $pwd->setLabel('Password'); $pwd->setRequired(true); $pwd->setContainerClass('form-group'); $pwd->setClass('form-control'); $form->addField($pwd); $pwd = new b8\Form\Element\Submit(); - $pwd->setValue(Lang::get('log_in')); + $pwd->setValue('Log in »'); $pwd->setClass('btn-success'); $form->addField($pwd); - $tokenValue = $this->generateToken(); - $_SESSION['login_token'] = $tokenValue; - $token = new b8\Form\Element\Hidden('token'); - $token->setValue($tokenValue); - $form->addField($token); - $this->view->form = $form->render(); $this->view->failed = $isLoginFailure; - + return $this->view->render(); } @@ -107,16 +88,10 @@ class SessionController extends \PHPCI\Controller unset($_SESSION['phpci_user_id']); session_destroy(); - - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL); - return $response; + header('Location: ' . PHPCI_URL); + die; } - /** - * Allows the user to request a password reset email. - * @return string - */ public function forgotPassword() { if ($this->request->getMethod() == 'POST') { @@ -124,18 +99,33 @@ class SessionController extends \PHPCI\Controller $user = $this->userStore->getByEmail($email); if (empty($user)) { - $this->view->error = Lang::get('reset_no_user_exists'); + $this->view->error = 'No user exists with that email address, please try again.'; return $this->view->render(); } $key = md5(date('Y-m-d') . $user->getHash()); $url = PHPCI_URL; + $name = $user->getName(); + $userId = $user->getId(); + + $message = <<getName(), $url, $user->getId(), $key); $email = new Email(); $email->setEmailTo($user->getEmail(), $user->getName()); - $email->setSubject(Lang::get('reset_email_title', $user->getName())); + $email->setSubject('Password reset'); $email->setBody($message); $email->send(); @@ -145,19 +135,13 @@ class SessionController extends \PHPCI\Controller return $this->view->render(); } - /** - * Allows the user to change their password after a password reset email. - * @param $userId - * @param $key - * @return string - */ public function resetPassword($userId, $key) { $user = $this->userStore->getById($userId); $userKey = md5(date('Y-m-d') . $user->getHash()); if (empty($user) || $key != $userKey) { - $this->view->error = Lang::get('reset_invalid'); + $this->view->error = 'Invalid password reset request.'; return $this->view->render(); } @@ -168,9 +152,8 @@ class SessionController extends \PHPCI\Controller $_SESSION['phpci_user'] = $this->userStore->save($user); $_SESSION['phpci_user_id'] = $user->getId(); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL); - return $response; + header('Location: ' . PHPCI_URL); + die; } $this->view->id = $userId; @@ -179,10 +162,6 @@ class SessionController extends \PHPCI\Controller return $this->view->render(); } - /** - * Get the URL the user was trying to go to prior to being asked to log in. - * @return string - */ protected function getLoginRedirect() { $rtn = PHPCI_URL; @@ -194,20 +173,4 @@ class SessionController extends \PHPCI\Controller return $rtn; } - - /** Generate a random token. - * - * @return string - */ - protected function generateToken() - { - if (function_exists('openssl_random_pseudo_bytes')) { - return bin2hex(openssl_random_pseudo_bytes(16)); - } - - return sprintf("%04x", mt_rand(0, 0xFFFF)) - . sprintf("%04x", mt_rand(0, 0xFFFF)) - . sprintf("%04x", mt_rand(0, 0xFFFF)) - . sprintf("%04x", mt_rand(0, 0xFFFF)); - } } diff --git a/PHPCI/Controller/SettingsController.php b/PHPCI/Controller/SettingsController.php index 645e19a4..09dd6bf3 100644 --- a/PHPCI/Controller/SettingsController.php +++ b/PHPCI/Controller/SettingsController.php @@ -13,52 +13,39 @@ use b8; use b8\Form; use b8\HttpClient; use PHPCI\Controller; -use PHPCI\Helper\Lang; +use PHPCI\Model\Build; use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; /** * Settings Controller - * * @author Dan Cryer * @package PHPCI * @subpackage Web */ class SettingsController extends Controller { - - /** - * @var array - */ protected $settings; - /** - * Initialise the controller, set up stores and services. - */ public function init() { parent::init(); - $parser = new Parser(); - $yaml = file_get_contents(PHPCI_CONFIG_FILE); + $parser = new Parser(); + $yaml = file_get_contents(APPLICATION_PATH . 'PHPCI/config.yml'); $this->settings = $parser->parse($yaml); } - /** - * Display settings forms. - * @return string - */ public function index() { $this->requireAdmin(); - $this->layout->title = Lang::get('settings'); - + $this->layout->title = 'Settings'; $this->view->settings = $this->settings; - $basicSettings = array(); - if (isset($this->settings['phpci']['basic'])) { - $basicSettings = $this->settings['phpci']['basic']; + $emailSettings = array(); + if (isset($this->settings['phpci']['email_settings'])) { + $emailSettings = $this->settings['phpci']['email_settings']; } $buildSettings = array(); @@ -66,22 +53,9 @@ class SettingsController extends Controller $buildSettings = $this->settings['phpci']['build']; } - $emailSettings = array(); - if (isset($this->settings['phpci']['email_settings'])) { - $emailSettings = $this->settings['phpci']['email_settings']; - } - - $authSettings = array(); - if (isset($this->settings['phpci']['authentication_settings'])) { - $authSettings = $this->settings['phpci']['authentication_settings']; - } - - $this->view->configFile = PHPCI_CONFIG_FILE; - $this->view->basicSettings = $this->getBasicForm($basicSettings); - $this->view->buildSettings = $this->getBuildForm($buildSettings); $this->view->github = $this->getGithubForm(); $this->view->emailSettings = $this->getEmailForm($emailSettings); - $this->view->authenticationSettings = $this->getAuthenticationForm($authSettings); + $this->view->buildSettings = $this->getBuildForm($buildSettings); $this->view->isWriteable = $this->canWriteConfig(); if (!empty($this->settings['phpci']['github']['token'])) { @@ -91,54 +65,41 @@ class SettingsController extends Controller return $this->view->render(); } - /** - * Save Github settings. - */ 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(); - - $response = new b8\Http\Response\RedirectResponse(); + $error = $this->storeSettings(); if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); + header('Location: ' . PHPCI_URL . 'settings?saved=2'); } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); + header('Location: ' . PHPCI_URL . 'settings?saved=1'); } - return $response; + die; } - /** - * Save email settings. - */ 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(); - $response = new b8\Http\Response\RedirectResponse(); - if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); + header('Location: ' . PHPCI_URL . 'settings?saved=2'); } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); + header('Location: ' . PHPCI_URL . 'settings?saved=1'); } - return $response; + die; } - /** - * Save build settings. - */ public function build() { $this->requireAdmin(); @@ -147,59 +108,13 @@ class SettingsController extends Controller $error = $this->storeSettings(); - $response = new b8\Http\Response\RedirectResponse(); - if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); + header('Location: ' . PHPCI_URL . 'settings?saved=2'); } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); + header('Location: ' . PHPCI_URL . 'settings?saved=1'); } - return $response; - } - - /** - * Save basic settings. - */ - public function basic() - { - $this->requireAdmin(); - - $this->settings['phpci']['basic'] = $this->getParams(); - $error = $this->storeSettings(); - - $response = new b8\Http\Response\RedirectResponse(); - - if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); - } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); - } - - return $response; - } - - /** - * Handle authentication settings - */ - 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(); - - $response = new b8\Http\Response\RedirectResponse(); - - if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); - } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); - } - - return $response; + die; } /** @@ -207,14 +122,14 @@ class SettingsController extends Controller */ 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); @@ -222,27 +137,25 @@ class SettingsController extends Controller $this->settings['phpci']['github']['token'] = $resp['access_token']; $this->storeSettings(); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'settings?linked=1'); - return $response; + header('Location: ' . PHPCI_URL . 'settings?linked=1'); + die; } } - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'settings?linked=2'); - return $response; + + header('Location: ' . PHPCI_URL . 'settings?linked=2'); + die; } /** * Convert config to yaml and store to file. - * * @return mixed */ protected function storeSettings() { $dumper = new Dumper(); - $yaml = $dumper->dump($this->settings, 4); - file_put_contents(PHPCI_CONFIG_FILE, $yaml); + $yaml = $dumper->dump($this->settings, 4); + file_put_contents(APPLICATION_PATH . 'PHPCI/config.yml', $yaml); if (error_get_last()) { $error_get_last = error_get_last(); @@ -250,10 +163,6 @@ class SettingsController extends Controller } } - /** - * Get the Github settings form. - * @return Form - */ protected function getGithubForm() { $form = new Form(); @@ -264,7 +173,7 @@ class SettingsController extends Controller $field = new Form\Element\Text('githubid'); $field->setRequired(true); $field->setPattern('[a-zA-Z0-9]+'); - $field->setLabel(Lang::get('application_id')); + $field->setLabel('Application ID'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $form->addField($field); @@ -276,7 +185,7 @@ class SettingsController extends Controller $field = new Form\Element\Text('githubsecret'); $field->setRequired(true); $field->setPattern('[a-zA-Z0-9]+'); - $field->setLabel(Lang::get('application_secret')); + $field->setLabel('Application Secret'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $form->addField($field); @@ -286,18 +195,13 @@ class SettingsController extends Controller } $field = new Form\Element\Submit(); - $field->setValue(Lang::get('save')); + $field->setValue('Save »'); $field->setClass('btn btn-success pull-right'); $form->addField($field); return $form; } - /** - * Get the email settings form. - * @param array $values - * @return Form - */ protected function getEmailForm($values = array()) { $form = new Form(); @@ -307,7 +211,7 @@ class SettingsController extends Controller $field = new Form\Element\Text('smtp_address'); $field->setRequired(false); - $field->setLabel(Lang::get('smtp_server')); + $field->setLabel('SMTP Server'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $field->setValue('localhost'); @@ -316,7 +220,7 @@ class SettingsController extends Controller $field = new Form\Element\Text('smtp_port'); $field->setRequired(false); $field->setPattern('[0-9]+'); - $field->setLabel(Lang::get('smtp_port')); + $field->setLabel('SMTP Port'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $field->setValue(25); @@ -324,166 +228,85 @@ class SettingsController extends Controller $field = new Form\Element\Text('smtp_username'); $field->setRequired(false); - $field->setLabel(Lang::get('smtp_username')); + $field->setLabel('SMTP Username'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $form->addField($field); - $field = new Form\Element\Password('smtp_password'); + $field = new Form\Element\Text('smtp_password'); $field->setRequired(false); - $field->setLabel(Lang::get('smtp_password')); + $field->setLabel('SMTP Password'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $form->addField($field); $field = new Form\Element\Email('from_address'); $field->setRequired(false); - $field->setLabel(Lang::get('from_email_address')); + $field->setLabel('From Email Address'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $form->addField($field); $field = new Form\Element\Email('default_mailto_address'); $field->setRequired(false); - $field->setLabel(Lang::get('default_notification_address')); + $field->setLabel('Default Notification Address'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $form->addField($field); $field = new Form\Element\Select('smtp_encryption'); - $field->setOptions(array('' => Lang::get('none'), 'tls' => Lang::get('tls'), 'ssl' => Lang::get('ssl'))); + $field->setOptions(['' => 'None', 'tls' => 'TLS', 'ssl' => 'SSL']); $field->setRequired(false); - $field->setLabel(Lang::get('use_smtp_encryption')); + $field->setLabel('Use SMTP encryption?'); $field->setContainerClass('form-group'); $field->setValue(1); $form->addField($field); - $field = new Form\Element\Submit(); - $field->setValue(Lang::get('save')); - $field->setClass('btn btn-success pull-right'); - $form->addField($field); - - $form->setValues($values); - - return $form; - } - - /** - * Call Github API for our Github user object. - * @param $token - * @return mixed - */ - protected function getGithubUser($token) - { - $http = new HttpClient('https://api.github.com'); - $user = $http->get('/user', array('access_token' => $token)); - - return $user['body']; - } - - /** - * Check if we can write the PHPCI config file. - * @return bool - */ - protected function canWriteConfig() - { - return is_writeable(PHPCI_CONFIG_FILE); - } - - /** - * Get the Build settings form. - * @param array $values - * @return Form - */ - protected function getBuildForm($values = array()) - { - $form = new Form(); - $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'settings/build'); - - $field = new Form\Element\Select('failed_after'); - $field->setRequired(false); - $field->setLabel(Lang::get('failed_after')); - $field->setClass('form-control'); - $field->setContainerClass('form-group'); - $field->setOptions(array( - 300 => Lang::get('5_mins'), - 900 => Lang::get('15_mins'), - 1800 => Lang::get('30_mins'), - 3600 => Lang::get('1_hour'), - 10800 => Lang::get('3_hours'), - )); - $field->setValue(1800); - $form->addField($field); - - - $field = new Form\Element\Submit(); - $field->setValue(Lang::get('save')); - $field->setClass('btn btn-success pull-right'); - $form->addField($field); - - $form->setValues($values); - - return $form; - } - - /** - * Get the Basic settings form. - * @param array $values - * @return Form - */ - protected function getBasicForm($values = array()) - { - $form = new Form(); - $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'settings/basic'); - - $field = new Form\Element\Select('language'); - $field->setRequired(true); - $field->setLabel(Lang::get('language')); - $field->setClass('form-control'); - $field->setContainerClass('form-group'); - $field->setOptions(Lang::getLanguageOptions()); - $field->setValue(Lang::getLanguage()); - $form->addField($field); - - - $field = new Form\Element\Submit(); - $field->setValue(Lang::get('save')); - $field->setClass('btn btn-success pull-right'); - $form->addField($field); - - $form->setValues($values); - - 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(); - $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'); + $user = $http->get('/user', array('access_token' => $token)); + + return $user['body']; + } + + protected function canWriteConfig() + { + return is_writeable(APPLICATION_PATH . 'PHPCI/config.yml'); + } + + protected function getBuildForm($values = array()) + { + $form = new Form(); + $form->setMethod('POST'); + $form->setAction(PHPCI_URL . 'settings/build'); + + $field = new Form\Element\Select('failed_after'); + $field->setRequired(false); + $field->setLabel('Consider a build failed after'); + $field->setClass('form-control'); + $field->setContainerClass('form-group'); + $field->setOptions([ + 300 => '5 Minutes', + 900 => '15 Minutes', + 1800 => '30 Minutes', + 3600 => '1 Hour', + 10800 => '3 Hours', + ]); + $field->setValue(1800); + $form->addField($field); + + $field = new Form\Element\Submit(); $field->setValue('Save »'); $field->setClass('btn btn-success pull-right'); diff --git a/PHPCI/Controller/UserController.php b/PHPCI/Controller/UserController.php index 19a7313f..583381f6 100644 --- a/PHPCI/Controller/UserController.php +++ b/PHPCI/Controller/UserController.php @@ -10,10 +10,11 @@ namespace PHPCI\Controller; use b8; +use b8\Exception\HttpException\ForbiddenException; use b8\Exception\HttpException\NotFoundException; use b8\Form; use PHPCI\Controller; -use PHPCI\Helper\Lang; +use PHPCI\Model\User; use PHPCI\Service\UserService; /** @@ -34,9 +35,6 @@ class UserController extends Controller */ protected $userService; - /** - * Initialise the controller, set up stores and services. - */ public function init() { $this->userStore = b8\Store\Factory::getStore('User'); @@ -51,47 +49,30 @@ class UserController extends Controller $users = $this->userStore->getWhere(array(), 1000, 0, array(), array('email' => 'ASC')); $this->view->users = $users; - $this->layout->title = Lang::get('manage_users'); + $this->layout->title = 'Users'; return $this->view->render(); } - /** - * Allows the user to edit their profile. - * @return string - */ public function profile() { $user = $_SESSION['phpci_user']; + $this->layout->title = 'Edit Profile'; + if ($this->request->getMethod() == 'POST') { $name = $this->getParam('name', null); $email = $this->getParam('email', null); $password = $this->getParam('password', null); - $currentLang = Lang::getLanguage(); - $chosenLang = $this->getParam('language', $currentLang); - - if ($chosenLang !== $currentLang) { - setcookie('phpcilang', $chosenLang, time() + (10 * 365 * 24 * 60 * 60), '/'); - Lang::setLanguage($chosenLang); - } - $_SESSION['phpci_user'] = $this->userService->updateUser($user, $name, $email, $password); $user = $_SESSION['phpci_user']; $this->view->updated = 1; } - $this->layout->title = $user->getName(); - $this->layout->subtitle = Lang::get('edit_profile'); - $values = $user->getDataArray(); - if (array_key_exists('phpcilang', $_COOKIE)) { - $values['language'] = $_COOKIE['phpcilang']; - } - $form = new Form(); $form->setAction(PHPCI_URL.'user/profile'); $form->setMethod('POST'); @@ -99,36 +80,27 @@ class UserController extends Controller $name = new Form\Element\Text('name'); $name->setClass('form-control'); $name->setContainerClass('form-group'); - $name->setLabel(Lang::get('name')); + $name->setLabel('Name'); $name->setRequired(true); $form->addField($name); $email = new Form\Element\Email('email'); $email->setClass('form-control'); $email->setContainerClass('form-group'); - $email->setLabel(Lang::get('email_address')); + $email->setLabel('Email Address'); $email->setRequired(true); $form->addField($email); $password = new Form\Element\Password('password'); $password->setClass('form-control'); $password->setContainerClass('form-group'); - $password->setLabel(Lang::get('password_change')); + $password->setLabel('Password (leave blank if you don\'t want to change it)'); $password->setRequired(false); $form->addField($password); - $lang = new Form\Element\Select('language'); - $lang->setClass('form-control'); - $lang->setContainerClass('form-group'); - $lang->setLabel(Lang::get('language')); - $lang->setRequired(true); - $lang->setOptions(Lang::getLanguageOptions()); - $lang->setValue(Lang::getLanguage()); - $form->addField($lang); - $submit = new Form\Element\Submit(); $submit->setClass('btn btn-success'); - $submit->setValue(Lang::get('save')); + $submit->setValue('Save »'); $form->addField($submit); $form->setValues($values); @@ -145,7 +117,7 @@ class UserController extends Controller { $this->requireAdmin(); - $this->layout->title = Lang::get('add_user'); + $this->layout->title = 'Add User'; $method = $this->request->getMethod(); @@ -174,9 +146,8 @@ class UserController extends Controller $this->userService->createUser($name, $email, $password, $isAdmin); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'user'); - return $response; + header('Location: '.PHPCI_URL.'user'); + die; } /** @@ -190,11 +161,11 @@ class UserController extends Controller $user = $this->userStore->getById($userId); if (empty($user)) { - throw new NotFoundException(Lang::get('user_n_not_found', $userId)); + throw new NotFoundException('User with ID: ' . $userId . ' does not exist.'); } $this->layout->title = $user->getName(); - $this->layout->subtitle = Lang::get('edit_user'); + $this->layout->subtitle = 'Edit User'; $values = array_merge($user->getDataArray(), $this->getParams()); $form = $this->userForm($values, 'edit/' . $userId); @@ -215,9 +186,8 @@ class UserController extends Controller $this->userService->updateUser($user, $name, $email, $password, $isAdmin); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'user'); - return $response; + header('Location: '.PHPCI_URL.'user'); + die; } /** @@ -232,14 +202,14 @@ class UserController extends Controller $field = new Form\Element\Email('email'); $field->setRequired(true); - $field->setLabel(Lang::get('email_address')); + $field->setLabel('Email Address'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $form->addField($field); $field = new Form\Element\Text('name'); $field->setRequired(true); - $field->setLabel(Lang::get('name')); + $field->setLabel('Name'); $field->setClass('form-control'); $field->setContainerClass('form-group'); $form->addField($field); @@ -248,10 +218,10 @@ class UserController extends Controller if ($type == 'add') { $field->setRequired(true); - $field->setLabel(Lang::get('password')); + $field->setLabel('Password'); } else { $field->setRequired(false); - $field->setLabel(Lang::get('password_change')); + $field->setLabel('Password (leave blank to keep current password)'); } $field->setClass('form-control'); @@ -261,12 +231,12 @@ class UserController extends Controller $field = new Form\Element\Checkbox('is_admin'); $field->setRequired(false); $field->setCheckedValue(1); - $field->setLabel(Lang::get('is_user_admin')); + $field->setLabel('Is this user an administrator?'); $field->setContainerClass('form-group'); $form->addField($field); $field = new Form\Element\Submit(); - $field->setValue(Lang::get('save_user')); + $field->setValue('Save User'); $field->setClass('btn-success'); $form->addField($field); @@ -284,13 +254,12 @@ class UserController extends Controller $user = $this->userStore->getById($userId); if (empty($user)) { - throw new NotFoundException(Lang::get('user_n_not_found', $userId)); + throw new NotFoundException('User with ID: ' . $userId . ' does not exist.'); } $this->userService->deleteUser($user); - $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'user'); - return $response; + header('Location: '.PHPCI_URL.'user'); + die; } } diff --git a/PHPCI/Controller/WebhookController.php b/PHPCI/Controller/WebhookController.php index 4b444d03..4a89edd2 100644 --- a/PHPCI/Controller/WebhookController.php +++ b/PHPCI/Controller/WebhookController.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014-2015, Block 8 Limited. + * @copyright Copyright 2014, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -11,45 +11,35 @@ namespace PHPCI\Controller; use b8; use b8\Store; -use Exception; use PHPCI\BuildFactory; -use PHPCI\Model\Project; +use PHPCI\Model\Build; use PHPCI\Service\BuildService; -use PHPCI\Store\BuildStore; -use PHPCI\Store\ProjectStore; /** * Webhook Controller - Processes webhook pings from BitBucket, Github, Gitlab, etc. - * * @author Dan Cryer * @author Sami Tikka * @author Alex Russell - * @author Guillaume Perréal * @package PHPCI * @subpackage Web - * - * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ -class WebhookController extends \b8\Controller +class WebhookController extends \PHPCI\Controller { /** - * @var BuildStore + * @var \PHPCI\Store\BuildStore */ protected $buildStore; /** - * @var ProjectStore + * @var \PHPCI\Store\ProjectStore */ protected $projectStore; /** - * @var BuildService + * @var \PHPCI\Service\BuildService */ protected $buildService; - /** - * Initialise the controller, set up stores and services. - */ public function init() { $this->buildStore = Store\Factory::getStore('Build'); @@ -57,147 +47,86 @@ class WebhookController extends \b8\Controller $this->buildService = new BuildService($this->buildStore); } - /** Handle the action, Ensuring to return a JsonResponse. - * - * @param string $action - * @param mixed $actionParams - * - * @return \b8\Http\Response - */ - public function handleAction($action, $actionParams) - { - $response = new b8\Http\Response\JsonResponse(); - try { - $data = parent::handleAction($action, $actionParams); - if (isset($data['responseCode'])) { - $response->setResponseCode($data['responseCode']); - unset($data['responseCode']); - } - $response->setContent($data); - } catch (Exception $ex) { - $response->setResponseCode(500); - $response->setContent(array('status' => 'failed', 'error' => $ex->getMessage())); - } - return $response; - } - /** - * Called by Bitbucket. + * Called by Bitbucket POST service. */ - public function bitbucket($projectId) - { - $project = $this->fetchProject($projectId, 'bitbucket'); - - // Support both old services and new webhooks - if ($payload = $this->getParam('payload')) { - return $this->bitbucketService(json_decode($payload, true), $project); - } - - $payload = json_decode(file_get_contents("php://input"), true); - - if (empty($payload['push']['changes'])) { - // Invalid event from bitbucket - return [ - 'status' => 'failed', - 'commits' => [] - ]; - } - - return $this->bitbucketWebhook($payload, $project); - } - - /** - * Bitbucket webhooks. - */ - protected function bitbucketWebhook($payload, $project) - { - $results = array(); - $status = 'failed'; - foreach ($payload['push']['changes'] as $commit) { - try { - $email = $commit['new']['target']['author']['raw']; - $email = substr($email, 0, strpos($email, '>')); - $email = substr($email, strpos($email, '<') + 1); - - $results[$commit['new']['target']['hash']] = $this->createBuild( - $project, - $commit['new']['target']['hash'], - $commit['new']['name'], - $email, - $commit['new']['target']['message'] - ); - $status = 'ok'; - } catch (Exception $ex) { - $results[$commit['new']['target']['hash']] = array('status' => 'failed', 'error' => $ex->getMessage()); - } - } - - return array('status' => $status, 'commits' => $results); - } - - /** - * Bitbucket POST service. - */ - protected function bitbucketService($payload, $project) + public function bitbucket($project) { $payload = json_decode($this->getParam('payload'), true); - $results = array(); - $status = 'failed'; foreach ($payload['commits'] as $commit) { try { $email = $commit['raw_author']; $email = substr($email, 0, strpos($email, '>')); $email = substr($email, strpos($email, '<') + 1); - $results[$commit['raw_node']] = $this->createBuild( - $project, - $commit['raw_node'], - $commit['branch'], - $email, - $commit['message'] - ); - $status = 'ok'; - } catch (Exception $ex) { - $results[$commit['raw_node']] = array('status' => 'failed', 'error' => $ex->getMessage()); + $this->createBuild($project, $commit['raw_node'], $commit['branch'], $email, $commit['message']); + } catch (\Exception $ex) { + header('HTTP/1.1 500 Internal Server Error'); + header('Ex: ' . $ex->getMessage()); + die('FAIL'); } } - return array('status' => $status, 'commits' => $results); + die('OK'); } /** * Called by POSTing to /webhook/git/?branch=&commit= * - * @param string $projectId + * @param string $project */ - public function git($projectId) + public function git($project) { - $project = $this->fetchProject($projectId, array('local', 'remote')); - $branch = $this->getParam('branch', $project->getBranch()); + $branch = $this->getParam('branch'); $commit = $this->getParam('commit'); $commitMessage = $this->getParam('message'); $committer = $this->getParam('committer'); - return $this->createBuild($project, $commit, $branch, $committer, $commitMessage); + try { + if (empty($branch)) { + $branch = 'master'; + } + + if (empty($commit)) { + $commit = null; + } + + if (empty($commitMessage)) { + $commitMessage = null; + } + + if (empty($committer)) { + $committer = null; + } + + $this->createBuild($project, $commit, $branch, $committer, $commitMessage); + } catch (\Exception $ex) { + header('HTTP/1.1 400 Bad Request'); + header('Ex: ' . $ex->getMessage()); + die('FAIL'); + } + + die('OK'); } /** * Called by Github Webhooks: */ - public function github($projectId) + public function github($project) { - $project = $this->fetchProject($projectId, 'github'); - switch ($_SERVER['CONTENT_TYPE']) { case 'application/json': $payload = json_decode(file_get_contents('php://input'), true); break; + case 'application/x-www-form-urlencoded': $payload = json_decode($this->getParam('payload'), true); break; + default: - return array('status' => 'failed', 'error' => 'Content type not supported.', 'responseCode' => 401); + header('HTTP/1.1 400 Bad Request'); + die('Request content type not supported'); } // Handle Pull Request web hooks: @@ -210,244 +139,151 @@ class WebhookController extends \b8\Controller return $this->githubCommitRequest($project, $payload); } - return array('status' => 'ignored', 'message' => 'Unusable payload.'); + header('HTTP/1.1 200 OK'); + die('This request type is not supported, this is not an error.'); } - /** - * Handle the payload when Github sends a commit webhook. - * - * @param Project $project - * @param array $payload - * @param b8\Http\Response\JsonResponse $response - * - * @return b8\Http\Response\JsonResponse - */ - protected function githubCommitRequest(Project $project, array $payload) + protected function githubCommitRequest($project, array $payload) { // Github sends a payload when you close a pull request with a - // non-existent commit. We don't want this. + // non-existant commit. We don't want this. if (array_key_exists('after', $payload) && $payload['after'] === '0000000000000000000000000000000000000000') { - return array('status' => 'ignored'); + die('OK'); } - if (isset($payload['commits']) && is_array($payload['commits'])) { - // If we have a list of commits, then add them all as builds to be tested: + try { - $results = array(); - $status = 'failed'; - foreach ($payload['commits'] as $commit) { - if (!$commit['distinct']) { - $results[$commit['id']] = array('status' => 'ignored'); - continue; - } + if (isset($payload['commits']) && is_array($payload['commits'])) { + // If we have a list of commits, then add them all as builds to be tested: + + foreach ($payload['commits'] as $commit) { + if (!$commit['distinct']) { + continue; + } - try { $branch = str_replace('refs/heads/', '', $payload['ref']); $committer = $commit['committer']['email']; - $results[$commit['id']] = $this->createBuild( - $project, - $commit['id'], - $branch, - $committer, - $commit['message'] - ); - $status = 'ok'; - } catch (Exception $ex) { - $results[$commit['id']] = array('status' => 'failed', 'error' => $ex->getMessage()); + $this->createBuild($project, $commit['id'], $branch, $committer, $commit['message']); } + } elseif (substr($payload['ref'], 0, 10) == 'refs/tags/') { + // If we don't, but we're dealing with a tag, add that instead: + $branch = str_replace('refs/tags/', 'Tag: ', $payload['ref']); + $committer = $payload['pusher']['email']; + $message = $payload['head_commit']['message']; + $this->createBuild($project, $payload['after'], $branch, $committer, $message); } - return array('status' => $status, 'commits' => $results); + + } catch (\Exception $ex) { + header('HTTP/1.1 500 Internal Server Error'); + header('Ex: ' . $ex->getMessage()); + die('FAIL'); } - if (substr($payload['ref'], 0, 10) == 'refs/tags/') { - // If we don't, but we're dealing with a tag, add that instead: - $branch = str_replace('refs/tags/', 'Tag: ', $payload['ref']); - $committer = $payload['pusher']['email']; - $message = $payload['head_commit']['message']; - return $this->createBuild($project, $payload['after'], $branch, $committer, $message); - } - - return array('status' => 'ignored', 'message' => 'Unusable payload.'); + die('OK'); } - /** - * Handle the payload when Github sends a Pull Request webhook. - * - * @param Project $project - * @param array $payload - */ - protected function githubPullRequest(Project $project, array $payload) + protected function githubPullRequest($projectId, array $payload) { // We only want to know about open pull requests: if (!in_array($payload['action'], array('opened', 'synchronize', 'reopened'))) { - return array('status' => 'ok'); + die('OK'); } - $headers = array(); - $token = \b8\Config::getInstance()->get('phpci.github.token'); + try { + $headers = array(); + $token = \b8\Config::getInstance()->get('phpci.github.token'); - if (!empty($token)) { - $headers[] = 'Authorization: token ' . $token; - } - - $url = $payload['pull_request']['commits_url']; - $http = new \b8\HttpClient(); - $http->setHeaders($headers); - $response = $http->get($url); - - // Check we got a success response: - if (!$response['success']) { - throw new Exception('Could not get commits, failed API request.'); - } - - $results = array(); - $status = 'failed'; - foreach ($response['body'] as $commit) { - // Skip all but the current HEAD commit ID: - $id = $commit['sha']; - if ($id != $payload['pull_request']['head']['sha']) { - $results[$id] = array('status' => 'ignored', 'message' => 'not branch head'); - continue; + if (!empty($token)) { + $headers[] = 'Authorization: token ' . $token; } - try { + $url = $payload['pull_request']['commits_url']; + $http = new \b8\HttpClient(); + $http->setHeaders($headers); + $response = $http->get($url); + + // Check we got a success response: + if (!$response['success']) { + header('HTTP/1.1 500 Internal Server Error'); + header('Ex: Could not get commits, failed API request.'); + die('FAIL'); + } + + foreach ($response['body'] as $commit) { $branch = str_replace('refs/heads/', '', $payload['pull_request']['base']['ref']); $committer = $commit['commit']['author']['email']; $message = $commit['commit']['message']; - $remoteUrlKey = $payload['pull_request']['head']['repo']['private'] ? 'ssh_url' : 'clone_url'; - $extra = array( 'build_type' => 'pull_request', 'pull_request_id' => $payload['pull_request']['id'], 'pull_request_number' => $payload['number'], 'remote_branch' => $payload['pull_request']['head']['ref'], - 'remote_url' => $payload['pull_request']['head']['repo'][$remoteUrlKey], + 'remote_url' => $payload['pull_request']['head']['repo']['clone_url'], ); - $results[$id] = $this->createBuild($project, $id, $branch, $committer, $message, $extra); - $status = 'ok'; - } catch (Exception $ex) { - $results[$id] = array('status' => 'failed', 'error' => $ex->getMessage()); + $this->createBuild($projectId, $commit['sha'], $branch, $committer, $message, $extra); } + } catch (\Exception $ex) { + header('HTTP/1.1 500 Internal Server Error'); + header('Ex: ' . $ex->getMessage()); + die('FAIL'); } - return array('status' => $status, 'commits' => $results); + die('OK'); } /** * Called by Gitlab Webhooks: */ - public function gitlab($projectId) + public function gitlab($project) { - $project = $this->fetchProject($projectId, 'gitlab'); - $payloadString = file_get_contents("php://input"); $payload = json_decode($payloadString, true); - // 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']; + try { - return $this->createBuild($project, $commit['id'], $branch, $committer, $commit['message']); - } - } + if (isset($payload['commits']) && is_array($payload['commits'])) { + // If we have a list of commits, then add them all as builds to be tested: - // 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: - - $results = array(); - $status = 'failed'; - foreach ($payload['commits'] as $commit) { - try { + foreach ($payload['commits'] as $commit) { $branch = str_replace('refs/heads/', '', $payload['ref']); $committer = $commit['author']['email']; - $results[$commit['id']] = $this->createBuild( - $project, - $commit['id'], - $branch, - $committer, - $commit['message'] - ); - $status = 'ok'; - } catch (Exception $ex) { - $results[$commit['id']] = array('status' => 'failed', 'error' => $ex->getMessage()); + $this->createBuild($project, $commit['id'], $branch, $committer, $commit['message']); } } - return array('status' => $status, 'commits' => $results); + + } catch (\Exception $ex) { + header('HTTP/1.1 500 Internal Server Error'); + header('Ex: ' . $ex->getMessage()); + die('FAIL'); } - return array('status' => 'ignored', 'message' => 'Unusable payload.'); + die('OK'); } - /** - * Wrapper for creating a new build. - * - * @param Project $project - * @param string $commitId - * @param string $branch - * @param string $committer - * @param string $commitMessage - * @param array $extra - * - * @return array - * - * @throws Exception - */ - protected function createBuild( - Project $project, - $commitId, - $branch, - $committer, - $commitMessage, - array $extra = null - ) { + protected function createBuild($projectId, $commitId, $branch, $committer, $commitMessage, $extra = null) + { // Check if a build already exists for this commit ID: - $builds = $this->buildStore->getByProjectAndCommit($project->getId(), $commitId); + $builds = $this->buildStore->getByProjectAndCommit($projectId, $commitId); if ($builds['count']) { - return array( - 'status' => 'ignored', - 'message' => sprintf('Duplicate of build #%d', $builds['items'][0]->getId()) - ); + return true; + } + + $project = $this->projectStore->getById($projectId); + + if (empty($project)) { + throw new \Exception('Project does not exist:' . $projectId); } // If not, create a new build job for it: $build = $this->buildService->createBuild($project, $commitId, $branch, $committer, $commitMessage, $extra); + $build = BuildFactory::getBuild($build); - return array('status' => 'ok', 'buildID' => $build->getID()); - } + // Send a status postback if the build type provides one: + $build->sendStatusPostback(); - /** - * Fetch a project and check its type. - * - * @param int $projectId - * @param array|string $expectedType - * - * @return Project - * - * @throws Exception If the project does not exist or is not of the expected type. - */ - protected function fetchProject($projectId, $expectedType) - { - $project = $this->projectStore->getById($projectId); - - if (empty($projectId)) { - throw new Exception('Project does not exist: ' . $projectId); - } - - if (is_array($expectedType) - ? !in_array($project->getType(), $expectedType) - : $project->getType() !== $expectedType - ) { - throw new Exception('Wrong project type: ' . $project->getType()); - } - - return $project; + return true; } } diff --git a/PHPCI/ErrorHandler.php b/PHPCI/ErrorHandler.php deleted file mode 100644 index d268965d..00000000 --- a/PHPCI/ErrorHandler.php +++ /dev/null @@ -1,68 +0,0 @@ - 'Warning', - E_NOTICE => 'Notice', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice', - E_RECOVERABLE_ERROR => 'Catchable Fatal Error', - E_DEPRECATED => 'Deprecated', - E_USER_DEPRECATED => 'User Deprecated', - ); - - /** - * Registers an instance of the error handler to throw ErrorException. - */ - public static function register() - { - $handler = new static(); - set_error_handler(array($handler, 'handleError')); - } - - /** - * @param integer $level - * @param string $message - * @param string $file - * @param integer $line - * - * @throws \ErrorException - * - * @internal - */ - public function handleError($level, $message, $file, $line) - { - if (error_reporting() & $level === 0) { - return; - } - - $exceptionLevel = isset($this->levels[$level]) ? $this->levels[$level] : $level; - throw new \ErrorException( - sprintf('%s: %s in %s line %d', $exceptionLevel, $message, $file, $line), - 0, - $level, - $file, - $line - ); - } -} diff --git a/PHPCI/Helper/AnsiConverter.php b/PHPCI/Helper/AnsiConverter.php deleted file mode 100644 index 7df6663c..00000000 --- a/PHPCI/Helper/AnsiConverter.php +++ /dev/null @@ -1,55 +0,0 @@ -convert($text); - } - - /** - * Do not instantiate this class. - */ - private function __construct() - { - } -} diff --git a/PHPCI/Helper/BaseCommandExecutor.php b/PHPCI/Helper/BaseCommandExecutor.php index b3b47f7b..b1cdbc26 100644 --- a/PHPCI/Helper/BaseCommandExecutor.php +++ b/PHPCI/Helper/BaseCommandExecutor.php @@ -9,18 +9,13 @@ namespace PHPCI\Helper; -use Exception; -use PHPCI\Logging\BuildLogger; +use \PHPCI\Logging\BuildLogger; use Psr\Log\LogLevel; -/** - * Handles running system commands with variables. - * @package PHPCI\Helper - */ abstract class BaseCommandExecutor implements CommandExecutor { /** - * @var BuildLogger + * @var \PHPCI\Logging\BuildLogger */ protected $logger; @@ -62,7 +57,9 @@ abstract class BaseCommandExecutor implements CommandExecutor $this->logger = $logger; $this->quiet = $quiet; $this->verbose = $verbose; + $this->lastOutput = array(); + $this->rootDir = $rootDir; } @@ -76,7 +73,6 @@ abstract class BaseCommandExecutor implements CommandExecutor $this->lastOutput = array(); $command = call_user_func_array('sprintf', $args); - $this->logger->logDebug($command); if ($this->quiet) { $this->logger->log('Executing: ' . $command); @@ -90,7 +86,8 @@ abstract class BaseCommandExecutor implements CommandExecutor ); $pipes = array(); - $process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null); + + $process = proc_open($command, $descriptorSpec, $pipes, dirname($this->buildPath), null); if (is_resource($process)) { fclose($pipes[0]); @@ -144,46 +141,47 @@ abstract class BaseCommandExecutor implements CommandExecutor /** * Find a binary required by a plugin. * @param string $binary - * @param bool $quiet + * @param null $buildPath * @return null|string */ - public function findBinary($binary, $quiet = false) + public function findBinary($binary, $buildPath = null) { - $composerBin = $this->getComposerBinDir(realpath($this->buildPath)); + $binaryPath = null; + $composerBin = $this->getComposerBinDir(realpath($buildPath)); if (is_string($binary)) { $binary = array($binary); } foreach ($binary as $bin) { - $this->logger->log(Lang::get('looking_for_binary', $bin), LogLevel::DEBUG); + $this->logger->log("Looking for binary: " . $bin, LogLevel::DEBUG); if (is_dir($composerBin) && is_file($composerBin.'/'.$bin)) { - $this->logger->log(Lang::get('found_in_path', $composerBin, $bin), LogLevel::DEBUG); - return $composerBin . '/' . $bin; + $this->logger->log("Found in ".$composerBin.": " . $bin, LogLevel::DEBUG); + $binaryPath = $composerBin . '/' . $bin; + break; } if (is_file($this->rootDir . $bin)) { - $this->logger->log(Lang::get('found_in_path', 'root', $bin), LogLevel::DEBUG); - return $this->rootDir . $bin; + $this->logger->log("Found in root: " . $bin, LogLevel::DEBUG); + $binaryPath = $this->rootDir . $bin; + break; } if (is_file($this->rootDir . 'vendor/bin/' . $bin)) { - $this->logger->log(Lang::get('found_in_path', 'vendor/bin', $bin), LogLevel::DEBUG); - return $this->rootDir . 'vendor/bin/' . $bin; + $this->logger->log("Found in vendor/bin: " . $bin, LogLevel::DEBUG); + $binaryPath = $this->rootDir . 'vendor/bin/' . $bin; + break; } $findCmdResult = $this->findGlobalBinary($bin); if (is_file($findCmdResult)) { - $this->logger->log(Lang::get('found_in_path', '', $bin), LogLevel::DEBUG); - return $findCmdResult; + $this->logger->log("Found in " . $findCmdResult, LogLevel::DEBUG); + $binaryPath = $findCmdResult; + break; } } - - if ($quiet) { - return; - } - throw new Exception(Lang::get('could_not_find', implode('/', $binary))); + return $binaryPath; } /** @@ -215,13 +213,4 @@ abstract class BaseCommandExecutor implements CommandExecutor } return null; } - - /** - * Set the buildPath property. - * @param string $path - */ - public function setBuildPath($path) - { - $this->buildPath = $path; - } } diff --git a/PHPCI/Helper/Build.php b/PHPCI/Helper/Build.php index 65231b4a..7e3d28d3 100644 --- a/PHPCI/Helper/Build.php +++ b/PHPCI/Helper/Build.php @@ -17,11 +17,6 @@ namespace PHPCI\Helper; */ class Build { - /** - * Returns a more human-friendly version of a plugin name. - * @param $name - * @return mixed - */ public function formatPluginName($name) { return str_replace('Php', 'PHP', ucwords(str_replace('_', ' ', $name))); diff --git a/PHPCI/Helper/BuildInterpolator.php b/PHPCI/Helper/BuildInterpolator.php index 1e7222bb..216194ce 100644 --- a/PHPCI/Helper/BuildInterpolator.php +++ b/PHPCI/Helper/BuildInterpolator.php @@ -11,10 +11,6 @@ namespace PHPCI\Helper; use PHPCI\Model\Build; -/** - * The BuildInterpolator class replaces variables in a string with build-specific information. - * @package PHPCI\Helper - */ class BuildInterpolator { /** @@ -36,36 +32,21 @@ class BuildInterpolator $this->interpolation_vars = array(); $this->interpolation_vars['%PHPCI%'] = 1; $this->interpolation_vars['%COMMIT%'] = $build->getCommitId(); - $this->interpolation_vars['%SHORT_COMMIT%'] = substr($build->getCommitId(), 0, 7); - $this->interpolation_vars['%COMMIT_EMAIL%'] = $build->getCommitterEmail(); - $this->interpolation_vars['%COMMIT_MESSAGE%'] = $build->getCommitMessage(); - $this->interpolation_vars['%COMMIT_URI%'] = $build->getCommitLink(); $this->interpolation_vars['%BRANCH%'] = $build->getBranch(); - $this->interpolation_vars['%BRANCH_URI%'] = $build->getBranchLink(); $this->interpolation_vars['%PROJECT%'] = $build->getProjectId(); $this->interpolation_vars['%BUILD%'] = $build->getId(); $this->interpolation_vars['%PROJECT_TITLE%'] = $build->getProjectTitle(); - $this->interpolation_vars['%PROJECT_URI%'] = $phpCiUrl . "project/view/" . $build->getProjectId(); $this->interpolation_vars['%BUILD_PATH%'] = $buildPath; $this->interpolation_vars['%BUILD_URI%'] = $phpCiUrl . "build/view/" . $build->getId(); $this->interpolation_vars['%PHPCI_COMMIT%'] = $this->interpolation_vars['%COMMIT%']; - $this->interpolation_vars['%PHPCI_SHORT_COMMIT%'] = $this->interpolation_vars['%SHORT_COMMIT%']; - $this->interpolation_vars['%PHPCI_COMMIT_MESSAGE%'] = $this->interpolation_vars['%COMMIT_MESSAGE%']; - $this->interpolation_vars['%PHPCI_COMMIT_EMAIL%'] = $this->interpolation_vars['%COMMIT_EMAIL%']; - $this->interpolation_vars['%PHPCI_COMMIT_URI%'] = $this->interpolation_vars['%COMMIT_URI%']; $this->interpolation_vars['%PHPCI_PROJECT%'] = $this->interpolation_vars['%PROJECT%']; $this->interpolation_vars['%PHPCI_BUILD%'] = $this->interpolation_vars['%BUILD%']; $this->interpolation_vars['%PHPCI_PROJECT_TITLE%'] = $this->interpolation_vars['%PROJECT_TITLE%']; - $this->interpolation_vars['%PHPCI_PROJECT_URI%'] = $this->interpolation_vars['%PROJECT_URI%']; $this->interpolation_vars['%PHPCI_BUILD_PATH%'] = $this->interpolation_vars['%BUILD_PATH%']; $this->interpolation_vars['%PHPCI_BUILD_URI%'] = $this->interpolation_vars['%BUILD_URI%']; putenv('PHPCI=1'); putenv('PHPCI_COMMIT=' . $this->interpolation_vars['%COMMIT%']); - putenv('PHPCI_SHORT_COMMIT=' . $this->interpolation_vars['%SHORT_COMMIT%']); - putenv('PHPCI_COMMIT_MESSAGE=' . $this->interpolation_vars['%COMMIT_MESSAGE%']); - putenv('PHPCI_COMMIT_EMAIL=' . $this->interpolation_vars['%COMMIT_EMAIL%']); - putenv('PHPCI_COMMIT_URI=' . $this->interpolation_vars['%COMMIT_URI%']); putenv('PHPCI_PROJECT=' . $this->interpolation_vars['%PROJECT%']); putenv('PHPCI_BUILD=' . $this->interpolation_vars['%BUILD%']); putenv('PHPCI_PROJECT_TITLE=' . $this->interpolation_vars['%PROJECT_TITLE%']); diff --git a/PHPCI/Helper/CommandExecutor.php b/PHPCI/Helper/CommandExecutor.php index 4f0028eb..d83f0c6b 100644 --- a/PHPCI/Helper/CommandExecutor.php +++ b/PHPCI/Helper/CommandExecutor.php @@ -26,17 +26,8 @@ interface CommandExecutor /** * Find a binary required by a plugin. * @param string $binary - * @param bool $quiet Returns null instead of throwing an execption. - * + * @param string $buildPath the current build path * @return null|string - * - * @throws \Exception when no binary has been found and $quiet is false. */ - public function findBinary($binary, $quiet = false); - - /** - * Set the buildPath property. - * @param string $path - */ - public function setBuildPath($path); + public function findBinary($binary, $buildPath = null); } diff --git a/PHPCI/Helper/Diff.php b/PHPCI/Helper/Diff.php deleted file mode 100644 index 5dcb5388..00000000 --- a/PHPCI/Helper/Diff.php +++ /dev/null @@ -1,62 +0,0 @@ -'; @@ -27,20 +23,11 @@ class Email protected $isHtml = false; protected $config; - /** - * Create a new email object. - */ public function __construct() { $this->config = Config::getInstance(); } - /** - * Set the email's To: header. - * @param string $email - * @param string|null $name - * @return $this - */ public function setEmailTo($email, $name = null) { $this->emailTo[$email] = $name; @@ -48,12 +35,6 @@ class Email return $this; } - /** - * Add an address to the email's CC header. - * @param string $email - * @param string|null $name - * @return $this - */ public function addCc($email, $name = null) { $this->emailCc[$email] = $name; @@ -61,11 +42,6 @@ class Email return $this; } - /** - * Set the email subject. - * @param string $subject - * @return $this - */ public function setSubject($subject) { $this->subject = $subject; @@ -73,11 +49,6 @@ class Email return $this; } - /** - * Set the email body. - * @param string $body - * @return $this - */ public function setBody($body) { $this->body = $body; @@ -85,22 +56,13 @@ class Email return $this; } - /** - * Set whether or not the email body is HTML. - * @param bool $isHtml - * @return $this - */ - public function setHtml($isHtml = false) + public function setIsHtml($isHtml = false) { $this->isHtml = $isHtml; return $this; } - /** - * Send the email. - * @return bool|int - */ public function send() { $smtpServer = $this->config->get('phpci.email_settings.smtp_address'); @@ -112,10 +74,6 @@ class Email } } - /** - * Sends the email via the built in PHP mail() function. - * @return bool - */ protected function sendViaMail() { $headers = ''; @@ -142,10 +100,6 @@ class Email return mail($emailTo, $this->subject, $this->body, $headers); } - /** - * Sends the email using SwiftMailer. - * @return int - */ protected function sendViaSwiftMailer() { $factory = new MailerFactory($this->config->get('phpci')); @@ -167,10 +121,6 @@ class Email return $mailer->send($message); } - /** - * Get the from address to use for the email. - * @return mixed|string - */ protected function getFrom() { $email = $this->config->get('phpci.email_settings.from_address', self::DEFAULT_FROM); diff --git a/PHPCI/Helper/Github.php b/PHPCI/Helper/Github.php index 67173eb4..6060f2fe 100644 --- a/PHPCI/Helper/Github.php +++ b/PHPCI/Helper/Github.php @@ -13,18 +13,8 @@ use b8\Cache; use b8\Config; use b8\HttpClient; -/** - * The Github Helper class provides some Github API call functionality. - * @package PHPCI\Helper - */ class Github { - /** - * Make a request to the Github API. - * @param $url - * @param $params - * @return mixed - */ public function makeRequest($url, $params) { $http = new HttpClient('https://api.github.com'); @@ -48,18 +38,24 @@ class Github $res = $http->get($url, $params); foreach ($res['body'] as $item) { + $results[] = $item; + } foreach ($res['headers'] as $header) { + if (preg_match('/^Link: <([^>]+)>; rel="next"/', $header, $r)) { + $host = parse_url($r[1]); parse_str($host['query'], $params); $results = $this->makeRecursiveRequest($host['path'], $params, $results); break; + } + } return $results; @@ -73,7 +69,7 @@ class Github $token = Config::getInstance()->get('phpci.github.token'); if (!$token) { - return null; + die(json_encode(null)); } $cache = Cache::getCache(Cache::TYPE_APC); @@ -102,74 +98,4 @@ class Github return $rtn; } - - /** - * Create a comment on a specific file (and commit) in a Github Pull Request. - * @param $repo - * @param $pullId - * @param $commitId - * @param $file - * @param $line - * @param $comment - * @return null - */ - public function createPullRequestComment($repo, $pullId, $commitId, $file, $line, $comment) - { - $token = Config::getInstance()->get('phpci.github.token'); - - if (!$token) { - return null; - } - - $url = '/repos/' . strtolower($repo) . '/pulls/' . $pullId . '/comments'; - - $params = array( - 'body' => $comment, - 'commit_id' => $commitId, - 'path' => $file, - 'position' => $line, - ); - - $http = new HttpClient('https://api.github.com'); - $http->setHeaders(array( - 'Content-Type: application/x-www-form-urlencoded', - 'Authorization: Basic ' . base64_encode($token . ':x-oauth-basic'), - )); - - $http->post($url, json_encode($params)); - } - - /** - * Create a comment on a Github commit. - * @param $repo - * @param $commitId - * @param $file - * @param $line - * @param $comment - * @return null - */ - public function createCommitComment($repo, $commitId, $file, $line, $comment) - { - $token = Config::getInstance()->get('phpci.github.token'); - - if (!$token) { - return null; - } - - $url = '/repos/' . strtolower($repo) . '/commits/' . $commitId . '/comments'; - - $params = array( - 'body' => $comment, - 'path' => $file, - 'position' => $line, - ); - - $http = new HttpClient('https://api.github.com'); - $http->setHeaders(array( - 'Content-Type: application/x-www-form-urlencoded', - 'Authorization: Basic ' . base64_encode($token . ':x-oauth-basic'), - )); - - $http->post($url, json_encode($params)); - } } diff --git a/PHPCI/Helper/Lang.php b/PHPCI/Helper/Lang.php deleted file mode 100644 index 42027cee..00000000 --- a/PHPCI/Helper/Lang.php +++ /dev/null @@ -1,200 +0,0 @@ -get('phpci.basic.language', null); - if (self::setLanguage($language)) { - return; - } - - // Fall back to English: - self::$language = 'en'; - self::$strings = self::loadLanguage(); - } - - /** - * Load a specific language file. - * - * @return string[]|null - */ - protected static function loadLanguage() - { - $langFile = PHPCI_DIR . 'PHPCI/Languages/lang.' . self::$language . '.php'; - - if (!file_exists($langFile)) { - return null; - } - - require($langFile); - - if (is_null($strings) || !is_array($strings) || !count($strings)) { - return null; - } - - return $strings; - } - - /** - * Load the names of all available languages. - */ - protected static function loadAvailableLanguages() - { - $matches = array(); - foreach (glob(PHPCI_DIR . 'PHPCI/Languages/lang.*.php') as $file) { - if (preg_match('/lang\.([a-z]{2}\-?[a-z]*)\.php/', $file, $matches)) { - self::$languages[] = $matches[1]; - } - } - } - - /** - * Create a time tag for localization. - * - * See http://momentjs.com/docs/#/displaying/format/ for a list of supported formats. - * - * @param \DateTime $dateTime The dateTime to represent. - * @param string $format The moment.js format to use. - * - * @return string The formatted tag. - */ - public static function formatDateTime(\DateTime $dateTime, $format = 'lll') - { - return sprintf( - '', - $dateTime->format(\DateTime::ISO8601), - $format, - $dateTime->format(\DateTime::RFC2822) - ); - } -} diff --git a/PHPCI/Helper/LoginIsDisabled.php b/PHPCI/Helper/LoginIsDisabled.php deleted file mode 100644 index ec23858c..00000000 --- a/PHPCI/Helper/LoginIsDisabled.php +++ /dev/null @@ -1,37 +0,0 @@ - -* @package PHPCI -* @subpackage Web -*/ -class LoginIsDisabled -{ - /** - * Checks if - * @param $method - * @param array $params - * @return mixed|null - */ - public function __call($method, $params = array()) - { - unset($method, $params); - - $config = Config::getInstance(); - $state = (bool) $config->get('phpci.authentication_settings.state', false); - - return (false !== $state); - } -} diff --git a/PHPCI/Helper/MailerFactory.php b/PHPCI/Helper/MailerFactory.php index c84c068d..4eb57c13 100644 --- a/PHPCI/Helper/MailerFactory.php +++ b/PHPCI/Helper/MailerFactory.php @@ -9,10 +9,7 @@ namespace PHPCI\Helper; -/** - * Class MailerFactory helps to set up and configure a SwiftMailer object. - * @package PHPCI\Helper - */ + class MailerFactory { /** @@ -20,16 +17,8 @@ class MailerFactory */ protected $emailConfig; - /** - * Set the mailer factory configuration. - * @param array $config - */ - public function __construct($config = array()) + public function __construct($config = null) { - if (!is_array($config)) { - $config = array(); - } - $this->emailConfig = isset($config['email_settings']) ? $config['email_settings'] : array(); } @@ -59,11 +48,6 @@ class MailerFactory return \Swift_Mailer::newInstance($transport); } - /** - * Return a specific configuration value by key. - * @param $configName - * @return null|string - */ public function getMailConfig($configName) { if (isset($this->emailConfig[$configName]) && $this->emailConfig[$configName] != "") { @@ -71,7 +55,7 @@ class MailerFactory } else { // Check defaults - switch ($configName) { + switch($configName) { case 'smtp_address': return "localhost"; case 'default_mailto_address': diff --git a/PHPCI/Helper/SshKey.php b/PHPCI/Helper/SshKey.php index 932686f2..f36940ca 100644 --- a/PHPCI/Helper/SshKey.php +++ b/PHPCI/Helper/SshKey.php @@ -9,16 +9,8 @@ namespace PHPCI\Helper; -/** - * Helper class for dealing with SSH keys. - * @package PHPCI\Helper - */ class SshKey { - /** - * Uses ssh-keygen to generate a public/private key pair. - * @return array - */ public function generate() { $tempPath = sys_get_temp_dir() . '/'; @@ -39,9 +31,9 @@ class SshKey $return = array('private_key' => '', 'public_key' => ''); - $output = @shell_exec('ssh-keygen -t rsa -b 2048 -f '.$keyFile.' -N "" -C "deploy@phpci"'); + if ($this->canGenerateKeys()) { + shell_exec('ssh-keygen -q -t rsa -b 2048 -f '.$keyFile.' -N "" -C "deploy@phpci"'); - if (!empty($output)) { $pub = file_get_contents($keyFile . '.pub'); $prv = file_get_contents($keyFile); @@ -56,4 +48,12 @@ class SshKey return $return; } + + public function canGenerateKeys() + { + $keygen = @shell_exec('ssh-keygen -h'); + $canGenerateKeys = !empty($keygen); + + return $canGenerateKeys; + } } diff --git a/PHPCI/Helper/UnixCommandExecutor.php b/PHPCI/Helper/UnixCommandExecutor.php index b922caff..4706c934 100644 --- a/PHPCI/Helper/UnixCommandExecutor.php +++ b/PHPCI/Helper/UnixCommandExecutor.php @@ -9,17 +9,8 @@ namespace PHPCI\Helper; -/** - * Unix/Linux specific extension of the CommandExecutor class. - * @package PHPCI\Helper - */ class UnixCommandExecutor extends BaseCommandExecutor { - /** - * Uses 'which' to find a system binary by name. - * @param string $binary - * @return null|string - */ protected function findGlobalBinary($binary) { return trim(shell_exec('which ' . $binary)); diff --git a/PHPCI/Helper/User.php b/PHPCI/Helper/User.php index 5d88d392..51f3de42 100644 --- a/PHPCI/Helper/User.php +++ b/PHPCI/Helper/User.php @@ -17,12 +17,6 @@ namespace PHPCI\Helper; */ class User { - /** - * Proxies method calls through to the current active user model. - * @param $method - * @param array $params - * @return mixed|null - */ public function __call($method, $params = array()) { $user = $_SESSION['phpci_user']; diff --git a/PHPCI/Helper/WindowsCommandExecutor.php b/PHPCI/Helper/WindowsCommandExecutor.php index a1d0889f..5cae3041 100644 --- a/PHPCI/Helper/WindowsCommandExecutor.php +++ b/PHPCI/Helper/WindowsCommandExecutor.php @@ -9,22 +9,10 @@ namespace PHPCI\Helper; -/** - * Windows-specific extension of the CommandExecutor class. - * @package PHPCI\Helper - */ class WindowsCommandExecutor extends BaseCommandExecutor { - /** - * Use 'where' on Windows to find a binary, rather than 'which' - * @param string $binary - * @return null|string - */ protected function findGlobalBinary($binary) { - $command = sprintf('where %s', $binary); - $result = shell_exec($command); - - return trim($result); + return trim(shell_exec('where ' . $binary)); } } diff --git a/PHPCI/Languages/lang.da.php b/PHPCI/Languages/lang.da.php deleted file mode 100644 index d7a0df59..00000000 --- a/PHPCI/Languages/lang.da.php +++ /dev/null @@ -1,397 +0,0 @@ - 'Dansk', - 'language' => 'Sprog', - - // Log in: - 'log_in_to_phpci' => 'Log ind i PHPCI', - 'login_error' => 'Forkert email-adresse eller adgangskode', - 'forgotten_password_link' => 'Har du glemt din adgangskode?', - 'reset_emailed' => 'Vi har sendt dig en email med et link til at nulstille din adgangskode.', - 'reset_header' => 'Bare rolig!
Indtast blot din email-adresse, så sender -vi dig et link til at nulstille din adgangskode.', - 'reset_email_address' => 'Indtast din email-adresse:', - 'reset_send_email' => 'Send nulstillings-link', - 'reset_enter_password' => 'Indtast venligst en ny adgangskode', - 'reset_new_password' => 'Ny adgangskode:', - 'reset_change_password' => 'Skift adgangskode', - 'reset_no_user_exists' => 'Der findes ingen bruger med den email-adresse, prøv igen.', - 'reset_email_body' => 'Hej %s, - -Du modtager denne email fordi du eller en anden person har anmodet om at nulstille din adgangskode til PHPCI. - -Hvis det var dig kan du klikke følgende link for at nulstille din adgangskode: %ssession/reset-password/%d/%s - -Hvis det ikke var dig kan du ignorere denne email og intet vil ske. - -Tak, - -PHPCI', - - 'reset_email_title' => 'PHPCI Adgangskode-nulstilling for %s', - 'reset_invalid' => 'Ugyldig anmodning om adgangskode-nulstilling.', - 'email_address' => 'Email-addresse', - 'login' => 'Login / Email Address', - 'password' => 'Adgangskode', - 'log_in' => 'Log ind', - - - // Top Nav - 'toggle_navigation' => 'Vis/skjul navigation', - 'n_builds_pending' => '%d builds i køen', - 'n_builds_running' => '%d builds kører', - 'edit_profile' => 'Redigér profil', - 'sign_out' => 'Log ud', - 'branch_x' => 'Branch: %s', - 'created_x' => 'Oprettet: %s', - 'started_x' => 'Startet: %s', - - // Sidebar - 'hello_name' => 'Hej %s', - 'dashboard' => 'Dashboard', - 'admin_options' => 'Administrator-indstillinger', - 'add_project' => 'Tilføj projekt', - 'settings' => 'Indstillinger', - 'manage_users' => 'Administrér brugere', - 'plugins' => 'Plugins', - 'view' => 'Vis', - 'build_now' => 'Start build nu', - 'edit_project' => 'Redigér projekt', - 'delete_project' => 'Slet projekt', - - // Project Summary: - 'no_builds_yet' => 'Ingen builds pt.!', - 'x_of_x_failed' => '%d af de sidste %d builds fejlede.', - 'x_of_x_failed_short' => '%d / %d fejlede.', - 'last_successful_build' => 'Sidste succesfulde build var %s.', - 'never_built_successfully' => 'Dette projekt har indtil videre ingen succesfulde builds.', - 'all_builds_passed' => 'All de sidste %d builds fejlede.', - 'all_builds_passed_short' => '%d / %d lykkedes.', - 'last_failed_build' => 'Det sidste mislykkede build var %s', - 'never_failed_build' => 'Dette projekt er endnu ikke blevet kørt.', - 'view_project' => 'Vis Projekt', - - // Timeline: - 'latest_builds' => 'Nyeste Builds', - 'pending' => 'Venter', - 'running' => 'Kører', - 'success' => 'Succes', - 'successful' => 'Lykkedes', - 'failed' => 'Fejlede', - 'manual_build' => 'Manuelt Build', - - // Add/Edit Project: - 'new_project' => 'Nyt Projekt', - 'project_x_not_found' => 'Projektet med ID %d findes ikke.', - 'project_details' => 'Projekt-detaljer', - 'public_key_help' => 'For at gøre det lettere at starte har vi genereret en SSH-nøgle som du kan bruge til dette projekt. For at bruge den behøver du blot tilføje den følgende public key til "deployment keys" sektionen -i din foretrukne hosting-platform.', - 'select_repository_type' => 'Vælg repository-type...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'Ekstern URL', - 'local' => 'Lokalt filsystem', - 'hg' => 'Mercurial', - - 'where_hosted' => 'Hvor er dit projekt hosted?', - 'choose_github' => 'Vælg et GitHub-repository:', - - 'repo_name' => 'Repository-navn / URL (ekstern) eller filsystem-sti (lokal)', - 'project_title' => 'Projekt-titel', - 'project_private_key' => 'Privat nøgle med adgang til dette repository -(tom for lokal nøgle og/eller anonym adgang)', - 'build_config' => 'PHPCI build-konfiguration for dette projekt -(hvis du ikke har mulighed for at tilføje en phpci.yml fil i projektets repository)', - 'default_branch' => 'Default branch navn', - 'allow_public_status' => 'Tillad offentlig status-side og -billede for dette projekt?', - 'archived' => 'Archived', - 'archived_menu' => 'Archived', - 'save_project' => 'Gem Projekt', - - 'error_mercurial' => 'Mercurial repository-URL skal starte med http:// eller https://', - 'error_remote' => 'Repository-URL skal starte med git://, http:// eller https://', - 'error_gitlab' => 'GitLab repository-navn skal være i formatet "user@domæne.tld:ejernavn/repositorynavn.git"', - 'error_github' => 'Repository-navn skal være i formatet "ejernavn/repositorynavn"', - 'error_bitbucket' => 'Repository-navn skal være i formatet "ejernavn/repositorynavn"', - 'error_path' => 'Stien du indtastede findes ikke.', - - // View Project: - 'all_branches' => 'Alle branches', - 'builds' => 'Builds', - 'id' => 'ID', - 'date' => 'Date', - 'project' => 'Projekt', - 'commit' => 'Commit', - 'branch' => 'Branch', - 'status' => 'Status', - 'prev_link' => '« Forrige', - 'next_link' => 'Næste »', - 'public_key' => 'Offentlig nøgle', - 'delete_build' => 'Slet Build', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'For at køre dette build automatisk når nye commits bliver pushed skal du tilføje nedenstående -URL som nyt "Webhook" i Webhooks -and Services under dit GitHub-repository.', - - 'webhooks_help_gitlab' => 'For at køre dette build automatisk når nye commits bliver pushed kan du tilføje nedenstående URL -som en "WebHook URL" i Web Hooks-sektionen i dit GitLab-repository.', - - 'webhooks_help_bitbucket' => 'For at køre dette build automatisk når nye commits bliver pushed skal du tilføje nedenstående -URL som "POST" service i - -Services sektionen under dit Bitbucket-repository.', - - // View Build - 'build_x_not_found' => 'Build med ID %d findes ikke.', - 'build_n' => 'Build %d', - 'rebuild_now' => 'Gentag Build', - - - 'committed_by_x' => 'Committed af %s', - 'commit_id_x' => 'Commit: %s', - - 'chart_display' => 'Denne graf vises når buildet er færdigt.', - - 'build' => 'Build', - 'lines' => 'Linjer', - 'comment_lines' => 'Kommentar-linjer', - 'noncomment_lines' => 'Ikke-kommentar-linjer', - 'logical_lines' => 'Logiske linjer', - 'lines_of_code' => 'Kode-linjer', - 'build_log' => 'Build-log', - 'quality_trend' => 'Kvalitets-trend', - 'codeception_errors' => 'Codeception-fejl', - 'phpmd_warnings' => 'PHPMD-advarsler', - 'phpcs_warnings' => 'PHPCS-advarsler', - 'phpcs_errors' => 'PHPCS-fejl', - 'phplint_errors' => 'Lint-fejl', - 'phpunit_errors' => 'PHPUnit-fejl', - 'phpdoccheck_warnings' => 'Manglende Docblocks', - 'issues' => 'Sager', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Manglende Docblocks', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - - 'file' => 'Fil', - 'line' => 'Linje', - 'class' => 'Klasse', - 'method' => 'Funktion', - 'message' => 'Besked', - 'start' => 'Start', - 'end' => 'Slut', - 'from' => 'Fra', - 'to' => 'Til', - 'result' => 'Resultat', - 'ok' => 'OK', - 'took_n_seconds' => 'Tog %d sekunder', - 'build_created' => 'Build Oprettet', - 'build_started' => 'Build Startet', - 'build_finished' => 'Build Afsluttet', - 'test_message' => 'Message', - 'test_no_message' => 'No message', - 'test_success' => 'Successful: %d', - 'test_fail' => 'Failures: %d', - 'test_skipped' => 'Skipped: %d', - 'test_error' => 'Errors: %d', - 'test_todo' => 'Todos: %d', - 'test_total' => '%d test(s)', - - // Users - 'name' => 'Navn', - 'password_change' => 'Adgangskode (tom hvis du ikke ønsker at ændre koden)', - 'save' => 'Gem »', - 'update_your_details' => 'Opdatér oplysninger', - 'your_details_updated' => 'Dine oplysninger blev gemt.', - 'add_user' => 'Tilføj bruger', - 'is_admin' => 'Administrator?', - 'yes' => 'Ja', - 'no' => 'Nej', - 'edit' => 'Redigér', - 'edit_user' => 'Redigér Bruger', - 'delete_user' => 'Slet Bruger', - 'user_n_not_found' => 'Brugeren med ID %d findes ikke.', - 'is_user_admin' => 'Er denne bruger en administrator?', - 'save_user' => 'Gem Bruger', - - // Settings: - 'settings_saved' => 'Dine indstillinger blev gemt.', - 'settings_check_perms' => 'Dine indstillinger kunne ikke gemmes, kontrollér rettighederne på din config.yml fil.', - 'settings_cannot_write' => 'PHPCI kan ikke skrive til din config.yml fil, indstillinger bliver muligvis ikke gemt korrekt før dette problem løses.', - 'settings_github_linked' => 'Din GitHub-konto er nu tilsluttet.', - 'settings_github_not_linked' => 'Din GitHub-konto kunne ikke tilsluttes.', - 'build_settings' => 'Build-indstillinger', - 'github_application' => 'GitHub-applikation', - 'github_sign_in' => 'Før du kan bruge GitHub skal du logge ind og give PHPCI -adgang til din konto.', - 'github_phpci_linked' => 'PHPCI blev tilsluttet din GitHub-konto.', - 'github_where_to_find' => 'Hvor disse findes...', - 'github_where_help' => 'Hvis du ejer applikationen du ønsker at bruge kan du finde denne information i -applications under indstillinger.', - - 'email_settings' => 'Email-indstillinger', - 'email_settings_help' => 'Før PHPCI kan sende build-notifikationer via email -skal du konfigurere nedenstående SMTP-indstillinger.', - - 'application_id' => 'Application ID', - 'application_secret' => 'Application Secret', - - 'smtp_server' => 'SMTP-server', - 'smtp_port' => 'SMTP-port', - 'smtp_username' => 'SMTP-brugernavn', - 'smtp_password' => 'SMTP-adgangskode', - 'from_email_address' => 'Fra email-adresse', - 'default_notification_address' => 'Default notifikations-email-adresse', - 'use_smtp_encryption' => 'Brug SMTP-kryptering?', - 'none' => 'Ingen', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Betragt et build som fejlet efter', - '5_mins' => '5 minutter', - '15_mins' => '15 minutter', - '30_mins' => '30 minutter', - '1_hour' => '1 time', - '3_hours' => '3 timer', - - // Plugins - 'cannot_update_composer' => 'PHPCI kan ikke opdatere composer.json da filen ikke kan skrives.', - 'x_has_been_removed' => '%s er blevet slettet.', - 'x_has_been_added' => '%s blev tilføjet til composer.json for dig og vil blive installeret næste gang -du kører composer update.', - 'enabled_plugins' => 'Aktive plugins', - 'provided_by_package' => 'Via pakke', - 'installed_packages' => 'Installerede pakker', - 'suggested_packages' => 'Forslag til pakker', - 'title' => 'Titel', - 'description' => 'Beskrivelse', - 'version' => 'Version', - 'install' => 'Installér »', - 'remove' => 'Fjern »', - 'search_packagist_for_more' => 'Søg på Packagist efter flere pakker', - 'search' => 'Søg »', - - // Installer - 'installation_url' => 'PHPCI Installations-URL', - 'db_host' => 'Database-hostnavn', - 'db_name' => 'Database-navn', - 'db_user' => 'Database-brugernavn', - 'db_pass' => 'Database-adgangskode', - 'admin_name' => 'Administrator-navn', - 'admin_pass' => 'Administrator-adgangskode', - 'admin_email' => 'Administrators email-adresse', - 'config_path' => 'Konfigurations-fil', - 'install_phpci' => 'Installér PHPCI', - 'welcome_to_phpci' => 'Velkommen til PHPCI', - 'please_answer' => 'Besvar venligst følgende spørgsmål:', - 'phpci_php_req' => 'PHPCI kræver minimum PHP version 5.3.8 for at fungere.', - 'extension_required' => 'Extension påkrævet: %s', - 'function_required' => 'PHPCI behøver adgang til funktion %s() i PHP. Er den deaktiveret i php.ini?', - 'requirements_not_met' => 'PHPCI kan ikke installeres da nogle krav ikke opfyldtes. -Kontrollér venligst nedenstående fejl før du fortsætter.', - 'must_be_valid_email' => 'Skal være en gyldig email-adresse.', - 'must_be_valid_url' => 'Skal være en gyldig URL.', - 'enter_name' => 'Administrator-navn: ', - 'enter_email' => 'Administrators email-adresse: ', - 'enter_password' => 'Administrator-adgangskode: ', - 'enter_phpci_url' => 'Din PHPCI URL (eksempelvis "http://phpci.local"): ', - - 'enter_db_host' => 'Indtast dit MySQL-hostnavn [localhost]: ', - 'enter_db_name' => 'Indtast dit MySQL database-navn [phpci]: ', - 'enter_db_user' => 'Indtast dit MySQL-brugernavn [phpci]: ', - 'enter_db_pass' => 'Indtast dit MySQL-password: ', - 'could_not_connect' => 'PHPCI kunne ikke forbinde til MySQL med de angivning oplysninger. Forsøg igen.', - 'setting_up_db' => 'Indlæser database...', - 'user_created' => 'Brugerkonto oprettet!', - 'failed_to_create' => 'PHPCI kunne ikke oprette din administrator-konto.', - 'config_exists' => 'PHPCI konfigurationsfilen findes og er ikke tom.', - 'update_instead' => 'Hvis du forsøgte at opdatere PHPCI, forsøg da venligst med phpci:update istedet.', - - // Update - 'update_phpci' => 'Opdatér databasen med ændrede modeller', - 'updating_phpci' => 'Opdaterer PHPCI-database:', - 'not_installed' => 'PHPCI lader til ikke at være installeret.', - 'install_instead' => 'Installér venligst PHPCI via phpci:install istedet.', - - // Poll Command - 'poll_github' => 'Check via GitHub om et build skal startes.', - 'no_token' => 'GitHub-token findes ikke', - 'finding_projects' => 'Finder projekter der kan forespørges', - 'found_n_projects' => '%d projekter fundet', - 'last_commit_is' => 'Sidste commit til GitHub for %s er %s', - 'adding_new_build' => 'Sidste commit er forskellig fra databasen, tilføjer nyt build.', - 'finished_processing_builds' => 'Kørsel af builds afsluttet.', - - // Create Admin - 'create_admin_user' => 'Tilføj en administrator', - 'incorrect_format' => 'Forkert format', - - // Create Build Command - 'create_build_project' => 'Create a build for a project', - 'project_id_argument' => 'A project ID', - 'commit_id_option' => 'Commit ID to build', - 'branch_name_option' => 'Branch to build', - - // Run Command - 'run_all_pending' => 'Kør alle PHPCI builds i køen.', - 'finding_builds' => 'Finder builds der skal køres', - 'found_n_builds' => '%d builds fundet', - 'skipping_build' => 'Springer over Build %d - projektet kører et build lige nu.', - 'marked_as_failed' => 'Build %d blev markeret som fejlet pga. timeout.', - - // Builder - 'missing_phpci_yml' => 'Dette projekt har ingen phpci.yml fil, eller filen er tom.', - 'build_success' => 'BUILD SUCCES', - 'build_failed' => 'BUILD FEJLET', - 'removing_build' => 'Fjerner Build', - 'exception' => 'Undtagelse:', - 'could_not_create_working' => 'Kunne ikke oprette en arbejds-kopi.', - 'working_copy_created' => 'Arbejds-kopi oprettet: %s', - 'looking_for_binary' => 'Leder efter kommando: %s', - 'found_in_path' => 'Fundet i %s: %s', - 'running_plugin' => 'KØRER PLUGIN: %s', - 'plugin_success' => 'PLUGIN: SUCCES', - 'plugin_failed' => 'PLUGIN: FEJL', - 'plugin_missing' => 'Plugin findes ikke: %s', - 'tap_version' => 'TapParser understøtter kun TAP version 13.', - 'tap_error' => 'Ugyldig TAP-streng, antallet af tests passer ikke med det angivne antal tests.', - - // Build Plugins: - 'no_tests_performed' => 'Ingen tests udført.', - 'could_not_find' => 'Kunne ikke finde %s', - 'no_campfire_settings' => 'Ingen forbindelses-oplysninger angivet i Campfire plugin', - 'failed_to_wipe' => 'Kunne ikke slette eksisterende mappe %s før kopi', - 'passing_build' => 'Succesfuldt Build', - 'failing_build' => 'Fejlet Build', - 'log_output' => 'Log-output:', - 'n_emails_sent' => '%d emails afsendt.', - 'n_emails_failed' => '%d emails kunne ikke afsendes.', - 'unable_to_set_env' => 'Kunne ikke sætte environment-variabel', - 'tag_created' => 'Tag oprettet af PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% bygget på %BUILD_URI%', - 'hipchat_settings' => 'Angiv venligst rum og autoToken i hipchat_notify plugin', - 'irc_settings' => 'Du skal som minimum indstille en server, et rum og et nicknavn.', - 'invalid_command' => 'Ugyldig kommando', - 'import_file_key' => 'Importen skal indeholde en \'file\' variabel', - 'cannot_open_import' => 'Kunne ikke åbne SQL import-fil: %s', - 'unable_to_execute' => 'Kunne ikke udføre instruktionerne i SQL-filen', - 'phar_internal_error' => 'Phar Plugin Internal Error', - 'build_file_missing' => 'Den angivne build-fil findes ikke.', - 'property_file_missing' => 'Den angivne property-fil findes ikke', - 'could_not_process_report' => 'Kunne ikke behandle rapporten, som dette værktøj genererede.', - 'shell_not_enabled' => 'Shell-plugin er ikke aktiveret. Aktivér det via config.yml.' -); diff --git a/PHPCI/Languages/lang.de.php b/PHPCI/Languages/lang.de.php deleted file mode 100644 index 8e5bb3b2..00000000 --- a/PHPCI/Languages/lang.de.php +++ /dev/null @@ -1,433 +0,0 @@ - 'Deutsch', - 'language' => 'Sprache', - - // Log in: - 'log_in_to_phpci' => 'In PHPCI einloggen', - 'login_error' => 'Fehlerhafte Emailadresse oder fehlerhaftes Passwort', - 'forgotten_password_link' => 'Passwort vergessen?', - 'reset_emailed' => 'Wir haben Ihnen einen Link geschickt, um Ihr Passwort zurückzusetzen', - 'reset_header' => 'Keine Panik!
Geben Sie einfach unten Ihre Emailadresse an - und wir senden Ihnen einen Link, um Ihr Passwort zurückzusetzen', - 'reset_email_address' => 'Geben Sie Ihre Emailadresse an:', - 'reset_send_email' => 'Link senden', - 'reset_enter_password' => 'Bitte geben Sie ein neues Passwort ein', - 'reset_new_password' => 'Neues Passwort:', - 'reset_change_password' => 'Passwort ändern', - 'reset_no_user_exists' => 'Es existiert kein User mit dieser Emailadresse, versuchen Sie es bitte noch einmal.', - 'reset_email_body' => 'Hallo %s, - -Sie haben diese Email erhalten, weil Sie, oder jemand anders, einen Link zum Zurücksetzen Ihres Passwortes für PHPCI verlangt hat. - -Wenn Sie diesen Link verlangt haben, klicken Sie bitte hier, um Ihr Passwort zurückzusetzen: %ssession/reset-password/%d/%s - -Falls nicht, ignorieren Sie diese Email bitte, und es wird nichts geändert. - -Danke, - -PHPCI', - - 'reset_email_title' => 'PHPCI Passwort zurücksetzen für %s', - 'reset_invalid' => 'Fehlerhafte Anfrage für das Zurücksetzen eines Passwortes', - 'email_address' => 'Emailadresse', - 'login' => 'Login / Emailadresse', - 'password' => 'Passwort', - 'log_in' => 'Einloggen', - - - // Top Nav - 'toggle_navigation' => 'Navigation umschalten', - 'n_builds_pending' => '%d Builds ausstehend', - 'n_builds_running' => '%d Builds werden ausgeführt', - 'edit_profile' => 'Profil bearbeiten', - 'sign_out' => 'Ausloggen', - 'branch_x' => 'Branch: %s', - 'created_x' => 'Erstellt: %s', - 'started_x' => 'Gestartet: %s', - - // Sidebar - 'hello_name' => 'Hallo, %s', - 'dashboard' => 'Dashboard', - 'admin_options' => 'Administration', - 'add_project' => 'Projekt hinzufügen', - 'settings' => 'Einstellungen', - 'manage_users' => 'Benutzereinstellungen', - 'plugins' => 'Plugins', - 'view' => 'Ansehen', - 'build_now' => 'Jetzt bauen', - 'edit_project' => 'Projekt bearbeiten', - 'delete_project' => 'Projekt löschen', - - // Project Summary: - 'no_builds_yet' => 'Bisher noch keine Builds!', - 'x_of_x_failed' => '%d der letzten %d Builds sind fehlgeschlagen.', - 'x_of_x_failed_short' => '%d / %d fehlgeschlagen.', - 'last_successful_build' => ' Der letzte erfolgreiche Build war %s.', - 'never_built_successfully' => ' Dieses Projekt hatte bisher noch keinen erfolgreichen Build.', - 'all_builds_passed' => 'Jeder der letzten %d Builds war erfolgreich.', - 'all_builds_passed_short' => '%d / %d erfolgreich.', - 'last_failed_build' => ' Der letzte fehlgeschlagene Build war %s.', - 'never_failed_build' => ' Dieses Projekt hat keine fehlgeschlagenen Builds.', - 'view_project' => 'Projekt ansehen', - - // Timeline: - 'latest_builds' => 'Die neusten Builds', - 'pending' => 'Ausstehend', - 'running' => 'Wird ausgeführt', - 'success' => 'Erfolg', - 'successful' => 'Erfolgreich', - 'failed' => 'Fehlgeschlagen', - 'manual_build' => 'Manueller Build', - - // Add/Edit Project: - 'new_project' => 'Neues Projekt', - 'project_x_not_found' => 'Projekt mit ID %d existiert nicht.', - 'project_details' => 'Projektdetails', - 'public_key_help' => 'Um Ihnen den Einstieg zu erleichtern, haben wir ein SSH-Key-Paar für dieses Projekt -generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Abschnitt -"Deploy Keys" Ihrer bevorzugten Quellcodehostingplattform hinzu.', - 'select_repository_type' => 'Wählen Sie den Typ des Repositories...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'Externe URL', - 'local' => 'Lokaler Pfad', - 'hg' => 'Mercurial', - 'svn' => 'Subversion', - - 'where_hosted' => 'Wo wird Ihr Projekt gehostet?', - 'choose_github' => 'Wählen Sie ein GitHub Repository:', - - 'repo_name' => 'Name/URL (extern) oder Pfad (lokal) des Repositories', - 'project_title' => 'Projekttitel', - 'project_private_key' => 'Private Key für den Zugang zum Repository - (leer lassen für lokale und oder anonyme externe Zugriffe)', - 'build_config' => 'PHPCI Buildkonfiguration für dieses Projekt - (falls Sie Ihrem Projektrepository kein phpci.yml hinzufügen können)', - 'default_branch' => 'Name des Standardbranches', - 'allow_public_status' => 'Öffentliche Statusseite und -bild für dieses Projekt einschalten?', - 'archived' => 'Archiviert', - 'archived_menu' => 'Archiviert', - 'save_project' => 'Projekt speichern', - - 'error_mercurial' => 'Mercurial Repository-URL muss mit http://, oder https:// beginnen', - 'error_remote' => 'Repository-URL muss mit git://, http://, oder https:// beginnen', - 'error_gitlab' => 'GitLab Repositoryname muss im Format "user@domain.tld:owner/repo.git" sein', - 'error_github' => 'Repositoryname muss im Format "besitzer/repo" sein', - 'error_bitbucket' => 'Repositoryname muss im Format "besitzer/repo" sein', - 'error_path' => 'Der angegebene Pfad existiert nicht', - - // View Project: - 'all_branches' => 'Alle Branches', - 'builds' => 'Builds', - 'id' => 'ID', - 'date' => 'Datum', - 'project' => 'Projekt', - 'commit' => 'Commit', - 'branch' => 'Branch', - 'status' => 'Status', - 'prev_link' => '« Vorherige', - 'next_link' => 'Nächste »', - 'public_key' => 'Public Key', - 'delete_build' => 'Build löschen', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed - werden, fügen Sie die untenstehende URL in der - Webhooks and Services-Sektion Ihres - GitHub Repositories als neuen "Webhook" hinzu.', - - 'webhooks_help_gitlab' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed werden, fügen Sie die untenstehende URL in der Web Hooks Sektion Ihres GitLab Repositories hinzu.', - - 'webhooks_help_bitbucket' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed werden, fügen Sie die untenstehende URL als "POST" Service in der Services-Sektion Ihres Bitbucket Repositories hinzu.', - - // View Build - 'errors' => 'Fehler', - 'information' => 'Information', - - 'build_x_not_found' => 'Build mit ID %d existiert nicht.', - 'build_n' => 'Build %d', - 'rebuild_now' => 'Build neu starten', - - - 'committed_by_x' => 'Committed von %s', - 'commit_id_x' => 'Commit: %s', - - 'chart_display' => 'Dieses Diagramm wird angezeigt, sobald der Build abgeschlossen ist.', - - 'build' => 'Build', - 'lines' => 'Zeilen', - 'comment_lines' => 'Kommentarzeilen', - 'noncomment_lines' => 'Nicht-Kommentarzeilen', - 'logical_lines' => 'Zeilen mit Logik', - 'lines_of_code' => 'Anzahl Codezeilen', - 'build_log' => 'Buildprotokoll', - 'quality_trend' => 'Qualitätstrend', - 'codeception_errors' => 'Codeception Errors', - 'phpmd_warnings' => 'PHPMD Warnings', - 'phpcs_warnings' => 'PHPCS Warnings', - 'phpcs_errors' => 'PHPCS Errors', - 'phplint_errors' => 'Lint Errors', - 'phpunit_errors' => 'PHPUnit Errors', - 'phpdoccheck_warnings' => 'Fehlende Docblocks', - 'issues' => 'Probleme', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Fehlende Docblocks', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - 'technical_debt' => 'Technische Schulden', - 'behat' => 'Behat', - - 'codeception_feature' => 'Feature', - 'codeception_suite' => 'Suite', - 'codeception_time' => 'Zeit', - 'codeception_synopsis' => '%1$d Tests in %2$f Sekunden ausgeführt. - %3$d Fehler.', - - 'file' => 'Datei', - 'line' => 'Zeile', - 'class' => 'Klasse', - 'method' => 'Methode', - 'message' => 'Nachricht', - 'start' => 'Start', - 'end' => 'Ende', - 'from' => 'Von', - 'to' => 'Bis', - 'result' => 'Resultat', - 'ok' => 'OK', - 'took_n_seconds' => 'Benötigte %d Sekunden', - 'build_created' => 'Build erstellt', - 'build_started' => 'Build gestartet', - 'build_finished' => 'Build abgeschlossen', - 'test_message' => 'Nachricht', - 'test_no_message' => 'Keine Nachricht', - 'test_success' => 'Erfolgreich: %d', - 'test_fail' => 'Fehlschläge: %d', - 'test_skipped' => 'Übersprungen: %d', - 'test_error' => 'Fehler: %d', - 'test_todo' => 'Todos: %d', - 'test_total' => '%d Test(s)', - - // Users - 'name' => 'Name', - 'password_change' => 'Passwort (leerlassen, wenn Sie es nicht ändern möchten)', - 'save' => 'Speichern »', - 'update_your_details' => 'Aktualisieren Sie Ihre Details', - 'your_details_updated' => 'Ihre Details wurden aktualisiert.', - 'add_user' => 'Benutzer hinzufügen', - 'is_admin' => 'Administrator?', - 'yes' => 'Ja', - 'no' => 'Nein', - 'edit' => 'Bearbeiten', - 'edit_user' => 'Benutzer bearbeiten', - 'delete_user' => 'Benutzer löschen', - 'user_n_not_found' => 'Benutzer mit ID %d existiert nicht.', - 'is_user_admin' => 'Ist dieser Benutzer Administrator?', - 'save_user' => 'Benutzer speichern', - - // Settings: - 'settings_saved' => 'Ihre Einstellungen wurden gespeichert.', - 'settings_check_perms' => 'Ihre Einstellungen konnten nicht gespeichert werden, bitte überprüfen Sie die - Berechtigungen Ihrer config.yml-Datei', - 'settings_cannot_write' => 'PHPCI konnte config.yml nicht schreiben. Einstellungen könnten nicht richtig gespeichert werden, bis das Problem behoben ist.', - 'settings_github_linked' => 'Ihr GitHub-Konto wurde verknüpft.', - 'settings_github_not_linked' => 'Ihr GitHub-Konto konnte nicht verknüpft werden.', - 'build_settings' => 'Buildeinstellungen', - 'github_application' => 'GitHub-Applikation', - 'github_sign_in' => 'Bevor Sie anfangen GitHub zu verwenden, müssen Sie sich erst einloggen und PHPCI Zugriff auf Ihr Nutzerkonto gewähren', - 'github_phpci_linked' => 'PHPCI wurde erfolgreich mit Ihrem GitHub-Konto verknüpft.', - 'github_where_to_find' => 'Wo Sie diese finden...', - 'github_where_help' => 'Wenn Sie der Besitzer der Applikation sind, die Sie gerne verwenden möchten, können Sie - diese Einstellungen in Ihrem "applications - settings"-Bereich finden.', - - 'email_settings' => 'Emaileinstellungen', - 'email_settings_help' => 'Bevor PHPCI E-Mails zum Buildstatus verschicken kann, - müssen Sie Ihre SMTP-Einstellungen unten konfigurieren', - - 'application_id' => 'Applikations-ID', - 'application_secret' => 'Applikations-Secret', - - 'smtp_server' => 'SMTP Server', - 'smtp_port' => 'SMTP Port', - 'smtp_username' => 'SMTP Benutzername', - 'smtp_password' => 'SMTP Passwort', - 'from_email_address' => 'Absenderadresse', - 'default_notification_address' => 'Standardadresse für Benachrichtigungen', - 'use_smtp_encryption' => 'SMTP-Verschlüsselung verwenden?', - 'none' => 'Keine', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Einen Build als fehlgeschlagen ansehen nach', - '5_mins' => '5 Minuten', - '15_mins' => '15 Minuten', - '30_mins' => '30 Minuten', - '1_hour' => '1 Stunde', - '3_hours' => '3 Stunden', - - // Plugins - 'cannot_update_composer' => 'PHPCI kann composer.json nicht für Sie aktualisieren, da Schreibrechte benötigt werden.', - 'x_has_been_removed' => '%s wurde entfernt.', - 'x_has_been_added' => '%s wurde für Sie dem composer.json hinzugefügt und wird installiert, sobald Sie das nächste mal composer update ausführen.', - 'enabled_plugins' => 'Eingeschaltene Plugins', - 'provided_by_package' => 'Von Package bereitgestellt', - 'installed_packages' => 'Installierte Packages', - 'suggested_packages' => 'Vorgeschlagene Packages', - 'title' => 'Titel', - 'description' => 'Beschreibung', - 'version' => 'Version', - 'install' => 'Installieren »', - 'remove' => 'Entfernen »', - 'search_packagist_for_more' => 'Packagist nach mehr Packages durchsuchen', - 'search' => 'Suchen »', - - // Summary plugin - 'build-summary' => 'Zusammenfassung', - 'stage' => 'Abschnitt', - 'duration' => 'Dauer', - 'plugin' => 'Plugin', - 'stage_setup' => 'Vorbereitung', - 'stage_test' => 'Test', - 'stage_complete' => 'Vollständig', - 'stage_success' => 'Erfolg', - 'stage_failure' => 'Fehlschlag', - 'stage_broken' => 'Defekt', - 'stage_fixed' => 'Behoben', - - // Installer - 'installation_url' => 'PHPCI Installations-URL', - 'db_host' => 'Datenbankserver', - 'db_name' => 'Datenbankname', - 'db_user' => 'Datenbankbenutzer', - 'db_pass' => 'Datenbankpasswort', - 'admin_name' => 'Administratorname', - 'admin_pass' => 'Administratorpasswort', - 'admin_email' => 'Emailadresse des Administrators', - 'config_path' => 'Dateipfad für Konfiguration', - 'install_phpci' => 'PHPCI installieren', - 'welcome_to_phpci' => 'Willkommen bei PHPCI', - 'please_answer' => 'Bitte beantworten Sie die folgenden Fragen:', - 'phpci_php_req' => 'PHPCI benötigt mindestens PHP 5.3.8 um zu funktionieren.', - 'extension_required' => 'Benötigte Extensions: %s', - 'function_required' => 'PHPCI muss die Funktion %s() aufrufen können. Ist sie in php.ini deaktiviert?', - 'requirements_not_met' => 'PHPCI konnte nicht installiert werden, weil nicht alle Bedingungen erfüllt sind. - Bitte überprüfen Sie die Fehler, bevor Sie fortfahren,', - 'must_be_valid_email' => 'Muss eine gültige Emailadresse sein.', - 'must_be_valid_url' => 'Muss eine valide URL sein.', - 'enter_name' => 'Name des Administrators: ', - 'enter_email' => 'Emailadresse des Administrators: ', - 'enter_password' => 'Passwort des Administrators: ', - 'enter_phpci_url' => 'Ihre PHPCI-URL (z.B. "http://phpci.local"): ', - - 'enter_db_host' => 'Bitte geben Sie Ihren MySQL-Host ein [localhost]: ', - 'enter_db_name' => 'Bitte geben Sie Ihren MySQL-Namen ein [phpci]: ', - 'enter_db_user' => 'Bitte geben Sie Ihren MySQL-Benutzernamen ein [phpci]: ', - 'enter_db_pass' => 'Bitte geben Sie Ihr MySQL-Passwort ein: ', - 'could_not_connect' => 'PHPCI konnte wegen folgender Details nicht mit MySQL verbinden. Bitte versuchen Sie es erneut.', - 'setting_up_db' => 'Ihre Datenbank wird aufgesetzt... ', - 'user_created' => 'Benutzerkonto wurde erstellt!', - 'failed_to_create' => 'PHPCI konnte Ihr Administratorenkonto nicht erstellen.', - 'config_exists' => 'Die PHPCI-Konfigurationsdatei existiert und ist nicht leer..', - 'update_instead' => 'Falls Sie versucht haben PHPCI zu aktualisieren, benutzen Sie bitte stattdessen phpci:update.', - - // Update - 'update_phpci' => 'Datenbank wird aktualisiert, um den Änderungen der Models zu entsprechen.', - 'updating_phpci' => 'Aktualisiere PHPCI-Datenbank:', - 'not_installed' => 'PHPCI scheint nicht installiert zu sein.', - 'install_instead' => 'Bitte installieren Sie PHPCI stattdessen via phpci:install.', - - // Poll Command - 'poll_github' => 'GitHub abfragen, um herauszufinden, ob ein Build gestartet werden muss.', - 'no_token' => 'Kein GitHub-Token gefunden', - 'finding_projects' => 'Suche Projekte, um diese abzufragen', - 'found_n_projects' => '%d Projekte gefunden', - 'last_commit_is' => 'Der letzte Commit zu GitHub für %s ist %s', - 'adding_new_build' => 'Letzter Commit unterscheidet sich von der Datenbank, füge neuen Build hinzu.', - 'finished_processing_builds' => 'Bearbeiten der Builds abgeschlossen.', - - // Create Admin - 'create_admin_user' => 'Administratorenbenutzer erstellen', - 'incorrect_format' => 'Falsches Format', - - // Create Build Command - 'create_build_project' => 'Create a build for a project', - 'project_id_argument' => 'A project ID', - 'commit_id_option' => 'Commit ID to build', - 'branch_name_option' => 'Branch to build', - - // Run Command - 'run_all_pending' => 'Führe alle ausstehenden PHPCI Builds aus.', - 'finding_builds' => 'Suche verarbeitbare Builds', - 'found_n_builds' => '%d Builds gefunden', - 'skipping_build' => 'Überspringe Build %d - Es wird bereits ein Build auf diesem Projekt ausgeführt.', - 'marked_as_failed' => 'Build %d wegen Zeitüberschreitung als fehlgeschlagen markiert.', - - // Builder - 'missing_phpci_yml' => 'Dieses Projekt beinhaltet keine phpci.yml-Datei, oder sie ist leer.', - 'build_success' => 'BUILD ERFOLGREICH', - 'build_failed' => 'BUILD FEHLGESCHLAGEN', - 'removing_build' => 'Entferne Build.', - 'exception' => 'Exception: ', - 'could_not_create_working' => 'Konnte keine Arbeitskopie erstellen.', - 'working_copy_created' => 'Arbeitskopie erstellt: %s', - 'looking_for_binary' => 'Suche Binärdatei: %s', - 'found_in_path' => 'Gefunden in %s: %s', - 'running_plugin' => 'AUSGEFÜHRTES PLUGIN: %s', - 'plugin_success' => 'PLUGIN: ERFOLGREICH', - 'plugin_failed' => 'PLUGIN: FEHLGECHLAGEN', - 'plugin_missing' => 'Plugin existiert nicht: %s', - 'tap_version' => 'TapParser unterstützt nur TAP version 13', - 'tap_error' => 'Ungültiger TAP String, Anzahl Tests entspricht nicht angegebener Testzahl.', - - // Build Plugins: - 'no_tests_performed' => 'Keine Tests wurden ausgeführt.', - 'could_not_find' => '%s wurde nicht gefunden', - 'no_campfire_settings' => 'Keine Verbindungsparameter für das Campfire plugin gefunden', - 'failed_to_wipe' => 'Konnte Ordner %s nicht vor dem Kopieren leeren', - 'passing_build' => 'Durchlaufender Build', - 'failing_build' => 'Fehlschlagender Build', - 'log_output' => 'Protokollausgabe: ', - 'n_emails_sent' => '%d Emails verschickt.', - 'n_emails_failed' => 'Konnte %d Emails nicht verschicken.', - 'unable_to_set_env' => 'Konnte Umgebungsvariable nicht setzen', - 'tag_created' => 'Tag erstellt durch PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% gebuildet auf %BUILD_URI%', - 'hipchat_settings' => 'Bitte definieren Sie Room und AuthToken für das hipchat_notify-Plugin', - 'irc_settings' => 'Sie müssen einen Server, Room und Nick definieren.', - 'invalid_command' => 'Ungültiges Kommando', - 'import_file_key' => 'Import-Statements müssen einen \'file\'-Key enthalten', - 'cannot_open_import' => 'Konnte SQL-Importdatei nicht öffnen: %s', - 'unable_to_execute' => 'Konnte SQL-Datei nicht ausführen', - 'phar_internal_error' => 'Phar Plugin Interner Fehler', - 'build_file_missing' => 'Angegebene Builddatei existiert nicht.', - 'property_file_missing' => 'Angegebene Eigenschaftsdatei existiert nicht.', - 'could_not_process_report' => 'Konnte den von diesem Tool erstellten Bericht nicht verarbeiten.', - 'shell_not_enabled' => 'Das Shell-Plugin ist nicht aktiviert. Bitte aktivieren Sie es via config.yml.', - - // Error Levels: - 'critical' => 'Kritisch', - 'high' => 'Hoch', - 'normal' => 'Normal', - 'low' => 'Niedrig', - - // Plugins that generate errors: - 'php_mess_detector' => 'PHP Mess Detector', - 'php_code_sniffer' => 'PHP Code Sniffer', - 'php_unit' => 'PHP Unit', - 'php_cpd' => 'PHP Copy/Paste Detector', - 'php_docblock_checker' => 'PHP Docblock Checker', -); diff --git a/PHPCI/Languages/lang.el.php b/PHPCI/Languages/lang.el.php deleted file mode 100644 index 45ee4bee..00000000 --- a/PHPCI/Languages/lang.el.php +++ /dev/null @@ -1,399 +0,0 @@ - 'Ελληνικά', - 'language' => 'Γλώσσα', - - // Log in: - 'log_in_to_phpci' => 'Είσοδος στο PHPCI', - 'login_error' => 'Λάθος διεύθυνση e-mail ή κωδικός πρόσβασης', - 'forgotten_password_link' => 'Ξεχάσατε τον κωδικό σας;', - 'reset_emailed' => 'Σας έχουμε αποσταλεί ένα σύνδεσμο για να επαναφέρετε τον κωδικό πρόσβασής σας.', - 'reset_header' => ' Μην ανησυχείτε!
Απλά εισάγετε το email σας παρακάτω και θα θα σας αποστείλουμε ένα email -με ένα σύνδεσμο για να επαναφέρετε τον κωδικό πρόσβασής σας.', - 'reset_email_address' => 'Εισάγετε τη διεύθυνση e-mail σας:', - 'reset_send_email' => 'Email επαναφοράς κωδικού πρόσβασης', - 'reset_enter_password' => 'Παρακαλώ εισάγετε ένα νέο κωδικό πρόσβασης', - 'reset_new_password' => 'Νέος κωδικός πρόσβασης:', - 'reset_change_password' => 'Αλλαγή κωδικού πρόσβασης', - 'reset_no_user_exists' => 'Δεν υπάρχει χρήστης με αυτή την διεύθυνση ηλεκτρονικού ταχυδρομείου, παρακαλώ προσπαθήστε ξανά.', - 'reset_email_body' => 'Γεια %s, - -Έχετε λάβει αυτό το μήνυμα επειδή εσείς, ή κάποιος άλλος, ζήτησε επαναφορά κωδικού πρόσβασης για το PHPCI. - -Αν ήσασταν εσείς, παρακαλώ κάντε κλικ στον παρακάτω σύνδεσμο για να επαναφέρετε τον κωδικό πρόσβασής σας: %ssession/reset-password/%d/%s - -Σε αντίθετη περίπτωση, παρακαλούμε να αγνοήσετε αυτό το μήνυμα και δεν πρόκεται να πραγματοποιηθεί η επαναφορά. - -Σας ευχαριστούμε, - -PHPCI', - - 'reset_email_title' => 'PHPCI Επαναφορά Κωδικού για %s', - 'reset_invalid' => 'Μη έγκυρο αίτημα επαναφοράς κωδικού πρόσβασης.', - 'email_address' => 'Διεύθυνση email', - 'login' => 'Login / Email Address', - 'password' => 'Κωδικός πρόσβασης', - 'log_in' => 'Είσοδος', - - - // Top Nav - 'toggle_navigation' => 'Εναλλαγή πλοήγησης', - 'n_builds_pending' => '%d κατασκευές σε εκκρεμότητα', - 'n_builds_running' => '%d τρέχοντες κατασκευές', - 'edit_profile' => 'Επεξεργασία Προφίλ', - 'sign_out' => 'Έξοδος', - 'branch_x' => 'Διακλάδωση: %s', - 'created_x' => 'Δημιουργήθηκε: %s', - 'started_x' => 'Ξεκίνησε: %s', - - // Sidebar - 'hello_name' => 'Γειά, %s', - 'dashboard' => 'Πίνακας ελέγχου', - 'admin_options' => 'Επιλογές Διαχειριστή', - 'add_project' => 'Προσθήκη έργου', - 'settings' => 'Ρυθμίσεις', - 'manage_users' => 'Διαχείριση χρηστών', - 'plugins' => 'Πρόσθετα', - 'view' => 'Προβολή', - 'build_now' => 'Κατασκευή τώρα', - 'edit_project' => 'Επεξεργασία Έργου', - 'delete_project' => 'Διαγραφή Έργου', - - // Project Summary: - 'no_builds_yet' => 'Καμία κατασκευή ακόμα!', - 'x_of_x_failed' => '%d από τις %d τελευταίες κατασκευές απέτυχαν', - 'x_of_x_failed_short' => '%d / %d απέτυχαν.', - 'last_successful_build' => 'Η τελευταία επιτυχής κατασκεύη ήταν %s.', - 'never_built_successfully' => 'Αυτό το έργο δεν έχει ποτέ κατασκευαστεί με επιτυχία.', - 'all_builds_passed' => 'Όλες από τις %d κατασκευές πέρασαν', - 'all_builds_passed_short' => '%d / %d πέρασαν.', - 'last_failed_build' => 'H τελευταία αποτυχημένη κατασκευή ήταν %s.', - 'never_failed_build' => 'Το έργο αυτό δεν παρέλειψε ποτέ μια κατασκευή.', - 'view_project' => 'Προβολή του έργου', - - // Timeline: - 'latest_builds' => 'Τελευταίες κατασκευές', - 'pending' => 'Σε εκκρεμότητα', - 'running' => 'Τρέχοντα', - 'success' => 'Επιτυχία', - 'successful' => 'Επιτυχής', - 'failed' => 'Αποτυχία', - 'manual_build' => 'Χειροκίνητη κατασκευή', - - // Add/Edit Project: - 'new_project' => 'Νέο έργο', - 'project_x_not_found' => 'Το έργο με αριθμό %d δεν υπάρχει', - 'project_details' => 'Στοιχεία Έργου', - 'public_key_help' => 'Για να είναι πιο εύκολο να ξεκινήσετε, έχουμε δημιουργήσει ένα ζεύγος κλειδιών SSH για να χρησιμοποιήσετε -για το έργο αυτό. Για να τα χρησιμοποιήσετε, απλά προσθέστε το ακόλουθο δημόσιο κλειδί στο τμήμα "ανάπτυξη κλειδιών" -του επιλεγμένου πηγαίου κώδικα της πλατφόρμας φιλοξενίας σας.', - 'select_repository_type' => 'Επιλέξτε τον τύπο του αποθετηρίου...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'Απομακρυσμένη διεύθυνση URL', - 'local' => 'Τοπική Διαδρομή', - 'hg' => 'Ευμετάβλητο', - - 'where_hosted' => 'Πού φιλοξενείται το έργο σας;', - 'choose_github' => 'Επιλέξτε ένα αποθετήριο GitHub:', - - 'repo_name' => 'Αποθετήριο Όνομα / διεύθυνση URL (Απομακρυσμένα) ή Διαδρομή (Τοπικά)', - 'project_title' => 'Τίτλος Έργου', - 'project_private_key' => 'Ιδιωτικό κλειδί για πρόσβαση σε αποθετήριο -(αφήστε κενό για την τοπική ή / και ανώνυμα απομακρυσμένα)', - 'build_config' => 'Kατασκευή διαμόρφωσης PHPCI για αυτό το έργο -(αν δεν μπορείτε να προσθέσετε ένα αρχείο phpci.yml στο αποθετήριο έργων)', - 'default_branch' => 'Προκαθορισμένο όνομα διακλάδωσης', - 'allow_public_status' => 'Ενεργοποίηση της σελίδας δημόσιας κατάστασης και την εικόνα για το έργο αυτό;', - 'archived' => 'Archived', - 'archived_menu' => 'Archived', - 'save_project' => 'Αποθήκευση έργου', - - 'error_mercurial' => 'Ο σύνδεσμος URL του ευμετάβλητου αποθετηρίου πρέπει να ξεκινάει με http:// ή https://', - 'error_remote' => 'Ο σύνδεσμος URL του αποθετηρίου πρέπει να ξεκινάει με git://, http:// ή https://', - 'error_gitlab' => 'Το όνομα του αποθετηρίου GitLab πρέπει να είναι της μορφής "user@domain.tld:owner/repo.git"', - 'error_github' => 'Το όνομα του αποθετηρίου θα πρέπει να είναι της μορφής "owner/repo" ιδιοκτήτης/αποθετήριο', - 'error_bitbucket' => 'Το όνομα του αποθετηρίου θα πρέπει να είναι της μορφής "owner/repo" ιδιοκτήτης/αποθετήριο', - 'error_path' => 'Η διαδρομή που καθορίσατε δεν υπάρχει.', - - // View Project: - 'all_branches' => 'Όλες οι διακλαδώσεις', - 'builds' => 'Κατασκευές', - 'id' => 'Αριθμός αναγνώρισης', - 'date' => 'Date', - 'project' => 'Έργο', - 'commit' => 'Συνεισφορά', - 'branch' => 'Διακλάδωση', - 'status' => 'Κατάσταση', - 'prev_link' => '« Προηγούμενο', - 'next_link' => 'Επόμενο «', - 'public_key' => 'Δημόσιο κλειδί', - 'delete_build' => 'Διαγραφή κλειδιού', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Για την αυτόματη κατασκευή αυτού του έργου όταν υπάρχουν νέες συνεισφορές, προσθέστε τη διεύθυνση URL παρακάτω -ως ένα νέο "Webhook" στο τμήμα Webhooks -and Services του GitHub αποθετηρίου σας.', - - 'webhooks_help_gitlab' => 'Για την αυτόματη κατασκευή αυτού του έργου όταν υπάρχουν νέες συνεισφορές, προσθέστε την διεύθυνση URL παρακάτω -σαν "WebHook URL" στο τμήμα Web Hooks του GitLab αποθετηρίου σας.', - - 'webhooks_help_bitbucket' => 'Για την αυτόματη κατασκευή αυτού του έργου όταν υπάρχουν νέες συνεισφορές, προσθέστε τη διεύθυνση URL παρακάτω -ως μια υπηρεσία "POST" στο τμήμα -Services του Bitbucket αποθετηρίου σας.', - - // View Build - 'build_x_not_found' => 'Η κατασκευή με αριθμό %d δεν υπάρχει', - 'build_n' => 'Κατασκευή %d', - 'rebuild_now' => 'Αναδόμηση τώρα', - - - 'committed_by_x' => 'Έγινε συνεισφορά από %s', - 'commit_id_x' => 'Συνεισφορά: %s', - - 'chart_display' => 'Αυτό το γράφημα θα εμφανιστεί μόλις η κατασκευή έχει ολοκληρωθεί.', - - 'build' => 'Κατασκευή', - 'lines' => 'Γραμμές', - 'comment_lines' => 'Γραμμές σχολίων', - 'noncomment_lines' => 'Μη σχολιασμένες γραμμές', - 'logical_lines' => 'Λογικές γραμμές', - 'lines_of_code' => 'Γραμμές Κώδικα', - 'build_log' => 'Αρχείο καταγραφής κατασκευών', - 'quality_trend' => 'Ποιότητα τρέντ', - 'codeception_errors' => 'Λάθη Codeception', - 'phpmd_warnings' => 'Προειδοποιήσεις PHPMD', - 'phpcs_warnings' => 'Προειδοποιήσεις PHPCS ', - 'codeception_errors' => 'Λάθη Codeception', - 'phpcs_errors' => 'Λάθη PHPCS', - 'phplint_errors' => 'Λάθη Lint', - 'phpunit_errors' => 'Λάθη PHPUnit ', - 'phpdoccheck_warnings' => 'Χαμένα Docblocks', - 'issues' => 'Θέματα', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Ανιχνευτής Αντιγραφής/Επικόλλησης', - 'phpcs' => 'Sniffer Κώδικα PHP', - 'phpdoccheck' => 'Χαμένα Docblocks', - 'phpmd' => 'Aνιχνευτής PHP Mess', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - - 'file' => 'Αρχείο', - 'line' => 'Γραμμή', - 'class' => 'Κατηγορία', - 'method' => 'Μέθοδος', - 'message' => 'Μήνυμα', - 'start' => 'Έναρξη', - 'end' => 'Τέλος', - 'from' => 'Από', - 'to' => 'Προς', - 'result' => 'Αποτέλεσμα', - 'ok' => 'ΟΚ', - 'took_n_seconds' => 'Χρειάστηκαν %d δευτερόλεπτα', - 'build_created' => 'Η κατασκευή δημιουργήθηκε', - 'build_started' => 'Η κατασκευή άρχισε', - 'build_finished' => 'Η κατασκευή ολοκληρώθηκε', - 'test_message' => 'Message', - 'test_no_message' => 'No message', - 'test_success' => 'Successful: %d', - 'test_fail' => 'Failures: %d', - 'test_skipped' => 'Skipped: %d', - 'test_error' => 'Errors: %d', - 'test_todo' => 'Todos: %d', - 'test_total' => '%d test(s)', - - // Users - 'name' => 'Όνομα', - 'password_change' => 'Κωδικός πρόσβασης (αφήστε κενό αν δεν θέλετε να αλλάξετε)', - 'save' => 'Αποθήκευση »', - 'update_your_details' => 'Ενημερώστε τα στοιχεία σας', - 'your_details_updated' => 'Τα στοιχεία σας έχουν ενημερωθεί.', - 'add_user' => 'Προσθήκη χρήστη', - 'is_admin' => 'Είναι διαχειριστής;', - 'yes' => 'Ναι', - 'no' => 'Όχι', - 'edit' => 'Επεξεργασία', - 'edit_user' => 'Επεξεργασία χρήστη', - 'delete_user' => 'Διαγραφή χρήστη', - 'user_n_not_found' => 'Ο χρήστης με αριθμό %d δεν υπάρχει.', - 'is_user_admin' => 'Είναι αυτός ο χρήστης διαχειριστής;', - 'save_user' => 'Αποθήκευση χρήστη', - - // Settings: - 'settings_saved' => 'Οι ρυθμίσεις σας έχουν αποθηκευτεί.', - 'settings_check_perms' => 'Οι ρυθμίσεις σας δεν αποθηκεύτηκαν, ελέγξτε τα δικαιώματα του αρχείου σας config.yml.', - 'settings_cannot_write' => 'Το PHPCI δεν μπορεί να γράψει στο αρχείο config.yml, οι ρυθμίσεις ενδέχεται να μην αποθηκευτούν σωστά -μέχρι να διορθωθεί.', - 'settings_github_linked' => 'Ο λογαριασμός σας GitHub έχει συνδεθεί.', - 'settings_github_not_linked' => 'Ο λογαριασμός σας Github δεν μπόρεσε να συνδεθεί.', - 'build_settings' => 'Ρυθμίσεις κατασκευής', - 'github_application' => 'GitHub Εφαρμογή', - 'github_sign_in' => 'Πριν αρχίσετε να χρησιμοποιείτε το GitHub, θα πρέπει να συνδεθείται και να δώσει -το PHPCI πρόσβαση στο λογαριασμό σας.', - 'github_phpci_linked' => 'Το PHPCI συνδέθηκε με επιτυχία με το λογαριασμό Github.', - 'github_where_to_find' => 'Πού να βρείτε αυτά ...', - 'github_where_help' => 'Εάν έχετε στην κατοχή σας την εφαρμογή που θέλετε να χρησιμοποιήσετε, μπορείτε να βρείτε αυτές τις πληροφορίες στην περιοχή -Ρυθμίσεις εφαρμογών ', - - 'email_settings' => 'Ρυθμίσεις email', - 'email_settings_help' => 'Πριν το PHPCI μπορεί να στείλει μηνύματα ηλεκτρονικού ταχυδρομείου για την κατάσταση κατασκευής, -θα πρέπει να διαμορφώσετε τις ρυθμίσεις SMTP παρακάτω.', - - 'application_id' => 'Αναγνωριστικό εφαρμογής', - 'application_secret' => 'Μυστική Εφαρμογή', - - 'smtp_server' => 'Διακομισής SMTP', - 'smtp_port' => 'Θύρα SMTP', - 'smtp_username' => 'Όνομα χρήστη SMTP', - 'smtp_password' => 'Κωδικός πρόσβασης SMTP', - 'from_email_address' => 'Εmail διεύθυνση αποστολέα', - 'default_notification_address' => 'Προεπιλεγμένη διεύθυνση ειδοποίησης ηλεκτρονικού ταχυδρομείου ', - 'use_smtp_encryption' => 'Εφαρμογή SMTP κρυπτογράφησης;', - 'none' => 'Κανένα', - 'ssl' => 'Κρυπτογράφηση SSL', - 'tls' => 'Κρυπτογράφηση TLS', - - 'failed_after' => 'Να θεωρηθεί μια κατασκευή αποτυχημένη μετά ', - '5_mins' => '5 λεπτά', - '15_mins' => '15 λεπτά', - '30_mins' => '30 λεπτά', - '1_hour' => '1 ώρα', - '3_hours' => '3 ώρες', - - // Plugins - 'cannot_update_composer' => 'To PHPCI δεν μπορεί να ενημερώσει to composer.json για σας, γιατί δεν είναι εγγράψιμο.', - 'x_has_been_removed' => '%s έχει αφαιρεθεί.', - 'x_has_been_added' => '%s προσθέιηκε στο αρχείο composer.json για εσάς και θα εγκατασταθεί την επόμενη φορά -που θα τρέξετε την ενημέρωση για το composer.', - 'enabled_plugins' => 'Ενεργοποιημένα πρόσθετα', - 'provided_by_package' => 'Παρέχεται από πακέτο', - 'installed_packages' => 'Εγκατεστημένα πακέτα', - 'suggested_packages' => 'Προτεινόμενα πακέτα', - 'title' => 'Τίτλος', - 'description' => 'Περιγραφή', - 'version' => 'Έκδοση', - 'install' => 'Εγκατάσταση »', - 'remove' => 'Αφαίρεση »', - 'search_packagist_for_more' => 'Αναζήτηση στο Packagist για περισσότερα πακέτα', - 'search' => 'Αναζήτηση »', - - // Installer - 'installation_url' => 'Σύνδεσμος URL εγκατάστασης του PHPCI', - 'db_host' => 'Φιλοξενία βάσης δεδομένων', - 'db_name' => 'Όνομα βάσης δεδομένων', - 'db_user' => 'Όνομα χρήστη βάσης δεδομένων', - 'db_pass' => 'Κωδικός πρόσβασης βάσης δεδομένων', - 'admin_name' => 'Όνομα διαχειριστή', - 'admin_pass' => 'Κωδικός πρόσβασης διαχειριστή', - 'admin_email' => 'Διεύθυνση email διαχειριστή', - 'config_path' => 'Διαδρομή αρχείου ρυθμίσεων', - 'install_phpci' => 'Εγκατάσταση PHPCI', - 'welcome_to_phpci' => 'Καλώς ήρθατε στο PHPCI', - 'please_answer' => 'Παρακαλώ απαντήστε στις ακόλουθες ερωτήσεις:', - 'phpci_php_req' => 'Το PHPCI απαιτεί τουλάχιστον την έκδοση PHP 5.3.8 για να λειτουργήσει', - 'extension_required' => 'Απαιτούμενη επέκταση: %s ', - 'function_required' => 'Το PHPCI πρέπει να είναι σε θέση να καλέσει την %s() συνάρτηση. Είναι απενεργοποιημένη στο php.ini;', - 'requirements_not_met' => 'Το PHPCI δεν μπορεί να εγκατασταθεί, καθώς όλες οι απαιτήσεις δεν ικανοποιούνται. -Παρακαλούμε διαβάστε τα παραπάνω λάθη πριν συνεχίσετε.', - 'must_be_valid_email' => 'Πρέπει να είναι μια έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου.', - 'must_be_valid_url' => 'Πρέπει να είναι μια έγκυρη διεύθυνση URL.', - 'enter_name' => 'Όνομα διαχειριστή: ', - 'enter_email' => 'Ηλ. Διεύθυνση διαχειριστή: ', - 'enter_password' => 'Κωδικός πρόσβασης διαχειριστή: ', - 'enter_phpci_url' => 'Ο URL σύνδεσμος σας για το PHPCI ("http://phpci.local" για παράδειγμα): ', - - 'enter_db_host' => 'Παρακαλώ εισάγετε τον MySQL οικοδεσπότη σας [localhost]: ', - 'enter_db_name' => 'Παρακαλώ εισάγετε το όνομα της MySQL βάσης δεδομένων σας [phpci]: ', - 'enter_db_user' => 'Παρακαλώ εισάγετε το όνομα χρήστη της MySQL σας [phpci]: ', - 'enter_db_pass' => 'Παρακαλώ εισάγετε τον κωδικό χρήστη της MySQL σας: ', - 'could_not_connect' => 'Το PHPCI δεν μπόρεσε να συνδεθεί με την MySQL με τα στοχεία που δώσατε. Παρακαλώ δοκιμάστε ξανά.', - 'setting_up_db' => 'Γίνεται ρύθμιση της βάσης δεδομένων σας ...', - 'user_created' => 'Λογαριασμός χρήστη δημιουργήθηκε!', - 'failed_to_create' => 'Το PHPCI απέτυχε να δημιουργήσει το λογαριασμό διαχειριστή σας.', - 'config_exists' => 'Το αρχείο ρυθμίσεων PHPCI υπάρχει και δεν είναι άδειο.', - 'update_instead' => 'Εάν προσπαθούσατε να ενημερώσετε PHPCI, παρακαλούμε χρησιμοποιήστε καλύτερα το phpci:update αντ \'αυτού.', - - // Update - 'update_phpci' => 'Ενημέρωστε την βάση δεδομένων ώστε να αντικατοπτρίζει τροποποιημένα μοντέλα.', - 'updating_phpci' => 'Γίνεται ενημέρωση της βάσης δεδομένων PHPCI:', - 'not_installed' => 'Το PHPCI δεν φένεται να είναι εγκατεστημένο', - 'install_instead' => 'Παρακαλούμε εγκαταστήστε το PHPCI καλύτερα με το phpci:install αντ \'αυτού.', - - // Poll Command - 'poll_github' => 'Δημοσκόπηση στο GitHub για να ελέγξετε αν θα πρέπει να ξεκινήσει μια κατασκευή.', - 'no_token' => 'Δεν βρέθηκε GitHub token', - 'finding_projects' => 'Αναζήτηση έργων για δημοσκόπηση', - 'found_n_projects' => 'Βρέθηκαν %d έργα', - 'last_commit_is' => 'H τελευταία συνεισφορά στο GitHub για %s είναι %s', - 'adding_new_build' => 'Τελευταία συνεισφορά είναι διαφορετική από τη βάση δεδομένων, γίνεται προσθήκη νέας κατασκευής.', - 'finished_processing_builds' => 'Ολοκληρώθηκε η επεξεργασία κατασκευής.', - - // Create Admin - 'create_admin_user' => 'Δημιουργήστε ένα χρήστη διαχειριστή', - 'incorrect_format' => 'Λανθασμένη μορφοποίηση', - - // Create Build Command - 'create_build_project' => 'Create a build for a project', - 'project_id_argument' => 'A project ID', - 'commit_id_option' => 'Commit ID to build', - 'branch_name_option' => 'Branch to build', - - // Run Command - 'run_all_pending' => 'Εκτελέστε όλες τις εκκρεμείς PHPCI κατασκευές.', - 'finding_builds' => 'Αναζήτηση κατασκευών για επεξεργασία', - 'found_n_builds' => 'Βρέθηκαν %d κατασκευές', - 'skipping_build' => 'Παράκαμψη κατασκευής %d - Η διαδικασία κατασκευής του έργου βρίσκεται ήδη σε εξέλιξη.', - 'marked_as_failed' => 'Η κατασκεύη %d επισημάνθηκε ως αποτυχημένη λόγω χρονικού ορίου', - - // Builder - 'missing_phpci_yml' => 'Το έργο δεν περιέχει το αρχείο phpci.yml ή είναι άδειο.', - 'build_success' => 'ΚΑΤΑΣΚΕΥΗ ΕΠΙΤΥΧΗΣ', - 'build_failed' => 'ΚΑΤΑΣΚΕΥΗ ΑΠΕΤΥΧΕ', - 'removing_build' => 'Γίνεται αφαίρεση κατασκευής', - 'exception' => 'Εξαίρεση:', - 'could_not_create_working' => 'Αδυναμία δημιουργίας αντίγραφου εργασίας.', - 'working_copy_created' => 'Αντίγραφο εργασίας που δημιουργήθηκαν: %s', - 'looking_for_binary' => 'Αναζήτηση για δυαδικό: %s', - 'found_in_path' => 'Βρέθηκε στο %s: %s', - 'running_plugin' => 'ΤΡΕΧΩΝ ΠΡΟΣΘΕΤΟ: %s', - 'plugin_success' => 'ΠΡΟΣΘΕΤΟ: ΕΠΙΤΥΧΙΑ', - 'plugin_failed' => 'ΠΡΟΣΘΕΤΟ: ΑΠΟΤΥΧΙΑ', - 'plugin_missing' => 'Το πρόσθετο δεν υπάρχει: %s', - 'tap_version' => 'Το TapParser υποστηρίζει μόνο το TAP έκδοση 13', - 'tap_error' => 'Μη έγκυρη συμβολοσειρά TAP, ο αριθμός των δοκιμών δεν ταιριάζει με την καθορισμένη καταμέτρηση της δοκιμής.', - - // Build Plugins: - 'no_tests_performed' => 'Δεν έγιναν δοκιμές.', - 'could_not_find' => 'Δεν ήταν δυνατή η εύρεση του %s', - 'no_campfire_settings' => 'Δεν έχουν δωθεί παράμετροι της σύνδεσης για το πρόσθετο Campfire', - 'failed_to_wipe' => 'Αποτυχία πλήρους διαγραφής του καταλόγου %s πριν την αντιγραφή', - 'passing_build' => 'Επιτυχημένη κατασκευή', - 'failing_build' => 'Αποτυχημένη κατασκευή', - 'log_output' => 'Σύνδεση εξόδου:', - 'n_emails_sent' => 'Στάλθηκαν %d emails ', - 'n_emails_failed' => 'Δεν στάλθηκαν %d emails ', - 'unable_to_set_env' => 'Δεν είναι δυνατός ο ορισμος μεταβλητής περιβάλλοντος', - 'tag_created' => 'Ετικέτα δημιουργήθηκε από PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% χτισμένο σε %BUILD_URI%', - 'hipchat_settings' => 'Παρακαλώ ορίστε δωμάτιο και authToken για το πρόσθετο hipchat_notify', - 'irc_settings' => 'Θα πρέπει να ρυθμίσετε ένα διακομιστή, το δωμάτιο και το ψευδώνυμο.', - 'invalid_command' => 'Μη έγκυρη εντολή', - 'import_file_key' => 'Η δήλωση εισαγωγής πρέπει να περιέχει ένα κλειδί "αρχείο"', - 'cannot_open_import' => 'Δεν είναι δυνατό το άνοιγμα του SQL αρχείο εισαγωγής: %s ', - 'unable_to_execute' => 'Δεν είναι δυνατή η εκτέλεση του αρχείου SQL', - 'phar_internal_error' => 'Phar Πρόσθετο Εσωτερικό σφάλμα', - 'build_file_missing' => 'Καθορισμένο αρχείο κατασκευής δεν υπάρχει.', - 'property_file_missing' => 'Καθορισμένο αρχείο ιδιοκτησίας δεν υπάρχει.', - 'could_not_process_report' => 'Δεν ήταν δυνατή η επεξεργασία της έκθεσης που δημιουργείται από αυτό το εργαλείο.', - 'shell_not_enabled' => 'Το πρόσθετο για το κέλυφος δεν είναι ενεργοποιημένο. Παρακαλούμε ενεργοποιήστε το μέσω του αρχείου config.yml.' -); diff --git a/PHPCI/Languages/lang.en.php b/PHPCI/Languages/lang.en.php deleted file mode 100644 index 63df75d2..00000000 --- a/PHPCI/Languages/lang.en.php +++ /dev/null @@ -1,444 +0,0 @@ - 'English', - 'language' => 'Language', - - // Log in: - 'log_in_to_phpci' => 'Log in to PHPCI', - 'login_error' => 'Incorrect email address or password', - 'forgotten_password_link' => 'Forgotten your password?', - 'reset_emailed' => 'We\'ve emailed you a link to reset your password.', - 'reset_header' => 'Don\'t worry!
Just enter your email address below and we\'ll email - you a link to reset your password.', - 'reset_email_address' => 'Enter your email address:', - 'reset_send_email' => 'Email password reset', - 'reset_enter_password' => 'Please enter a new password', - 'reset_new_password' => 'New password:', - 'reset_change_password' => 'Change password', - 'reset_no_user_exists' => 'No user exists with that email address, please try again.', - 'reset_email_body' => 'Hi %s, - -You have received this email because you, or someone else, has requested a password reset for PHPCI. - -If this was you, please click the following link to reset your password: %ssession/reset-password/%d/%s - -Otherwise, please ignore this email and no action will be taken. - -Thank you, - -PHPCI', - - 'reset_email_title' => 'PHPCI Password Reset for %s', - 'reset_invalid' => 'Invalid password reset request.', - 'email_address' => 'Email Address', - 'login' => 'Login / Email Address', - 'password' => 'Password', - 'log_in' => 'Log in', - - - // Top Nav - 'toggle_navigation' => 'Toggle Navigation', - 'n_builds_pending' => '%d builds pending', - 'n_builds_running' => '%d builds running', - 'edit_profile' => 'Edit Profile', - 'sign_out' => 'Sign Out', - 'branch_x' => 'Branch: %s', - 'created_x' => 'Created: %s', - 'started_x' => 'Started: %s', - - // Sidebar - 'hello_name' => 'Hello, %s', - 'dashboard' => 'Dashboard', - 'admin_options' => 'Admin Options', - 'add_project' => 'Add Project', - 'settings' => 'Settings', - 'manage_users' => 'Manage Users', - 'plugins' => 'Plugins', - 'view' => 'View', - 'build_now' => 'Build Now', - 'edit_project' => 'Edit Project', - 'delete_project' => 'Delete Project', - - // Project Summary: - 'no_builds_yet' => 'No builds yet!', - 'x_of_x_failed' => '%d out of the last %d builds failed.', - 'x_of_x_failed_short' => '%d / %d failed.', - 'last_successful_build' => ' The last successful build was %s.', - 'never_built_successfully' => ' This project has never built successfully.', - 'all_builds_passed' => 'All of the last %d builds passed.', - 'all_builds_passed_short' => '%d / %d passed.', - 'last_failed_build' => ' The last failed build was %s.', - 'never_failed_build' => ' This project has never failed a build.', - 'view_project' => 'View Project', - - // Timeline: - 'latest_builds' => 'Latest Builds', - 'pending' => 'Pending', - 'running' => 'Running', - 'success' => 'Success', - 'successful' => 'Successful', - 'failed' => 'Failed', - 'manual_build' => 'Manual Build', - - // Add/Edit Project: - 'new_project' => 'New Project', - 'project_x_not_found' => 'Project with ID %d does not exist.', - 'project_details' => 'Project Details', - 'public_key_help' => 'To make it easier to get started, we\'ve generated an SSH key pair for you to use - for this project. To use it, just add the following public key to the "deploy keys" section - of your chosen source code hosting platform.', - 'select_repository_type' => 'Select repository type...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'Remote URL', - 'local' => 'Local Path', - 'hg' => 'Mercurial', - 'svn' => 'Subversion', - - 'where_hosted' => 'Where is your project hosted?', - 'choose_github' => 'Choose a GitHub repository:', - - 'repo_name' => 'Repository Name / URL (Remote) or Path (Local)', - 'project_title' => 'Project Title', - 'project_private_key' => 'Private key to use to access repository - (leave blank for local and/or anonymous remotes)', - 'build_config' => 'PHPCI build config for this project - (if you cannot add a phpci.yml file in the project repository)', - 'default_branch' => 'Default branch name', - 'allow_public_status' => 'Enable public status page and image for this project?', - 'archived' => 'Archived', - 'archived_menu' => 'Archived', - 'save_project' => 'Save Project', - - 'error_mercurial' => 'Mercurial repository URL must be start with http:// or https://', - 'error_remote' => 'Repository URL must be start with git://, http:// or https://', - 'error_gitlab' => 'GitLab Repository name must be in the format "user@domain.tld:owner/repo.git"', - 'error_github' => 'Repository name must be in the format "owner/repo"', - 'error_bitbucket' => 'Repository name must be in the format "owner/repo"', - 'error_path' => 'The path you specified does not exist.', - - // View Project: - 'all_branches' => 'All Branches', - 'builds' => 'Builds', - 'id' => 'ID', - 'date' => 'Date', - 'project' => 'Project', - 'commit' => 'Commit', - 'branch' => 'Branch', - 'status' => 'Status', - 'prev_link' => '« Prev', - 'next_link' => 'Next »', - 'public_key' => 'Public Key', - 'delete_build' => 'Delete Build', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'To automatically build this project when new commits are pushed, add the URL below - as a new "Webhook" in the Webhooks - and Services section of your GitHub repository.', - - 'webhooks_help_gitlab' => 'To automatically build this project when new commits are pushed, add the URL below - as a "WebHook URL" in the Web Hooks section of your GitLab repository.', - - 'webhooks_help_bitbucket' => 'To automatically build this project when new commits are pushed, add the URL below - as a "POST" service in the - - Services section of your Bitbucket repository.', - - // View Build - 'errors' => 'Errors', - 'information' => 'Information', - - 'build_x_not_found' => 'Build with ID %d does not exist.', - 'build_n' => 'Build %d', - 'rebuild_now' => 'Rebuild Now', - - - 'committed_by_x' => 'Committed by %s', - 'commit_id_x' => 'Commit: %s', - - 'chart_display' => 'This chart will display once the build has completed.', - - 'build' => 'Build', - 'lines' => 'Lines', - 'comment_lines' => 'Comment Lines', - 'noncomment_lines' => 'Non-Comment Lines', - 'logical_lines' => 'Logical Lines', - 'lines_of_code' => 'Lines of Code', - 'build_log' => 'Build Log', - 'quality_trend' => 'Quality Trend', - 'codeception_errors' => 'Codeception Errors', - 'phpmd_warnings' => 'PHPMD Warnings', - 'phpcs_warnings' => 'PHPCS Warnings', - 'phpcs_errors' => 'PHPCS Errors', - 'phplint_errors' => 'Lint Errors', - 'phpunit_errors' => 'PHPUnit Errors', - 'phpdoccheck_warnings' => 'Missing Docblocks', - 'issues' => 'Issues', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Missing Docblocks', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - 'technical_debt' => 'Technical Debt', - 'behat' => 'Behat', - - 'codeception_feature' => 'Feature', - 'codeception_suite' => 'Suite', - 'codeception_time' => 'Time', - 'codeception_synopsis' => '%1$d tests carried out in %2$f seconds. - %3$d failures.', - - 'file' => 'File', - 'line' => 'Line', - 'class' => 'Class', - 'method' => 'Method', - 'message' => 'Message', - 'start' => 'Start', - 'end' => 'End', - 'from' => 'From', - 'to' => 'To', - 'result' => 'Result', - 'ok' => 'OK', - 'took_n_seconds' => 'Took %d seconds', - 'build_created' => 'Build Created', - 'build_started' => 'Build Started', - 'build_finished' => 'Build Finished', - 'test_message' => 'Message', - 'test_no_message' => 'No message', - 'test_success' => 'Successful: %d', - 'test_fail' => 'Failures: %d', - 'test_skipped' => 'Skipped: %d', - 'test_error' => 'Errors: %d', - 'test_todo' => 'Todos: %d', - 'test_total' => '%d test(s)', - - // Users - 'name' => 'Name', - 'password_change' => 'Password (leave blank if you don\'t want to change)', - 'save' => 'Save »', - 'update_your_details' => 'Update your details', - 'your_details_updated' => 'Your details have been updated.', - 'add_user' => 'Add User', - 'is_admin' => 'Is Admin?', - 'yes' => 'Yes', - 'no' => 'No', - 'edit' => 'Edit', - 'edit_user' => 'Edit User', - 'delete_user' => 'Delete User', - 'user_n_not_found' => 'User with ID %d does not exist.', - 'is_user_admin' => 'Is this user an administrator?', - 'save_user' => 'Save User', - - // Settings: - 'settings_saved' => 'Your settings have been saved.', - 'settings_check_perms' => 'Your settings could not be saved, check the permissions of your config.yml file.', - 'settings_cannot_write' => 'PHPCI cannot write to your config.yml file, settings may not be saved properly - until this is rectified.', - 'settings_github_linked' => 'Your GitHub account has been linked.', - 'settings_github_not_linked' => 'Your GitHub account could not be linked.', - 'build_settings' => 'Build Settings', - 'github_application' => 'GitHub Application', - 'github_sign_in' => 'Before you can start using GitHub, you need to sign in and grant - PHPCI access to your account.', - 'github_phpci_linked' => 'PHPCI is successfully linked to GitHub account.', - 'github_where_to_find' => 'Where to find these...', - 'github_where_help' => 'If you own the application you would like to use, you can find this information within your - applications settings area.', - - 'email_settings' => 'Email Settings', - 'email_settings_help' => 'Before PHPCI can send build status emails, - you need to configure your SMTP settings below.', - - 'application_id' => 'Application ID', - 'application_secret' => 'Application Secret', - - 'smtp_server' => 'SMTP Server', - 'smtp_port' => 'SMTP Port', - 'smtp_username' => 'SMTP Username', - 'smtp_password' => 'SMTP Password', - 'from_email_address' => 'From Email Address', - 'default_notification_address' => 'Default Notification Email Address', - 'use_smtp_encryption' => 'Use SMTP Encryption?', - 'none' => 'None', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Consider a build failed after', - '5_mins' => '5 Minutes', - '15_mins' => '15 Minutes', - '30_mins' => '30 Minutes', - '1_hour' => '1 Hour', - '3_hours' => '3 Hours', - - // Plugins - 'cannot_update_composer' => 'PHPCI cannot update composer.json for you as it is not writable.', - 'x_has_been_removed' => '%s has been removed.', - 'x_has_been_added' => '%s has been added to composer.json for you and will be installed next time - you run composer update.', - 'enabled_plugins' => 'Enabled Plugins', - 'provided_by_package' => 'Provided By Package', - 'installed_packages' => 'Installed Packages', - 'suggested_packages' => 'Suggested Packages', - 'title' => 'Title', - 'description' => 'Description', - 'version' => 'Version', - 'install' => 'Install »', - 'remove' => 'Remove »', - 'search_packagist_for_more' => 'Search Packagist for more packages', - 'search' => 'Search »', - - // Summary plugin - 'build-summary' => 'Summary', - 'stage' => 'Stage', - 'duration' => 'Duration', - 'plugin' => 'Plugin', - 'stage_setup' => 'Setup', - 'stage_test' => 'Test', - 'stage_complete' => 'Complete', - 'stage_success' => 'Success', - 'stage_failure' => 'Failure', - 'stage_broken' => 'Broken', - 'stage_fixed' => 'Fixed', - - // Installer - 'installation_url' => 'PHPCI Installation URL', - 'db_host' => 'Database Host', - 'db_name' => 'Database Name', - 'db_user' => 'Database Username', - 'db_pass' => 'Database Password', - 'admin_name' => 'Admin Name', - 'admin_pass' => 'Admin Password', - 'admin_email' => 'Admin Email Address', - 'config_path' => 'Config File Path', - 'install_phpci' => 'Install PHPCI', - 'welcome_to_phpci' => 'Welcome to PHPCI', - 'please_answer' => 'Please answer the following questions:', - 'phpci_php_req' => 'PHPCI requires at least PHP 5.3.8 to function.', - 'extension_required' => 'Extension required: %s', - 'function_required' => 'PHPCI needs to be able to call the %s() function. Is it disabled in php.ini?', - 'requirements_not_met' => 'PHPCI cannot be installed, as not all requirements are met. - Please review the errors above before continuing.', - 'must_be_valid_email' => 'Must be a valid email address.', - 'must_be_valid_url' => 'Must be a valid URL.', - 'enter_name' => 'Admin Name: ', - 'enter_email' => 'Admin Email: ', - 'enter_password' => 'Admin Password: ', - 'enter_phpci_url' => 'Your PHPCI URL ("http://phpci.local" for example): ', - - 'enter_db_host' => 'Please enter your MySQL host [localhost]: ', - 'enter_db_name' => 'Please enter your MySQL database name [phpci]: ', - 'enter_db_user' => 'Please enter your MySQL username [phpci]: ', - 'enter_db_pass' => 'Please enter your MySQL password: ', - 'could_not_connect' => 'PHPCI could not connect to MySQL with the details provided. Please try again.', - 'setting_up_db' => 'Setting up your database... ', - 'user_created' => 'User account created!', - 'failed_to_create' => 'PHPCI failed to create your admin account.', - 'config_exists' => 'The PHPCI config file exists and is not empty.', - 'update_instead' => 'If you were trying to update PHPCI, please use phpci:update instead.', - - // Update - 'update_phpci' => 'Update the database to reflect modified models.', - 'updating_phpci' => 'Updating PHPCI database: ', - 'not_installed' => 'PHPCI does not appear to be installed.', - 'install_instead' => 'Please install PHPCI via phpci:install instead.', - - // Poll Command - 'poll_github' => 'Poll GitHub to check if we need to start a build.', - 'no_token' => 'No GitHub token found', - 'finding_projects' => 'Finding projects to poll', - 'found_n_projects' => 'Found %d projects', - 'last_commit_is' => 'Last commit to GitHub for %s is %s', - 'adding_new_build' => 'Last commit is different to database, adding new build.', - 'finished_processing_builds' => 'Finished processing builds.', - - // Create Admin - 'create_admin_user' => 'Create an admin user', - 'incorrect_format' => 'Incorrect format', - - // Create Build Command - 'create_build_project' => 'Create a build for a project', - 'project_id_argument' => 'A project ID', - 'commit_id_option' => 'Commit ID to build', - 'branch_name_option' => 'Branch to build', - 'add_to_queue_failed' => 'Build created successfully, but failed to add to build queue. This usually happens - when PHPCI is set to use a beanstalkd server that does not exist, - or your beanstalkd server has stopped.', - - // Run Command - 'run_all_pending' => 'Run all pending PHPCI builds.', - 'finding_builds' => 'Finding builds to process', - 'found_n_builds' => 'Found %d builds', - 'skipping_build' => 'Skipping Build %d - Project build already in progress.', - 'marked_as_failed' => 'Build %d marked as failed due to timeout.', - - // Builder - 'missing_phpci_yml' => 'This project does not contain a phpci.yml file, or it is empty.', - 'build_success' => 'BUILD SUCCESS', - 'build_failed' => 'BUILD FAILED', - 'removing_build' => 'Removing Build.', - 'exception' => 'Exception: ', - 'could_not_create_working' => 'Could not create a working copy.', - 'working_copy_created' => 'Working copy created: %s', - 'looking_for_binary' => 'Looking for binary: %s', - 'found_in_path' => 'Found in %s: %s', - 'running_plugin' => 'RUNNING PLUGIN: %s', - 'plugin_success' => 'PLUGIN: SUCCESS', - 'plugin_failed' => 'PLUGIN: FAILED', - 'plugin_missing' => 'Plugin does not exist: %s', - 'tap_version' => 'TapParser only supports TAP version 13', - 'tap_error' => 'Invalid TAP string, number of tests does not match specified test count.', - - // Build Plugins: - 'no_tests_performed' => 'No tests have been performed.', - 'could_not_find' => 'Could not find %s', - 'no_campfire_settings' => 'No connection parameters given for Campfire plugin', - 'failed_to_wipe' => 'Failed to wipe existing directory %s before copy', - 'passing_build' => 'Passing Build', - 'failing_build' => 'Failing Build', - 'log_output' => 'Log Output: ', - 'n_emails_sent' => '%d emails sent.', - 'n_emails_failed' => '%d emails failed to send.', - 'unable_to_set_env' => 'Unable to set environment variable', - 'tag_created' => 'Tag created by PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% built at %BUILD_URI%', - 'hipchat_settings' => 'Please define room and authToken for hipchat_notify plugin', - 'irc_settings' => 'You must configure a server, room and nick.', - 'invalid_command' => 'Invalid command', - 'import_file_key' => 'Import statement must contain a \'file\' key', - 'cannot_open_import' => 'Cannot open SQL import file: %s', - 'unable_to_execute' => 'Unable to execute SQL file', - 'phar_internal_error' => 'Phar Plugin Internal Error', - 'build_file_missing' => 'Specified build file does not exist.', - 'property_file_missing' => 'Specified property file does not exist.', - 'could_not_process_report' => 'Could not process the report generated by this tool.', - 'shell_not_enabled' => 'The shell plugin is not enabled. Please enable it via config.yml.', - - - // Error Levels: - 'critical' => 'Critical', - 'high' => 'High', - 'normal' => 'Normal', - 'low' => 'Low', - - // Plugins that generate errors: - 'php_mess_detector' => 'PHP Mess Detector', - 'php_code_sniffer' => 'PHP Code Sniffer', - 'php_unit' => 'PHP Unit', - 'php_cpd' => 'PHP Copy/Paste Detector', - 'php_docblock_checker' => 'PHP Docblock Checker', - 'behat' => 'Behat', - 'technical_debt' => 'Technical Debt', - -); diff --git a/PHPCI/Languages/lang.es.php b/PHPCI/Languages/lang.es.php deleted file mode 100644 index 1b7b33f7..00000000 --- a/PHPCI/Languages/lang.es.php +++ /dev/null @@ -1,387 +0,0 @@ - 'Español', - 'language' => 'Lenguaje', - - // Log in: - 'log_in_to_phpci' => 'Ingresar a PHPCI', - 'login_error' => 'Email o contraseña incorrectos', - 'forgotten_password_link' => '¿Olvidaste tu contraseña?', - 'reset_emailed' => 'Te hemos enviado un email para reiniciar tu contraseña.', - 'reset_header' => '¡No te preocupes!
Solo tienes que ingresar tu dirección de email - y te enviaremos por email un enlace para reiniciar tu contraseña.', - 'reset_email_address' => 'Ingresa tu dirección de email:', - 'reset_send_email' => 'Enviar enlace', - 'reset_enter_password' => 'Ingresa una nueva contraseña', - 'reset_new_password' => 'Nueva contraseña:', - 'reset_change_password' => 'Cambiar contraseña', - 'reset_no_user_exists' => 'No existe ningún usuario con ese email, por favor intenta nuevamente.', - 'reset_email_body' => 'Hola %s, - -Has recibido este correo porque tú, o alguien más, ha solicitado reiniciar la contraseña de PHPCI - -Si fuiste tú, por favor haz click en el siguiente enlace para reiniciar tu contraseña: %ssession/reset-password/%d/%s - -De lo contrario, por favor ignora este correo y ninguna acción será realizada. - -Gracias, - -PHPCI', - - 'reset_email_title' => 'Reiniciar contraseña de PHPCI para %s', - 'reset_invalid' => 'Pedido inválido.', - 'email_address' => 'Dirección de email', - 'password' => 'Contraseña', - 'log_in' => 'Ingresar', - - - // Top Nav - 'toggle_navigation' => 'Activar navegación', - 'n_builds_pending' => '%d builds pendientes', - 'n_builds_running' => '%d builds ejecutándose', - 'edit_profile' => 'Editar Perfil', - 'sign_out' => 'Cerrar Sesión', - 'branch_x' => 'Rama: %s', - 'created_x' => 'Creada el: %s', - 'started_x' => 'Comenzó: %s', - - // Sidebar - 'hello_name' => 'Hola, %s', - 'dashboard' => 'Escritorio', - 'admin_options' => 'Opciones de Admin.', - 'add_project' => 'Agregar Proyecto', - 'settings' => 'Configuración', - 'manage_users' => 'Administrar Usuarios', - 'plugins' => 'Plugins', - 'view' => 'Vista', - 'build_now' => 'Ejecutar Build', - 'edit_project' => 'Editar Proyecto', - 'delete_project' => 'Eliminar Proyecto', - - // Project Summary: - 'no_builds_yet' => '¡No existen builds aún!', - 'x_of_x_failed' => '%d de los últimos %d builds fallaron.', - 'x_of_x_failed_short' => '%d / %d fallaron.', - 'last_successful_build' => ' El último build exitoso fue %s.', - 'never_built_successfully' => ' Este proyecto nunca tuvo un build exitoso.', - 'all_builds_passed' => 'Todos los últimos %d builds pasaron.', - 'all_builds_passed_short' => '%d / %d pasaron.', - 'last_failed_build' => ' El último build en fallar fue %s.', - 'never_failed_build' => ' Este proyecto no tiene ningún build fallido.', - 'view_project' => 'Ver Proyecto', - - // Timeline: - 'latest_builds' => 'Últimos builds', - 'pending' => 'Pediente', - 'running' => 'Ejecutando', - 'success' => 'Éxito', - 'successful' => 'Exitoso', - 'failed' => 'Falló', - 'manual_build' => 'Build Manual', - - // Add/Edit Project: - 'new_project' => 'Nuevo Proyecto', - 'project_x_not_found' => 'El Proyecto con ID %d no existe.', - 'project_details' => 'Detalles del Proyecto', - 'public_key_help' => 'Para facilitarte, hemos generado un par de llaves SSH para que uses en este proyecto. - Para usarlo, sólo agrega la siguiente llave pública a la sección de "deploy keys" - de tu plataforma de hosting de versionado de código.', - 'select_repository_type' => 'Selecciona tipo de repositorio...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'URL Remota', - 'local' => 'Path local', - 'hg' => 'Mercurial', - 'svn' => 'Subversion', - - 'where_hosted' => '¿Dónde está alojado tu proyecto?', - 'choose_github' => 'Selecciona un repositorio de GitHub:', - - 'repo_name' => 'Nombre del repositorio / URL (Remoto) o Ruta (Local)', - 'project_title' => 'Titulo del proyecto', - 'project_private_key' => 'Clave privada a usar para acceder al repositorio - (dejar en blanco para remotos locales o anónimos)', - 'build_config' => 'Configuración PHPCI para builds del proyecto - (en caso que no puedas agregar el archivo phpci.yml al repositorio)', - 'default_branch' => 'Nombre de la rama por defecto', - 'allow_public_status' => '¿Activar página pública con el estado del proyecto?', - 'archived' => 'Archivado', - 'archived_menu' => 'Archivado', - 'save_project' => 'Guardar Proyecto', - - 'error_mercurial' => 'La URL del repositorio de Mercurial debe comenzar con http:// or https://', - 'error_remote' => 'La URL del repositorio debe comenzar con git://, http:// or https://', - 'error_gitlab' => 'El nombre del repositorio de GitLab debe tener el formato "user@domain.tld:owner/repo.git"', - 'error_github' => 'El nombre del repositorio debe tener el formato "owner/repo"', - 'error_bitbucket' => 'El nombre del repo debe tener el formato "owner/repo"', - 'error_path' => 'La ruta especificada no existe.', - - // View Project: - 'all_branches' => 'Todas las ramas', - 'builds' => 'Builds', - 'id' => 'ID', - 'project' => 'Proyecto', - 'commit' => 'Commit', - 'branch' => 'Rama', - 'status' => 'Estado', - 'prev_link' => '« Anterior', - 'next_link' => 'Siguiente »', - 'public_key' => 'Llave pública', - 'delete_build' => 'Eliminar Build', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Para compilar automáticamente este proyecto cada vez que se realiza un commit, agreagar la siguiente URL - como un nuevo "webhook" en la sección Webhooks - and Services de tu repositorio en GitHub.', - - 'webhooks_help_gitlab' => 'Para compilar automáticamente este proyecto, cada vez que se realiza un commit, agreagar la siguiente URL - como una "WebHook URL" en la sección "web hooks" de tu repositorio en GitLab.', - - 'webhooks_help_bitbucket' => 'Para compilar automáticamente este proyecto, cada vez que se realiza un commit, agreagar la siguiente URL - como un servicio "POST" en la sección - - Services de tu repositorio en Bitbucket.', - - // View Build - 'build_x_not_found' => 'El build con ID %d no existe.', - 'build_n' => 'Build %d', - 'rebuild_now' => 'Rebuild Ahora', - - - 'committed_by_x' => 'Commit hecho por %s', - 'commit_id_x' => 'Commit: %s', - - 'chart_display' => 'Este gráfico será mostrado una vez que el build se haya completado.', - - 'build' => 'Build', - 'lines' => 'Líneas', - 'comment_lines' => 'Líneas de comentario', - 'noncomment_lines' => 'Líneas no comentario', - 'logical_lines' => 'Líneas lógicas', - 'lines_of_code' => 'Líneas de código', - 'build_log' => 'Log', - 'quality_trend' => 'Tendencia de calidad', - 'codeception_errors' => 'Errores de Codeception', - 'phpmd_warnings' => 'PHPMD Warnings', - 'phpcs_warnings' => 'PHPCS Warnings', - 'phpcs_errors' => 'PHPCS Errors', - 'phplint_errors' => 'Lint Errors', - 'phpunit_errors' => 'PHPUnit Errors', - 'phpdoccheck_warnings' => 'Docblocks faltantes', - 'issues' => 'Incidencias', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Missing Docblocks', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - 'technical_debt' => 'Deuda Técnica', - 'behat' => 'Behat', - - 'file' => 'Archivo', - 'line' => 'Línea', - 'class' => 'Clase', - 'method' => 'Método', - 'message' => 'Mensaje', - 'start' => 'Inicio', - 'end' => 'Fin', - 'from' => 'De', - 'to' => 'Para', - 'suite' => 'Suite', - 'test' => 'Test', - 'result' => 'Resultado', - 'ok' => 'OK', - 'took_n_seconds' => 'Tomó %d segundos', - 'build_created' => 'Build Creado', - 'build_started' => 'Build Comenzado', - 'build_finished' => 'Build Terminado', - - // Users - 'name' => 'Nombre', - 'password_change' => 'Contraseña (dejar en blanco si no quiere cambiarla)', - 'save' => 'Guardar »', - 'update_your_details' => 'Actualizar los detalles', - 'your_details_updated' => 'Tus detalles han sido actualizados.', - 'add_user' => 'Agregar Usuario', - 'is_admin' => '¿Es Admin?', - 'yes' => 'Si', - 'no' => 'No', - 'edit' => 'Editar', - 'edit_user' => 'Editar Usuario', - 'delete_user' => 'Delete Usuario', - 'user_n_not_found' => 'Usuario con ID %d no existe.', - 'is_user_admin' => '¿Es un usuario administrador?', - 'save_user' => 'Guardar Usuario', - - // Settings: - 'settings_saved' => 'Tu configuración ha sido guardada.', - 'settings_check_perms' => 'Tu configuración no fue guardada, verificar los permisos del archivo config.yml.', - 'settings_cannot_write' => 'PHPCI no puede escribir en el archivo config.yml file, la configuración no será guardada correctamente - hasta no corregir esto.', - 'settings_github_linked' => 'Tu cuenta GitHub ha sido conectada.', - 'settings_github_not_linked' => 'No se pudo conectar a tu cuenta GitHub.', - 'build_settings' => 'Configuración del Build ', - 'github_application' => 'Aplicación GitHub', - 'github_sign_in' => 'Antes de comenzar a utilizar GitHub, tienes que ingresar y permitir - el acceso a tu cuenta a PHPCI.', - 'github_phpci_linked' => 'PHPCI ha sido conectado a tu cuenta GitHub.', - 'github_where_to_find' => 'Donde encontrar estos...', - 'github_where_help' => 'Si eres priopietario de la aplicaión que quieres usar, puedes encontrar esta información en - el área de configuración de aplicaciones.', - - 'email_settings' => 'Configuraciones de Email', - 'email_settings_help' => 'Para que PHPCI pueda enviar email con el status de los builds, - debes configurar las siguientes propiedades SMTP.', - - 'application_id' => 'ID de aplicación', - 'application_secret' => 'Application Secret', - - 'smtp_server' => 'Servidor SMTP', - 'smtp_port' => 'Puerto SMTP', - 'smtp_username' => 'Usuario SMTP', - 'smtp_password' => 'Contraseña SMTP', - 'from_email_address' => 'Dirección de email DE', - 'default_notification_address' => 'Dirección de correo de notificación por defecto', - 'use_smtp_encryption' => 'Usar encriptación SMTP?', - 'none' => 'None', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Considerar el build como fallido luego de ', - '5_mins' => '5 Minutos', - '15_mins' => '15 Minutos', - '30_mins' => '30 Minutos', - '1_hour' => '1 Hora', - '3_hours' => '3 Horas', - - // Plugins - 'cannot_update_composer' => 'PHPCI no puede actualizar composer.json porque no tiene permisos de escritura.', - 'x_has_been_removed' => '%s ha sido elimiando.', - 'x_has_been_added' => '%s ha sido agregado a composer.json y será instalado la próxima vez que ejecutes composer update.', - 'enabled_plugins' => 'Activar Plugins', - 'provided_by_package' => 'Provisto por Paquete', - 'installed_packages' => 'Paquetes Instalados', - 'suggested_packages' => 'Paquetes Sugeridos', - 'title' => 'Título', - 'description' => 'Descripción', - 'version' => 'Versión', - 'install' => 'Instalar »', - 'remove' => 'Eliminar »', - 'search_packagist_for_more' => 'Buscar más paquetes en Packagist', - 'search' => 'Buscar »', - - // Installer - 'installation_url' => 'URL de la instalación PHPCI', - 'db_host' => 'Host', - 'db_name' => 'Nombre de la base de datos', - 'db_user' => 'Usuario de la base de datos', - 'db_pass' => 'Clave de la base de datos', - 'admin_name' => 'Nombre del Admin', - 'admin_pass' => 'Clave del Admin', - 'admin_email' => 'Email de Admin', - 'config_path' => 'Ruta al archivo config', - 'install_phpci' => 'Instalar PHPCI', - 'welcome_to_phpci' => 'Bienvenido a PHPCI', - 'please_answer' => 'Por favor, responde las siguientes preguntas:', - 'phpci_php_req' => 'PHPCI requiere al menos PHP 5.3.8 para funcionar.', - 'extension_required' => 'Extensión requerida: %s', - 'function_required' => 'PHPCI debe poder invocar la función %s(). Está deshabilitada en php.ini?', - 'requirements_not_met' => 'PHPCI no pudo ser instalado, ya que no se cumplen todos los requerimientos. - Por favor, corrige los errores antes de continuar.', - 'must_be_valid_email' => 'Debe ser una dirección de correos válida.', - 'must_be_valid_url' => 'Debe ser una URL válida.', - 'enter_name' => 'Nombre del Admin:', - 'enter_email' => 'Email del Admin:', - 'enter_password' => 'Contraseña de Admin:', - 'enter_phpci_url' => 'La URL de PHPCI ("Por ejemplo: http://phpci.local"): ', - - 'enter_db_host' => 'Por favor, ingresa el servidor MySQL [localhost]: ', - 'enter_db_name' => 'Por favor, ingresa el nombre de la base de datos MySQL [phpci]: ', - 'enter_db_user' => 'Por favor, ingresa el usuario MySQL [phpci]: ', - 'enter_db_pass' => 'Por favor, ingresa la contraseña MySQL: ', - 'could_not_connect' => 'PHPCI no pudo conectarse a MySQL con los datos dados. Por favor, intenta nuevamente.', - 'setting_up_db' => 'Configurando base de datos... ', - 'user_created' => '¡Cuenta de usuario creada!', - 'failed_to_create' => 'PHPCI no pudo crear la cuenta de admin.', - 'config_exists' => 'El archivo config de PHPCI ya existe y no es vacío.', - 'update_instead' => 'Si está intentando actualizar PHPCI, por favor, utiliza phpci:update.', - - // Update - 'update_phpci' => 'Actuliza la base de datos para reflejar los modelos actualizados.', - 'updating_phpci' => 'Actualizando base de datos PHPCI: ', - 'not_installed' => 'PHPCI no está instalado.', - 'install_instead' => 'Por favor, instala PHPCI via phpci:install.', - - // Poll Command - 'poll_github' => 'Chequear en GitHub si se necesita comenzar un Build.', - 'no_token' => 'No se encontró ningún token GitHub', - 'finding_projects' => 'Buscando proyectos para chequear', - 'found_n_projects' => 'Se encontraron %d proyectos', - 'last_commit_is' => 'El último commit en GitHub para %s es %s', - 'adding_new_build' => 'Último commit es diferente a la base de datos, agregando nuevo build.', - 'finished_processing_builds' => 'Fin de procesamiento de builds.', - - // Create Admin - 'create_admin_user' => 'Crear un usuario Admin', - 'incorrect_format' => 'Formato incorrecto', - - // Run Command - 'run_all_pending' => 'Ejecutar todos los builds PHPCI pendientes.', - 'finding_builds' => 'Buscando builds a procesar', - 'found_n_builds' => 'Se encontraron %d builds', - 'skipping_build' => 'Saltando Build %d - Build del proyecto ya en ejecución.', - 'marked_as_failed' => 'Build %d falló debido a timeout.', - - // Builder - 'missing_phpci_yml' => 'Este proyecto no contiene el archivo phpci.yml o está vacío.', - 'build_success' => 'BUILD EXITOSO', - 'build_failed' => 'BUILD FALLIDO', - 'removing_build' => 'Eliminando Build.', - 'exception' => 'Excepción: ', - 'could_not_create_working' => 'Imposible crear copia de trabajo.', - 'working_copy_created' => 'Copia de trabajo creada: %s', - 'looking_for_binary' => 'Buscando binario: %s', - 'found_in_path' => 'Encontrado en %s: %s', - 'running_plugin' => 'EJECUTANDO PLUGIN: %s', - 'plugin_success' => 'PLUGIN: EXITO', - 'plugin_failed' => 'PLUGIN: FALLÓ', - 'plugin_missing' => 'No existe el plugin: %s', - 'tap_version' => 'TapParser únicamente soporta la verisón 13 de TAP', - 'tap_error' => 'Cadena de caracteres TAP inválida, el número de tests no coincide con la cuenta de tests declarada.', - - // Build Plugins: - 'no_tests_performed' => 'No se ejecutaron tests.', - 'could_not_find' => 'No se encontró %s', - 'no_campfire_settings' => 'No se especificaron parámetros de conexión para el plugin Campfire', - 'failed_to_wipe' => 'Imposible eliminar directorio existente %s antes de copiarlo', - 'passing_build' => 'Build Exitoso', - 'failing_build' => 'Build Fallido', - 'log_output' => 'Log de Salida: ', - 'n_emails_sent' => '%d emails enviados.', - 'n_emails_failed' => '%d emails no pudieron ser enviados.', - 'unable_to_set_env' => 'Imposible setear variable de entorno', - 'tag_created' => 'Tag creado por PHPCI: %s', - 'x_built_at_x' => 'Build de %PROJECT_TITLE% en %BUILD_URI%', - 'hipchat_settings' => 'Por favor, definir room y authToken para el plugin hipchat_notify', - 'irc_settings' => 'Debes configurar un servidor, room y apodo.', - 'invalid_command' => 'Comando inválido', - 'import_file_key' => 'Sentencia de importación debe contener una llave \'file\'', - 'cannot_open_import' => 'Imposible abrir archivo de importación SQL: %s', - 'unable_to_execute' => 'Imposible ejecutar archivo SQL', - 'phar_internal_error' => 'Error interno en plugin Phar', - 'build_file_missing' => 'El archivo de build especificado no existe.', - 'property_file_missing' => 'El archivo de propiedades especificado no existe.', - 'could_not_process_report' => 'Imposible procesar el reporte generado por la herramienta.', - 'shell_not_enabled' => 'El plugin shell no está habilitado. Por favor, habilitalo desde config.yml.' -); diff --git a/PHPCI/Languages/lang.fr.php b/PHPCI/Languages/lang.fr.php deleted file mode 100644 index a0f2cab8..00000000 --- a/PHPCI/Languages/lang.fr.php +++ /dev/null @@ -1,410 +0,0 @@ - 'Français', - 'language' => 'Langue', - - // Log in: - 'log_in_to_phpci' => 'Connectez-vous à PHPCI', - 'login_error' => 'Adresse email ou mot de passe invalide', - 'forgotten_password_link' => 'Mot de passe oublié ?', - 'reset_emailed' => 'Nous vous avons envoyé un email avec un lien pour réinitialiser votre mot de passe.', - 'reset_header' => 'Pas d\'inquiétude
Entrez simplement votre adresse email ci-dessous - et nous vous enverrons un message avec un lien pour réinitialiser votre mot de passe.', - 'reset_email_address' => 'Entrez votre adresse email:', - 'reset_send_email' => 'Envoyer le mail', - 'reset_enter_password' => 'Veuillez entrer un nouveau mot de passe', - 'reset_new_password' => 'Nouveau mot de passe :', - 'reset_change_password' => 'Modifier le mot de passe', - 'reset_no_user_exists' => 'Il n\'existe aucun utilisateur avec cette adresse email, merci de réessayer.', - 'reset_email_body' => 'Bonjour %s, - -Vous avez reçu cet email parce qu\'une demande de réinitialisation de mot de passe a été faite pour votre compte PHPCI. - -Si c\'est bien vous, merci de cliquer sur le lien suivant pour réinitialiser votre mot de passe : %ssession/reset-password/%d/%s - -Sinon, merci d\'ignorer ce message. - -Merci, - -PHPCI', - - 'reset_email_title' => 'Réinitialisation du mot de passe PHPCI pour %s', - 'reset_invalid' => 'Requête de réinitialisation de mot de passe invalide.', - 'email_address' => 'Adresse email', - 'login' => 'Login / Email Address', - 'password' => 'Mot de passe', - 'log_in' => 'Connexion', - - - // Top Nav - 'toggle_navigation' => 'Afficher/cacher la navigation', - 'n_builds_pending' => '%d builds en attente', - 'n_builds_running' => '%d builds en cours d\'exécution', - 'edit_profile' => 'Éditer le profil', - 'sign_out' => 'Déconnexion', - 'branch_x' => 'Branche : %s', - 'created_x' => 'Créé à : %s', - 'started_x' => 'Démarré à : %s', - - // Sidebar - 'hello_name' => 'Salut %s', - 'dashboard' => 'Tableau de bord', - 'admin_options' => 'Options d\'administration', - 'add_project' => 'Ajouter un projet', - 'settings' => 'Paramètres', - 'manage_users' => 'Gérer les utilisateurs', - 'plugins' => 'Plugins', - 'view' => 'Voir', - 'build_now' => 'Démarrer le build', - 'edit_project' => 'Éditer le projet', - 'delete_project' => 'Supprimer le projet', - - // Project Summary: - 'no_builds_yet' => 'Aucun build pour le moment !', - 'x_of_x_failed' => '%d des %d derniers builds ont échoué.', - 'x_of_x_failed_short' => '%d échecs / %d.', - 'last_successful_build' => ' Le dernier build réussi date du %s.', - 'never_built_successfully' => ' Aucun build de ce projet n\'a réussi.', - 'all_builds_passed' => 'Les %d derniers builds ont réussi.', - 'all_builds_passed_short' => '%d réussites / %d.', - 'last_failed_build' => ' Le dernier build en échec date du %s.', - 'never_failed_build' => ' Aucun build de ce projet n\'a échoué.', - 'view_project' => 'Voir le projet', - - // Timeline: - 'latest_builds' => 'Derniers builds', - 'pending' => 'En attente', - 'running' => 'En cours', - 'success' => 'Terminé', - 'successful' => 'Réussi', - 'failed' => 'Échoué', - 'manual_build' => 'Build manuel', - - // Add/Edit Project: - 'new_project' => 'Nouveau Projet', - 'project_x_not_found' => 'Il n\'existe pas de Projet avec l\'ID %d.', - 'project_details' => 'Détails du Projet', - 'public_key_help' => 'Pour pouvoir démarrer plus facilement, nous avons généré une paire de clés SSH à utiliser avec ce projet. - Pour l\'utiliser, il faut simplement ajouter la clé publique dans la section "Clés de déploiement" - de votre outil d\'hébergement de code.', - 'select_repository_type' => 'Sélectionnez le type de dépôt...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'URL distante', - 'local' => 'Chemin local', - 'hg' => 'Mercurial', - - 'where_hosted' => 'Où est hébergé votre projet ?', - 'choose_github' => 'Choisissez un dépôt GitHub :', - - 'repo_name' => 'Nom du dépôt / URL (distance) ou chemin (local)', - 'project_title' => 'Titre du projet', - 'project_private_key' => 'Clé privée à utiliser pour accéder au dépôt - (laissez le champ vide pour les dépôts locaux ou les URLs distantes anonymes)', - 'build_config' => 'Configuration PHPCI spécifique pour ce projet - (si vous ne pouvez pas ajouter de fichier phpci.yml à la racine du dépôt)', - 'default_branch' => 'Nom de la branche par défaut', - 'allow_public_status' => 'Activer la page de statut publique et l\'image pour ce projet ?', - 'archived' => 'Archived', - 'archived_menu' => 'Archived', - 'save_project' => 'Enregistrer le projet', - - 'error_mercurial' => 'Les URLs de dépôt Mercurial doivent commencer par http:// ou https://', - 'error_remote' => 'Les URLs de dépôt doivent commencer par git://, http:// ou https://', - 'error_gitlab' => 'Le nom du dépôt GitLab doit avoir le format "user@domain.tld:owner/repo.git"', - 'error_github' => 'Le nom du dépôt doit être dans le format "proprietaire/dépôt"', - 'error_bitbucket' => 'Le nom du dépôt doit être dans le format "proprietaire/dépôt"', - 'error_path' => 'Le chemin que vous avez spécifié n\'existe pas.', - - // View Project: - 'all_branches' => 'Toutes les branches', - 'builds' => 'Builds', - 'id' => 'ID', - 'date' => 'Date', - 'project' => 'Projet', - 'commit' => 'Commit', - 'branch' => 'Branche', - 'status' => 'Statut', - 'prev_link' => '« Précédent', - 'next_link' => 'Suivant »', - 'public_key' => 'Clé Publique', - 'delete_build' => 'Supprimer le build', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Pour générer un build quand de nouveaux commits sont poussés, ajouter l\'url suivante - en tant que new "Webhook" dans la section Webhooks - and Services de votre dépôt GitHub.', - - 'webhooks_help_gitlab' => 'Pour générer un build quand de nouveaux commits sont poussés, ajouter l\'url suivante - and tant que "WebHook URL" dans la section Web Hooks de votre dépôt GitLab.', - - 'webhooks_help_bitbucket' => 'Pour générer un build quand de nouveaux commits sont poussés, ajouter l\'url suivante - en tant que service "POST" dans la section - - Services de votre dépôt Bitbucket.', - - // View Build - 'build_x_not_found' => 'Le Build avec l\'ID %d n\'existe pas.', - 'build_n' => 'Build %d', - 'rebuild_now' => 'Relancer maintenant', - - - 'committed_by_x' => 'Committé par %s', - 'commit_id_x' => 'Commit : %s', - - 'chart_display' => 'Ce graphique s\'affichera une fois que le build sera terminé.', - - 'build' => 'Build', - 'lines' => 'Lignes', - 'comment_lines' => 'Lignes de commentaires', - 'noncomment_lines' => 'Lignes qui ne sont pas des commentaires', - 'logical_lines' => 'Lignes logiques', - 'lines_of_code' => 'Lignes de code', - 'build_log' => 'Log du build', - 'quality_trend' => 'Tendance de la qualité', - 'codeception_errors' => 'Erreurs Codeception', - 'phpmd_warnings' => 'Alertes PHPMD', - 'phpcs_warnings' => 'Alertes PHPCS', - 'phpcs_errors' => 'Erreurs PHPCS', - 'phplint_errors' => 'Erreurs de Lint', - 'phpunit_errors' => 'Erreurs PHPUnit', - 'phpdoccheck_warnings' => 'Blocs de documentation manquants', - 'issues' => 'Tickets', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Missing Docblocks', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - - 'file' => 'Fichier', - 'line' => 'Ligne', - 'class' => 'Classe', - 'method' => 'Méthode', - 'message' => 'Message', - 'start' => 'Démarrage', - 'end' => 'Fin', - 'from' => 'À partir de', - 'to' => 'jusque', - 'result' => 'Resultat', - 'ok' => 'OK', - 'took_n_seconds' => 'Exécuté en %d secondes', - 'build_created' => 'Build créé', - 'build_started' => 'Build démarré', - 'build_finished' => 'Build terminé', - 'test_message' => 'Message', - 'test_no_message' => 'Pas de message', - 'test_success' => 'Réussi(s): %d', - 'test_fail' => 'Echec(s): %d', - 'test_skipped' => 'Passé(s): %d', - 'test_error' => 'Erreurs: %d', - 'test_todo' => 'Todos: %d', - 'test_total' => '%d test(s)', - - // Users - 'name' => 'Nom', - 'password_change' => 'Mot de passe (laissez vide si vous ne voulez pas le changer)', - 'save' => 'Sauvegarder »', - 'update_your_details' => 'Mettre à jour vos préférences', - 'your_details_updated' => 'Vos préférences ont été bien mises à jour.', - 'add_user' => 'Ajouter un utilisateur', - 'is_admin' => 'Est-il administrateur ?', - 'yes' => 'Oui', - 'no' => 'Non', - 'edit' => 'Éditer', - 'edit_user' => 'Éditer l\'utilisateur', - 'delete_user' => 'Supprimer l\'utilisateur', - 'user_n_not_found' => 'L\'utilisateur avec l\'ID %d n\'existe pas.', - 'is_user_admin' => 'Est-ce que cet utilisateur est administrateur?', - 'save_user' => 'Sauvegarder l\'utilisateur', - - // Settings: - 'settings_saved' => 'Vos paramètres ont été sauvegardés.', - 'settings_check_perms' => 'Vos paramètres n\'ont pas pu être sauvegardés, vérifiez les permissions sur le fichier config.yml.', - 'settings_cannot_write' => 'PHPCI ne peut pas écrire dans votre fichier config.yml, les paramètres ne pourront pas être sauvegardés correctement - tant que ce ne sera pas corrigé.', - 'settings_github_linked' => 'Votre compte GitHub n\'a pas été lié.', - 'settings_github_not_linked' => 'Votre compte GitHub ne peut pas être lié.', - 'build_settings' => 'Configuration du Build', - 'github_application' => 'Application GitHub', - 'github_sign_in' => 'Avant de commencer à utiliser GitHub, vous devez vous connecter et autoriser - PHPCI à accéder à votre compte.', - 'github_phpci_linked' => 'PHPCI s\'est connecté avec succès au compte GitHub.', - 'github_where_to_find' => 'Où trouver ces informations...', - 'github_where_help' => 'Si vous souhaitez utiliser une application qui vous appartient, vous pouvez trouver ces informations dans - la zone de paramètres applications.', - - 'email_settings' => 'Configuration Email', - 'email_settings_help' => 'Avant que PHPCI puisse envoyer des emails concernant les statuts de build, - vous devez entrer les configurations SMTP ci-dessous.', - - 'application_id' => 'Identifiant d\'application', - 'application_secret' => 'Clé secrète de l\'application', - - 'smtp_server' => 'Serveur SMTP', - 'smtp_port' => 'Port SMTP', - 'smtp_username' => 'Nom d\'utilisateur SMTP', - 'smtp_password' => 'Mot de passe SMTP', - 'from_email_address' => 'Adresse à partir de laquelle sont envoyés les emails', - 'default_notification_address' => 'Adresse de notification par défaut', - 'use_smtp_encryption' => 'Est-ce que vous voulez utiliser le chiffrement SMTP', - 'none' => 'Non', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Considérer qu\'un build a échoué après', - '5_mins' => '5 Minutes', - '15_mins' => '15 Minutes', - '30_mins' => '30 Minutes', - '1_hour' => '1 Heure', - '3_hours' => '3 Heures', - - // Plugins - 'cannot_update_composer' => 'PHPCI ne peut pas mettre à jour le fichier composer.json pour vous, il n\'est pas modifiable.', - 'x_has_been_removed' => '%s a été supprimé.', - 'x_has_been_added' => '%s a été ajouté au fichier composer.json pour vous et il sera installé la prochaine fois - que vous lancerez "composer update".', - 'enabled_plugins' => 'Plugins activés', - 'provided_by_package' => 'Fournis par le paquet', - 'installed_packages' => 'Paquets installés', - 'suggested_packages' => 'Paquets suggérés', - 'title' => 'Titre', - 'description' => 'Description', - 'version' => 'Version', - 'install' => 'Installer »', - 'remove' => 'Supprimer »', - 'search_packagist_for_more' => 'Rechercher sur Packagist pour trouver plus de paquets', - 'search' => 'Rechercher »', - - // Summary plugin - 'build-summary' => 'Résumé', - 'stage' => 'Étape', - 'duration' => 'Durée', - 'plugin' => 'Plugin', - 'stage_setup' => 'Préparation', - 'stage_test' => 'Test', - 'stage_complete' => 'Terminé', - 'stage_success' => 'Succes', - 'stage_failure' => 'Échec', - - // Installer - 'installation_url' => 'URL d\'installation de PHPCI', - 'db_host' => 'Hôte de la BDD', - 'db_name' => 'Nom de la BDD', - 'db_user' => 'Nom d\'utilisateur de la BDD', - 'db_pass' => 'Mot de passe de la BDD', - 'admin_name' => 'Nom de l\'admin', - 'admin_pass' => 'Mot de passe admin', - 'admin_email' => 'Adresse email de l\'admin', - 'config_path' => 'Chemin vers le fichier de configuration', - 'install_phpci' => 'Installer PHPCI', - 'welcome_to_phpci' => 'Bienvenue sur PHPCI', - 'please_answer' => 'Merci de répondre aux questions suivantes :', - 'phpci_php_req' => 'PHPCI requiert au moins PHP 5.3.8 pour fonctionner.', - 'extension_required' => 'Extensions requises : %s', - 'function_required' => 'PHPCI doit être capable d\'appeler la fonction %s(). Est-ce qu\'elle est désactivée dans votre php.ini?', - 'requirements_not_met' => 'PHPCI ne peut pas être installé parce que toutes les conditions requises ne sont pas respectées. - Merci de corriger les erreurs ci-dessus avant de continuer.', - 'must_be_valid_email' => 'Doit être une adresse email valide.', - 'must_be_valid_url' => 'Doit être une URL valide.', - 'enter_name' => 'Nom de l\'admin: ', - 'enter_email' => 'Email de l\'admin: ', - 'enter_password' => 'Mot de passe de l\'admin: ', - 'enter_phpci_url' => 'Votre URL vers PHPCI (par exemple "http://phpci.local"): ', - - 'enter_db_host' => 'Merci d\'entrer le nom d\'hôte MySQL [localhost]: ', - 'enter_db_name' => 'Merci d\'entrer le nom de la base MySQL [phpci]: ', - 'enter_db_user' => 'Merci d\'entrer le nom d\'utilisateur MySQL [phpci]: ', - 'enter_db_pass' => 'Merci d\'entrer le mot de passe MySQL: ', - 'could_not_connect' => 'PHPCI ne peut pas se connecter à MySQL à partir des informations fournies. Veuillez réessayer..', - 'setting_up_db' => 'Paramétrage de la base de données... ', - 'user_created' => 'Le compte utilisateur a été créé !', - 'failed_to_create' => 'PHPCI n\'a pas réussi à créer votre compte admin.', - 'config_exists' => 'Le fichier de configuration PHPCI existe et n\'est pas vide.', - 'update_instead' => 'Si vous essayez de mettre à jour PHPCI, merci d\'utiliser la commande phpci:update.', - - // Update - 'update_phpci' => 'Mise à jour de la base de données pour refléter les modifications apportées aux modèles.', - 'updating_phpci' => 'Mise à jour de la base de données PHPCI : ', - 'not_installed' => 'PHPCI n\'a pas l\'air d\'être installé.', - 'install_instead' => 'Merci d\'installer PHPCI grâce à la commande phpci:install.', - - // Poll Command - 'poll_github' => 'Demander à GitHub de vérifier si nous devons démarrer un build.', - 'no_token' => 'Aucun token GitHub n\'a été trouvé', - 'finding_projects' => 'Recherche des projets à sonder', - 'found_n_projects' => '%d projets trouvés', - 'last_commit_is' => 'Le dernier commit sur GitHub pour %s est %s', - 'adding_new_build' => 'Le dernier commit est différent de celui présent en base de données, ajout d\'un nouveau build.', - 'finished_processing_builds' => 'Traitement des builds terminé.', - - // Create Admin - 'create_admin_user' => 'Créer un utilisateur admin', - 'incorrect_format' => 'Format incorrect', - - // Create Build Command - 'create_build_project' => 'Créer un build projet', - 'project_id_argument' => 'ID du projet', - 'commit_id_option' => 'ID du commit', - 'branch_name_option' => 'Branche', - - // Run Command - 'run_all_pending' => 'Démarrage de tout les builds PHPCI en attente.', - 'finding_builds' => 'Découverte des builds à traiter', - 'found_n_builds' => '%d builds trouvés', - 'skipping_build' => 'Saut du build %d - Un build sur le projet est déjà en cours.', - 'marked_as_failed' => 'Le build %d a été marqué échoué à cause d\'un timeout.', - - // Builder - 'missing_phpci_yml' => 'Ce projet ne contient pas de fichier phpci.yml, ou il est vide.', - 'build_success' => 'BUILD RÉUSSI', - 'build_failed' => 'BUILD ÉCHOUÉ', - 'removing_build' => 'Suppression du build.', - 'exception' => 'Exception: ', - 'could_not_create_working' => 'Impossible de créer un copie de travail.', - 'working_copy_created' => 'Copie de travail créée: %s', - 'looking_for_binary' => 'Recherche du binaire: %s', - 'found_in_path' => 'Trouver dans %s: %s', - 'running_plugin' => 'EXÉCUTION DU PLUGIN: %s', - 'plugin_success' => 'PLUGIN: RÉUSSI', - 'plugin_failed' => 'PLUGIN: ÉCHOUÉ', - 'plugin_missing' => 'Le plugins n\'existe pas: %s', - 'tap_version' => 'TapParser supporte seulement les TAP version 13', - 'tap_error' => 'Chaîne de TAP invalide, le nombre de tests ne correspond pas à celui spécifié.', - - // Build Plugins: - 'no_tests_performed' => 'Aucun test n\'a été exécuté.', - 'could_not_find' => 'Impossible de trouver %s', - 'no_campfire_settings' => 'Aucune information de connexion n\'a été fournie pour le plugin Campfire', - 'failed_to_wipe' => 'Impossible de supprimer le dossier %s avant de copier', - 'passing_build' => 'Passing Build', - 'failing_build' => 'Failing Build', - 'log_output' => 'Sortie de log : ', - 'n_emails_sent' => '%d emails envoyés.', - 'n_emails_failed' => '%d emails dont l\'envoi a échoué.', - 'unable_to_set_env' => 'Impossible d\'initialiser la variable d\'environnement', - 'tag_created' => 'Tag créé par PHPCI : %s', - 'x_built_at_x' => '%PROJECT_TITLE% construit à %BUILD_URI%', - 'hipchat_settings' => 'Merci de définir une "room" et un "authToken" pour le plugin hipchat_notify', - 'irc_settings' => 'Vous devez configurer un serveur, une "room" et un "nick".', - 'invalid_command' => 'Commande invalide', - 'import_file_key' => 'La déclaration d\'import doit contenir un \'fichier\' clé', - 'cannot_open_import' => 'Impossible d\'importer le ficher SQL : %s', - 'unable_to_execute' => 'Impossible d\'exécuter le ficher SQL', - 'phar_internal_error' => 'Erreur interne au plugin Phar', - 'build_file_missing' => 'Le fichier de build spécifié n\'existe pas.', - 'property_file_missing' => 'Le fichier de propriété spécifié n\'existe pas.', - 'could_not_process_report' => 'Impossible de traiter le rapport généré par cet outil.', - 'shell_not_enabled' => 'Le plugn shell n\'est pas activé. Merci de l\'activer via le fichier config.yml.' -); diff --git a/PHPCI/Languages/lang.it.php b/PHPCI/Languages/lang.it.php deleted file mode 100644 index d254fbcd..00000000 --- a/PHPCI/Languages/lang.it.php +++ /dev/null @@ -1,401 +0,0 @@ - 'Italiano', - 'language' => 'Lingua', - - // Log in: - 'log_in_to_phpci' => 'Accedi a PHPCI', - 'login_error' => 'Indirizzo email o password errati', - 'forgotten_password_link' => 'Hai dimenticato la tua password?', - 'reset_emailed' => 'Ti abbiamo inviato un link via email per ripristinare la tua password.', - 'reset_header' => 'Non preoccuparti!
E\' sufficiente inserire il tuo indirizzo email di seguito e ti invieremo una email con il link per il ripristino della tua password.', - 'reset_email_address' => 'Inserisci il tuo indirizzo email:', - 'reset_send_email' => 'Invia il link di reset della password', - 'reset_enter_password' => 'Per favore inserisci la nuova password', - 'reset_new_password' => 'Nuova password:', - 'reset_change_password' => 'Cambia password', - 'reset_no_user_exists' => 'Non esiste nessun utente con questo indirizzo email, per favore prova ancora.', - 'reset_email_body' => 'Ciao %s, - -hai ricevuto questa email perché tu, o qualcun\'altro, ha richiesto un reset della password per PHPCI. - -Se questa mail è tua, per favore apri il seguente link per ripristinare la tua password: %ssession/reset-password/%d/%s - -altrimenti, per favore, ignora questa email e nessuna azione verrà intrapresa. - -Grazie, - -PHPCI', - - 'reset_email_title' => 'Ripristino della password di PHPCI per %s', - 'reset_invalid' => 'Richeista di ripristino password non valida.', - 'email_address' => 'Indirizzo Email', - 'login' => 'Login / Email Address', - 'password' => 'Password', - 'log_in' => 'Accedi', - - // Top Nav - 'toggle_navigation' => 'Alterna navigazione', - 'n_builds_pending' => '%d build in attesa', - 'n_builds_running' => '%d build in corso', - 'edit_profile' => 'Modifica il Profilo', - 'sign_out' => 'Disconnettiti', - 'branch_x' => 'Branch: %s', - 'created_x' => 'Creato: %s', - 'started_x' => 'Avviato: %s', - - // Sidebar - 'hello_name' => 'Ciao, %s', - 'dashboard' => 'Dashboard', - 'admin_options' => 'Opzioni di amministrazione', - 'add_project' => 'Aggiungi un Progetto', - 'settings' => 'Impostazioni', - 'manage_users' => 'Gestisci Utenti', - 'plugins' => 'Plugins', - 'view' => 'Visualizzazione', - 'build_now' => 'Avvia una build ora', - 'edit_project' => 'Modifica il Progetto', - 'delete_project' => 'Cancella il Progetto', - - // Project Summary: - 'no_builds_yet' => 'Ancora nessuna build!', - 'x_of_x_failed' => '%d delle ultime %d build sono fallite.', - 'x_of_x_failed_short' => '%d / %d fallite.', - 'last_successful_build' => ' L\'ultima build è %s.', - 'never_built_successfully' => ' Questo progetto non ha nessuna build eseguita con successo.', - 'all_builds_passed' => 'Tutte le ultime %d build sono valide.', - 'all_builds_passed_short' => '%d / %d valide.', - 'last_failed_build' => ' L\'ultima build è %s.', - 'never_failed_build' => ' Questo progetto non ha nessuna build fallita.', - 'view_project' => 'Visualizza il Progetto', - - // Timeline: - 'latest_builds' => 'Ultime Build', - 'pending' => 'In attesa', - 'running' => 'In corso', - 'success' => 'Successo', - 'successful' => 'Con successo', - 'failed' => 'Fallita', - 'manual_build' => 'Build Manuale', - - // Add/Edit Project: - 'new_project' => 'Nuovo Progetto', - 'project_x_not_found' => 'Progetto con ID %d non esistente.', - 'project_details' => 'Dettagli del Progetto', - 'public_key_help' => 'Per rendere più facile la procedura, abbiamo generato una chiave SSH per te da - usare per questo progetto. Per usarla, aggiungi la chiave pubblica alle "deploy keys" - della piattaforma di gestione del codice che hai scelto.', - 'select_repository_type' => 'Seleziona il tipo di repository...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'URL Remoto', - 'local' => 'Percorso Locale', - 'hg' => 'Mercurial', - - 'where_hosted' => 'Dove è archiviato il tuo progetto?', - 'choose_github' => 'Scegli il repository di GitHub:', - - 'repo_name' => 'Nome del Repository / URL (Remoto) o Percorso (Locale)', - 'project_title' => 'Titolo del Progetto', - 'project_private_key' => 'Chiave provata da usare per accedere al repository - (lascia vuota per repository locali o remoti con accesso anonimo)', - 'build_config' => 'condigurazione della build di PHPCI per questo progetto - (se non puoi aggiungere il file phpci.yml nel repository di questo progetto)', - 'default_branch' => 'Nome del branch di default', - 'allow_public_status' => 'Vuoi rendere pubblica la pagina dello stato e l\'immagine per questo progetto?', - 'archived' => 'Archived', - 'archived_menu' => 'Archived', - 'save_project' => 'Salva il Progetto', - - 'error_mercurial' => 'L\'URL del repository Mercurial URL deve iniziare con http:// o https://', - 'error_remote' => 'L\'URL del repository deve iniziare con git://, http:// o https://', - 'error_gitlab' => 'Il nome del repository di GitLab deve essere nel seguente formato "utente@dominio.tld:proprietario/repository.git"', - 'error_github' => 'Il nome del repository deve essere nel formato "proprietario/repository"', - 'error_bitbucket' => 'Il nome del repository deve essere nel formato "proprietario/repository"', - 'error_path' => 'The path you specified does not exist.', - 'error_path' => 'Il percorso che hai indicato non esiste.', - - // View Project: - 'all_branches' => 'Tutti i Branche', - 'builds' => 'Builds', - 'id' => 'ID', - 'date' => 'Data', - 'project' => 'Progetto', - 'commit' => 'Commit', - 'branch' => 'Branch', - 'status' => 'Stato', - 'prev_link' => '« Precedente', - 'next_link' => 'Successivo »', - 'public_key' => 'Chiave pubblica', - 'delete_build' => 'Rimuovi build', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Per effettuare la build automatica di questo progetto quando vengono inseriti nuovi commit, - aggiungi l\'URL seguente come "Webhook" nella sezione - Webhooks and Services del tuo - repository su GitHub.', - - 'webhooks_help_gitlab' => 'Per effettuare la build automatica di questo progetto quando vengono inseriti nuovi commit, - aggiungi l\'URL seguente come "Webhook URL" nella sezione "WebHook URL" del tuo - repository GitLab.', - - 'webhooks_help_bitbucket' => 'Per effettuare la build automatica di questo progetto quando vengono inseriti nuovi - commit, aggiungi l\'URL seguente come serizio "POST" nella sezione - Services del tuo repository su - BITBUCKET.', - - // View Build - 'build_x_not_found' => 'La build con ID %d non esite.', - 'build_n' => 'Build %d', - 'rebuild_now' => 'Esegui nuovamente la build ora', - - - 'committed_by_x' => 'Inviato da %s', - 'commit_id_x' => 'Commit: %s', - - 'chart_display' => 'Questo grafico verrà mostrato una volta terminata la build.', - - 'build' => 'Build', - 'lines' => 'Linee', - 'comment_lines' => 'Linee di commenti', - 'noncomment_lines' => 'Linee che non sono commenti', - 'logical_lines' => 'Linee di logica', - 'lines_of_code' => 'Linee di codice', - 'build_log' => 'Log della build', - 'quality_trend' => 'Trend della qualità', - 'codeception_errors' => 'Errori di Codeception', - 'phpmd_warnings' => 'Avvisi di PHPMD', - 'phpcs_warnings' => 'Avvisi di PHPCS', - 'phpcs_errors' => 'Errori di PHPCS', - 'phplint_errors' => 'Errori di Lint', - 'phpunit_errors' => 'Errori di PHPUnit', - 'phpdoccheck_warnings' => 'Docblocks mancanti', - 'issues' => 'Segnalazioni', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Docblocks mancanti', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - - 'file' => 'File', - 'line' => 'Lina', - 'class' => 'Classe', - 'method' => 'Metodo', - 'message' => 'Messaggio', - 'start' => 'Inizia', - 'end' => 'Finisci', - 'from' => 'Da', - 'to' => 'A', - 'result' => 'Risultati', - 'ok' => 'OK', - 'took_n_seconds' => 'Sono stati impiegati %d seconds', - 'build_created' => 'Build Creata', - 'build_started' => 'Build Avviata', - 'build_finished' => 'Build Terminata', - 'test_message' => 'Message', - 'test_no_message' => 'No message', - 'test_success' => 'Successful: %d', - 'test_fail' => 'Failures: %d', - 'test_skipped' => 'Skipped: %d', - 'test_error' => 'Errors: %d', - 'test_todo' => 'Todos: %d', - 'test_total' => '%d test(s)', - - // Users - 'name' => 'Nome', - 'password_change' => 'Password (lascia vuota se non vuoi modificarla)', - 'save' => 'Salva »', - 'update_your_details' => 'Aggiorna le tue informazioni', - 'your_details_updated' => 'Le tue informazioni sono state aggiornate.', - 'add_user' => 'Aggiung utent', - 'is_admin' => 'E\' amministratore?', - 'yes' => 'Si', - 'no' => 'No', - 'edit' => 'Modifica', - 'edit_user' => 'Modifica utente', - 'delete_user' => 'Cancella utente', - 'user_n_not_found' => 'L\'utente con ID %d non esiste.', - 'is_user_admin' => 'Questo utente è un amministratore?', - 'save_user' => 'Salva utente', - - // Settings: - 'settings_saved' => 'Le configurazioni sono state salvate.', - 'settings_check_perms' => 'Le configurazioni non possono essere salvate, controlla i permessi del filer config.yml.', - 'settings_cannot_write' => 'PHPCI non può scrivere il file config.yml, le configurazioni potrebbero non essere - salvate correttamente fintanto che il problema non verrà risolto.', - 'settings_github_linked' => 'Il tuo account GitHub è stato collegato.', - 'settings_github_not_linked' => 'Il tuo account GitHub non può essere collegato.', - 'build_settings' => 'Configurazioni della build', - 'github_application' => 'Applicazione GitHub', - 'github_sign_in' => 'Prima di poter iniziare ad usare GitHub, è necessario collegarsi e garantire - a PHPCI l\'accesso al tuo account.', - 'github_phpci_linked' => 'PHPCI è stato collegato correttamente al tuo account GitHub.', - 'github_where_to_find' => 'Dove trovare queste...', - 'github_where_help' => 'Se sei il proprietario dell\'applicazione, puoi trovare queste informazioni nell\'area delle - configurazioni dell\'applicazione.', - - 'email_settings' => 'Impostazioni Email', - 'email_settings_help' => 'Prima che possa inviare le email con lo status PHPCI, devi configurare l\'SMTP qui sotto.', - - 'application_id' => 'ID dell\'Applicazione', - 'application_secret' => 'Secret dell\'Applicazione', - - 'smtp_server' => 'Server SMTP', - 'smtp_port' => 'Porta SMTP', - 'smtp_username' => 'Username SMTP', - 'smtp_password' => 'Password SMTP', - 'from_email_address' => 'Indirizzio Email del mittente', - 'default_notification_address' => 'Indirizzo email delle notifiche predefinito', - 'use_smtp_encryption' => 'Utilizzare l\'Encrypting per SMTP?', - 'none' => 'No', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Considera la build fallita dopo', - '5_mins' => '5 Minuti', - '15_mins' => '15 Minuti', - '30_mins' => '30 Minuti', - '1_hour' => '1 Ora', - '3_hours' => '3 Ore', - - // Plugins - 'cannot_update_composer' => 'PHPCI non può aggiornare composer.json per te non essendo scrivibile.', - 'x_has_been_removed' => '%s è stato rimosso.', - 'x_has_been_added' => '%s è stato aggiunto al file composer.json per te, verrà installato la prossima volta che eseguirai - composer update.', - 'enabled_plugins' => 'Plugins attivati', - 'provided_by_package' => 'Fornito dal pacchetto', - 'installed_packages' => 'Pacchetti installati', - 'suggested_packages' => 'Paccehtti suggeriti', - 'title' => 'Titolo', - 'description' => 'Descrizione', - 'version' => 'Versione', - 'install' => 'Installa »', - 'remove' => 'Rimuovi »', - 'search_packagist_for_more' => 'Cerca altri pacchetti su Packagist', - 'search' => 'Cerca »', - - // Installer - 'installation_url' => 'URL di installazione di PHPCI', - 'db_host' => 'Host del Database', - 'db_name' => 'Nome del Database', - 'db_user' => 'Username del Database', - 'db_pass' => 'Password del Database', - 'admin_name' => 'Nome dell\'amministratore', - 'admin_pass' => 'Password dell\'amministratore', - 'admin_email' => 'Email dell\'amministratore', - 'config_path' => 'Percorso del file di configurazione', - 'install_phpci' => 'Installa PHPCI', - 'welcome_to_phpci' => 'Benvenuto in PHPCI', - 'please_answer' => 'Per favore rispondi alle seguenti domande:', - 'phpci_php_req' => 'PHPCI richiede come minimo PHP 5.3.8 per funzionare.', - 'extension_required' => 'Le estensioni richieste sono: %s', - 'function_required' => 'PHPCI richiede di poter chiamare la funzione %s(). Questa funzionalità è disabibiltata nel - php.ini?', - 'requirements_not_met' => 'PHPCI non può essere installato, non tutti i requisiti sono soddisfatti. - Per favore controlla gli errori riportati prima di proseguire.', - 'must_be_valid_email' => 'Deve essere un indirizzo email valido.', - 'must_be_valid_url' => 'Deve essere un URL valido.', - 'enter_name' => 'Nome dell\'amministratore: ', - 'enter_email' => 'Email dell\'amministratore: ', - 'enter_password' => 'Password dell\'amministratore: ', - 'enter_phpci_url' => 'L\'URL di PHPCI ("http://phpci.locale" ad esempio): ', - - 'enter_db_host' => 'Per favore inserisci l\'host MySQL [localhost]: ', - 'enter_db_name' => 'Per favore inserisci il nome MySQL [phpci]: ', - 'enter_db_user' => 'Per favore inserisci l\'username MySQL [phpci]: ', - 'enter_db_pass' => 'Per favore inserisci la password MySQL: ', - 'could_not_connect' => 'PHPCI non può connettersi a MySQL con le informazioni fornite. Per favore prova ancora.', - 'setting_up_db' => 'Configurzione del tuo database... ', - 'user_created' => 'Account utente creato!', - 'failed_to_create' => 'PHPCI non è riuscito a creare il tuo account amministrativo.', - 'config_exists' => 'Il file di configurazione di PHPCI esiste e non è vuoto.', - 'update_instead' => 'Se stai cercando di aggiornare PHPCI, per favore usa phpci:update.', - - // Update - 'update_phpci' => 'Aggiorna il database per riflettere le modifiche ai model.', - 'updating_phpci' => 'Aggiornamenti del database di PHPCI: ', - 'not_installed' => 'PHPCI sembra non essere installato.', - 'install_instead' => 'Per favore installa PHPCI tramite phpci:install.', - - // Poll Command - 'poll_github' => 'Richiesta a GitHub per verificare se è necessario avviare una build.', - 'no_token' => 'Nessuno token per GitHub trovato', - 'finding_projects' => 'Ricerca dei progetti da aggiornare', - 'found_n_projects' => 'Trovati %d progetti', - 'last_commit_is' => 'Ultimo commit su GitHub per %s è %s', - 'adding_new_build' => 'L\'ultimo commit è diverso da quello registrato, new build aggiunta.', - 'finished_processing_builds' => 'Terminato di processare le build.', - - // Create Admin - 'create_admin_user' => 'Crea un nuovo utente amministrarore', - 'incorrect_format' => 'Formato errato', - - // Create Build Command - 'create_build_project' => 'Create a build for a project', - 'project_id_argument' => 'A project ID', - 'commit_id_option' => 'Commit ID to build', - 'branch_name_option' => 'Branch to build', - - // Run Command - 'run_all_pending' => 'Esegui tutte le build in attesa su PHPCI.', - 'finding_builds' => 'Ricerca delel build da processare', - 'found_n_builds' => 'Trovate %d build', - 'skipping_build' => 'Saltata la build %d - La build del progetto è già in corso.', - 'marked_as_failed' => 'Build %d è stata contrassegnata come fallita per un timeout.', - - // Builder - 'missing_phpci_yml' => 'Questo progetto non contiene il file phpci.yml, o il file è vuoto.', - 'build_success' => 'BUILD PASSATA', - 'build_failed' => 'BUILD FALLITA', - 'removing_build' => 'Rimozione build.', - 'exception' => 'Eccezione: ', - 'could_not_create_working' => 'Non può essere creata una copia di lavoro.', - 'working_copy_created' => 'Copia di lavoro creata: %s', - 'looking_for_binary' => 'Ricerca per il binario: %s', - 'found_in_path' => 'Trovato in %s: %s', - 'running_plugin' => 'PLUGIN IN ESECUZIONE: %s', - 'plugin_success' => 'PLUGIN: PASSATO', - 'plugin_failed' => 'PLUGIN: FALLITO', - 'plugin_missing' => 'Plugin non esistente: %s', - 'tap_version' => 'TapParser supporta solo la versione TAP 13', - 'tap_error' => 'Stringa TAP non valida, il numero dei test non corrisponde con il numero di test contati.', - - // Build Plugins: - 'no_tests_performed' => 'Nessun test è stato eseguito.', - 'could_not_find' => 'Non posso trovare %s', - 'no_campfire_settings' => 'Nessun parametro di connessione trovato per il plugin Campfire.', - 'failed_to_wipe' => 'Errore nel pulire la cartella %s prima di effettuare la copia', - 'passing_build' => 'Build passata', - 'failing_build' => 'Build fallita', - 'log_output' => 'Log: ', - 'n_emails_sent' => '%d email inviate.', - 'n_emails_failed' => '%d email da inviare fallite.', - 'unable_to_set_env' => 'Errore nel settare la variabile di ambiente', - 'tag_created' => 'Tag creato da PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% buildato in %BUILD_URI%', - 'hipchat_settings' => 'Per favore definire la stanza e authToken per il plugin hipchat_notify', - 'irc_settings' => 'Devi configurare server, stanza e nick.', - 'invalid_command' => 'Comando non valido', - 'import_file_key' => 'L\'import deve contenrere la chiave \'file\'', - 'cannot_open_import' => 'Impossobile aprire il file SQL da importare: %s', - 'unable_to_execute' => 'Impossibile eseguire il file SQL', - 'phar_internal_error' => 'Errore interno del plugin Phar', - 'build_file_missing' => 'Il file di build specificato non esiste.', - 'property_file_missing' => 'Il file di proprietà specificato non esiste.', - 'could_not_process_report' => 'Non è possibile processare il report generato da questo tool.', - 'shell_not_enabled' => 'Il plugin shell non è attivato. Per favore attivalo tramite config.yml.' -); diff --git a/PHPCI/Languages/lang.nl.php b/PHPCI/Languages/lang.nl.php deleted file mode 100644 index 96d9f5d5..00000000 --- a/PHPCI/Languages/lang.nl.php +++ /dev/null @@ -1,399 +0,0 @@ - 'Nederlands', - 'language' => 'Taal', - - // Log in: - 'log_in_to_phpci' => 'Log in op PHPCI', - 'login_error' => 'Incorrect e-mailadres of wachtwoord', - 'forgotten_password_link' => 'Wachtwoord vergeten?', - 'reset_emailed' => 'We hebben je een link gemaild om je wachtwoord opnieuw in te stellen.', - 'reset_header' => 'Geen zorgen!
Vul hieronder gewoon je e-mailadres in en we sturen -je een link on je wachtwoord te resetten.', - 'reset_email_address' => 'Vul je e-mailadres in:', - 'reset_send_email' => 'Verstuur wachtwoord reset', - 'reset_enter_password' => 'Gelieve een nieuw wachtwoord in te voeren', - 'reset_new_password' => 'Nieuw wachtwoord:', - 'reset_change_password' => 'Wijzig wachtwoord', - 'reset_no_user_exists' => 'Er bestaat geen gebruiker met dit e-mailadres, gelieve opnieuw te proberen.', - 'reset_email_body' => 'Hallo %s, - -Je ontvangt deze email omdat jij, of iemand anders, je wachtwoord voor PHPCI opnieuw wenst in te stellen. - -Indien jij dit was, klik op deze link op je wachtwoord opnieuw in te stellen: %ssession/reset-password/%d/%s - -Zoniet, negeer deze e-mail en er zal geen verdere actie ondernomen worden. - -Bedankt, - -PHPCI', - - 'reset_email_title' => 'PHPCI wachtwoord reset voor %s', - 'reset_invalid' => 'Ongeldig wachtwoord reset verzoek', - 'email_address' => 'E-mailadres', - 'login' => 'Login / Email Address', - 'password' => 'Wachtwoord', - 'log_in' => 'Log in', - - - // Top Nav - 'toggle_navigation' => 'Wissel Navigatie', - 'n_builds_pending' => '%d builds wachtend', - 'n_builds_running' => '%d builds lopende', - 'edit_profile' => 'Wijzig profiel', - 'sign_out' => 'Uitloggen', - 'branch_x' => 'Branch: %s', - 'created_x' => 'Aangemaakt: %s', - 'started_x' => 'Gestart: %s', - - // Sidebar - 'hello_name' => 'Hallo, %s', - 'dashboard' => 'Startpagina', - 'admin_options' => 'Administratie opties', - 'add_project' => 'Project toevoegen', - 'settings' => 'Instellingen', - 'manage_users' => 'Gebruikers beheren', - 'plugins' => 'Plugins', - 'view' => 'Bekijk', - 'build_now' => 'Build nu', - 'edit_project' => 'Wijzig project', - 'delete_project' => 'Verwijder project', - - // Project Summary: - 'no_builds_yet' => 'Nog geen builds!', - 'x_of_x_failed' => '%d van de laatste %d builds faalden.', - 'x_of_x_failed_short' => '%d / %d faalden.', - 'last_successful_build' => 'De laatste succesvolle build was %s.', - 'never_built_successfully' => 'Dit project heeft geen succesvolle build gehad.', - 'all_builds_passed' => 'Elk van de laatste %d builds slaagden.', - 'all_builds_passed_short' => '%d / %d slaagden.', - 'last_failed_build' => 'De laatste gefaalde build was %s.', - 'never_failed_build' => 'Dit project heeft geen gefaalde build gehad.', - 'view_project' => 'Bekijk project', - - // Timeline: - 'latest_builds' => 'Laatste builds', - 'pending' => 'In afwachting', - 'running' => 'Lopende', - 'success' => 'Succes', - 'successful' => 'Succesvol', - 'failed' => 'Gefaald', - 'manual_build' => 'Manuele build', - - // Add/Edit Project: - 'new_project' => 'Nieuw project', - 'project_x_not_found' => 'Project met ID %d bestaat niet.', - 'project_details' => 'Project details', - 'public_key_help' => 'Om eenvoudiger te kunnen starten, hebben we een SSH sleutelpaar gegenereerd -voor dit project. Om het te gebruiken, voeg onderstaande public key toe aan de "deploy keys" sectie -van je gekozen source code hosting platform', - 'select_repository_type' => 'Selecteer repository type...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'Externe URL', - 'local' => 'Lokaal pad', - 'hg' => 'Mercurial', - - 'where_hosted' => 'Waar wordt je project gehost?', - 'choose_github' => 'Selecteer een GitHub repository:', - - 'repo_name' => 'Repository naam / URL (extern) of pad (lokaal)', - 'project_title' => 'Projecttitel', - 'project_private_key' => 'Private key voor toegang tot repository -(laat leeg voor lokaal en/of anonieme externen)', - 'build_config' => 'PHPCI build configuratie voor dit project -(indien je geen phpci.yml bestand aan de project repository kan toevoegen)', - 'default_branch' => 'Standaard branch naam', - 'allow_public_status' => 'Publieke statuspagina en afbeelding beschikbaar maken voor dit project?', - 'archived' => 'Archived', - 'archived_menu' => 'Archived', - 'save_project' => 'Project opslaan', - - 'error_mercurial' => 'Mercurial repository URL dient te starten met http:// of https://', - 'error_remote' => 'Repository URL dient te starten met git://, http:// of https://', - 'error_gitlab' => 'GitLab repository naam dient in het formaat "gebruiker@domain.tld/eigenaar/repo.git" te zijn', - 'error_github' => 'Repository naam dient in het formaat "eigenaar/repo" te zijn', - 'error_bitbucket' => 'Repository naam dient in het formaat "eigenaar/repo" te zijn', - 'error_path' => 'Het opgegeven pad bestaat niet.', - - // View Project: - 'all_branches' => 'Alle brances', - 'builds' => 'Builds', - 'id' => 'ID', - 'date' => 'Datum', - 'project' => 'Project', - 'commit' => 'Commit', - 'branch' => 'Branch', - 'status' => 'Status', - 'prev_link' => '« Vorig', - 'next_link' => 'Volgend »', - 'public_key' => 'Public Key', - 'delete_build' => 'Verwijder build', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Voor automatische builds wanneer nieuwe commits worden gepusht, dient onderstaande URL -als nieuwe "Webhook" in de Webhooks -and Services sectie van je GitHub repository toegevoegd worden.', - - 'webhooks_help_gitlab' => 'Voor automatische builds wanneer nieuwe commits worden gepusht, dient onderstaande URL -als nieuwe "Webhook URL" in de Web Hooks sectie van je GitLab repository toegevoegd worden.', - - 'webhooks_help_bitbucket' => 'Voor automatische builds wanneer nieuwe commits worden gepusht, dient onderstaande URL -als "POST" service in de in de - -Services sectie van je Bitbucket repository toegevoegd worden.', - - // View Build - 'build_x_not_found' => 'Build met ID %d bestaat niet.', - 'build_n' => 'Build %d', - 'rebuild_now' => 'Rebuild nu', - - - 'committed_by_x' => 'Committed door %s', - 'commit_id_x' => 'Commit: %s', - - 'chart_display' => 'Deze grafiek wordt getoond zodra de build compleet is.', - - 'build' => 'Build', - 'lines' => 'Lijnen', - 'comment_lines' => 'Commentaarlijnen', - 'noncomment_lines' => 'Niet-commentaarlijnen', - 'logical_lines' => 'Logische lijnen', - 'lines_of_code' => 'Lijnen code', - 'build_log' => 'Build Log', - 'quality_trend' => 'Kwaliteitstrend', - 'codeception_errors' => 'Codeception Fouten', - 'phpmd_warnings' => 'PHPMD Waarschuwingen', - 'phpcs_warnings' => 'PHPCS Waarschuwingen', - 'phpcs_errors' => 'PHPCS Fouten', - 'phplint_errors' => 'Lint Fouten', - 'phpunit_errors' => 'PHPUnit Fouten', - 'phpdoccheck_warnings' => 'Ontbrekende Docblocks', - 'issues' => 'Problemen', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Ontbrekende Docblocks', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHPUnit', - - 'file' => 'Bestand', - 'line' => 'Lijn', - 'class' => 'Class', - 'method' => 'Method', - 'message' => 'Boodschap', - 'start' => 'Start', - 'end' => 'Einde', - 'from' => 'Van', - 'to' => 'Tot', - 'result' => 'Resultaat', - 'ok' => 'OK', - 'took_n_seconds' => 'Duurde %d seconden', - 'build_created' => 'Build aangemaakt', - 'build_started' => 'Build gestart', - 'build_finished' => 'Build beëindigd', - 'test_message' => 'Message', - 'test_no_message' => 'No message', - 'test_success' => 'Successful: %d', - 'test_fail' => 'Failures: %d', - 'test_skipped' => 'Skipped: %d', - 'test_error' => 'Errors: %d', - 'test_todo' => 'Todos: %d', - 'test_total' => '%d test(s)', - - // Users - 'name' => 'Naam', - 'password_change' => 'Wachtwoord (laat leeg indien je niet wenst te veranderen)', - 'save' => 'Opslaan »', - 'update_your_details' => 'Wijzig je gegevens', - 'your_details_updated' => 'Je gegevens werden gewijzigd', - 'add_user' => 'Gebruiker toevoegen', - 'is_admin' => 'Is administrator?', - 'yes' => 'Ja', - 'no' => 'Nee', - 'edit' => 'Wijzig', - 'edit_user' => 'Gebruiker wijzigen', - 'delete_user' => 'Gebruiker wissen', - 'user_n_not_found' => 'Gebruiker met ID %d bestaat niet.', - 'is_user_admin' => 'Is deze gebruiker administrator?', - 'save_user' => 'Gebruiker opslaan', - - // Settings: - 'settings_saved' => 'Je instellingen werden opgeslagen.', - 'settings_check_perms' => 'Je instellingen konden niet worden opgeslagen, controleer de permissies van je config.yml bestand.', - 'settings_cannot_write' => 'PHPCI kan niet schrijven naar je config.yml bestand, instellingen worden mogelijks -niet goed opgeslagen tot dit opgelost is.', - 'settings_github_linked' => 'Je GitHub account werd gelinkt.', - 'settings_github_not_linked' => 'Je GitHub account kon niet gelinkt worden.', - 'build_settings' => 'Build instellingen', - 'github_application' => 'GitHub toepassing', - 'github_sign_in' => 'Vooraleer je GitHub kan gebruiken, dien je in te loggen en -PHPCI toegang te verlenen tot je account.', - 'github_phpci_linked' => 'PHP werd succesvol gelinkt aan je GitHub account.', - 'github_where_to_find' => 'Waar zijn deze te vinden...', - 'github_where_help' => 'Indien je eigenaar bent van de toepassing die je wens te gebruiken, kan je deze informatie -in je applications instellingen pagina vinden.', - - 'email_settings' => 'E-mail instellingen', - 'email_settings_help' => 'Vooraleer PHPCI je build status e-mails kan sturen, -dien je eerst je SMTP instellingen te configureren.', - - 'application_id' => 'Toepassings ID', - 'application_secret' => 'Toepassings geheime code', - - 'smtp_server' => 'SMTP Server', - 'smtp_port' => 'SMTP Poort', - 'smtp_username' => 'SMTP Gebruikersnaam', - 'smtp_password' => 'SMTP Wachtwoord', - 'from_email_address' => 'Van e-mailadres', - 'default_notification_address' => 'Standaard melding e-mailadres', - 'use_smtp_encryption' => 'SMTP Encryptie gebruiken?', - 'none' => 'Geen', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Beschouw een build gefaald na', - '5_mins' => '5 minuten', - '15_mins' => '15 minuten', - '30_mins' => '30 minuten', - '1_hour' => '1 uur', - '3_hours' => '3 uur', - - // Plugins - 'cannot_update_composer' => 'PHPCI kan composer.json niet aanpassen gezien het niet schrijfbaar is.', - 'x_has_been_removed' => '%s werd verwijderd.', - 'x_has_been_added' => '%s werd toegevoegd aan composer.json en zal geïnstalleerd worden de volgende -keer je composer update uitvoert.', - 'enabled_plugins' => 'Ingeschakelde plugins', - 'provided_by_package' => 'Voorzien door package', - 'installed_packages' => 'Geinstalleerde packages', - 'suggested_packages' => 'Voorgestelde packages', - 'title' => 'Titel', - 'description' => 'Beschrijving', - 'version' => 'Versie', - 'install' => 'Installeer »', - 'remove' => 'Verwijder »', - 'search_packagist_for_more' => 'Doorzoek Packagist naar meer packages', - 'search' => 'Zoek »', - - // Installer - 'installation_url' => 'PHPCI installatie URL', - 'db_host' => 'Database host', - 'db_name' => 'Database naam', - 'db_user' => 'Database gebruikersnaam', - 'db_pass' => 'Database wachtwoord', - 'admin_name' => 'Administrator naam', - 'admin_pass' => 'Administrator wachtwoord', - 'admin_email' => 'Administrator e-mailadres', - 'config_path' => 'Pad naar configuratiebestand', - 'install_phpci' => 'Installeer PHPCI', - 'welcome_to_phpci' => 'Welkom bij PHPCI', - 'please_answer' => 'Gelieve onderstaande vragen te beantwoorden:', - 'phpci_php_req' => 'PHPCI heeft ten minste PHP 5.3.8 nodig om te werken.', - 'extension_required' => 'Extensie benodigd: %s', - 'function_required' => 'PHPCI moet functie %s() kunnen aanroepen. Is deze uitgeschakeld in php.ini?', - 'requirements_not_met' => 'PHPCI kan niet worden geïnstalleerd omdat niet aan alle vereisten is voldaan. -Gelieve de fouten na te kijken vooraleer verder te gaan.', - 'must_be_valid_email' => 'Moet een geldig e-mailadres zijn.', - 'must_be_valid_url' => 'Moet een geldige URL zijn.', - 'enter_name' => 'Administrator naam: ', - 'enter_email' => 'Administrator e-mailadres: ', - 'enter_password' => 'Administrator wachtwoord: ', - 'enter_phpci_url' => 'Je PHPCI URL (bijvoorbeeld "http://phpci.local"): ', - - 'enter_db_host' => 'Vul je MySQL host in [localhost]: ', - 'enter_db_name' => 'Vul je MySQL databasenaam in [phpci]: ', - 'enter_db_user' => 'Vul je MySQL gebruikersnaam in [phpci]: ', - 'enter_db_pass' => 'Vul je MySQL watchtwoord in: ', - 'could_not_connect' => 'PHPCI kon met deze gegevens geen verbinding maken met MySQL. Gelieve opnieuw te proberen.', - 'setting_up_db' => 'Database wordt aangemaakt...', - 'user_created' => 'Gebruikersprofiel aangemaakt!', - 'failed_to_create' => 'PHPCI kon je administratorprofiel niet aanmaken.', - 'config_exists' => 'Het PHPCI configuratiebestand bestaat en is niet leeg.', - 'update_instead' => 'Liever phpci:update te gebruiken indien je PHPCI probeerde te updaten, ', - - // Update - 'update_phpci' => 'Update de database naar het beeld van gewijzigde modellen.', - 'updating_phpci' => 'PHPCI database wordt geüpdatet:', - 'not_installed' => 'PHPCI lijkt niet geïnstalleerd te zijn.', - 'install_instead' => 'Gelieve PHPCI via phpci:install te installeren.', - - // Poll Command - 'poll_github' => 'Poll GitHub om te controleren of we een build moeten starten.', - 'no_token' => 'Geen GitHub token gevonden', - 'finding_projects' => 'Vind projecten om te pollen', - 'found_n_projects' => '%d projecten gevonden', - 'last_commit_is' => 'Laatste commit naar GitHub voor %s is %s', - 'adding_new_build' => 'Laatste commit verschilt van database, nieuwe build wordt toegevoegd', - 'finished_processing_builds' => 'Verwerking builds voltooid.', - - // Create Admin - 'create_admin_user' => 'Administrator-gebruiker aanmaken', - 'incorrect_format' => 'Incorrect formaat', - - // Create Build Command - 'create_build_project' => 'Create a build for a project', - 'project_id_argument' => 'A project ID', - 'commit_id_option' => 'Commit ID to build', - 'branch_name_option' => 'Branch to build', - - // Run Command - 'run_all_pending' => 'Voer alle wachtende PHPCI builds uit.', - 'finding_builds' => 'Zoekt builds om te verwerken', - 'found_n_builds' => '%d builds gevonden', - 'skipping_build' => 'Build %d overslaan - Project build reeds aan de gang.', - 'marked_as_failed' => 'Build %d gemarkeerd als falende door timeout.', - - // Builder - 'missing_phpci_yml' => 'Dit project bevat geen phpci.yml bestand, of het is leeg.', - 'build_success' => 'BUILD SUCCES', - 'build_failed' => 'BUILD GEFAALD', - 'removing_build' => 'Build wordt verwijderd.', - 'exception' => 'Uitzondering:', - 'could_not_create_working' => 'Kon geen werkende kopie maken.', - 'working_copy_created' => 'Werkende kopie aangemaakt: %s', - 'looking_for_binary' => 'Zoekend naar binary: %s', - 'found_in_path' => 'Gevonden in %s: %s', - 'running_plugin' => 'UITVOEREN PLUGIN: %s', - 'plugin_success' => 'PLUGIN: SUCCES', - 'plugin_failed' => 'PLUGIN: GEFAALD', - 'plugin_missing' => 'Plugin bestaat niet: %s', - 'tap_version' => 'TapParser ondersteunt enkel TAP versie 13', - 'tap_error' => 'Ongeldige TAP string, aantal tests niet in overeenstemming met opgegeven aantal.', - - // Build Plugins: - 'no_tests_performed' => 'Er werden geen tests uitgevoerd.', - 'could_not_find' => 'Kon %s niet vinden', - 'no_campfire_settings' => 'Geen verbindingsparameters opgegeven voor Campfire plugin', - 'failed_to_wipe' => 'Kon bestaande map %s niet wissen voor kopie', - 'passing_build' => 'Slagende build', - 'failing_build' => 'Falende build', - 'log_output' => 'Log output:', - 'n_emails_sent' => '%d e-mails versuurd.', - 'n_emails_failed' => '%d e-mails faalden te versturen.', - 'unable_to_set_env' => 'Niet geslaagd om environment variable in te stellen', - 'tag_created' => 'Tag aangemaakt door PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% built op %BUILD_URI%', - 'hipchat_settings' => 'Gelieve kamer & authToken voor hipchat_notify plugin te definiëren', - 'irc_settings' => 'Je dient server, kamer & nick op te geven.', - 'invalid_command' => 'Ongeldig commando', - 'import_file_key' => 'Import statement moet \'file\' key bevatten', - 'cannot_open_import' => 'Het is niet mogelijk om het SQL bestand %s te openen', - 'unable_to_execute' => 'Het is niet mogelijk om het SQL bestand uit te voeren', - 'phar_internal_error' => 'Er is iets fout gegaan in de Phar Plugin', - 'build_file_missing' => 'Opgegeven build bestand bestaat niet.', - 'property_file_missing' => 'Opgegeven bestand bestaat niet', - 'could_not_process_report' => 'Het is niet mogelijk om het gegenereerde rapport van deze tool te verwerken.', - 'shell_not_enabled' => 'De shell plugin is niet ingeschakeld, schakel deze a.u.b. in via het config.yml bestand.' -); diff --git a/PHPCI/Languages/lang.pl.php b/PHPCI/Languages/lang.pl.php deleted file mode 100644 index e1d3c3bf..00000000 --- a/PHPCI/Languages/lang.pl.php +++ /dev/null @@ -1,400 +0,0 @@ - 'Polski', - 'language' => 'Język', - - // Log in: - 'log_in_to_phpci' => 'Zaloguj się do PHPCI', - 'login_error' => 'Nieprawidłowy email lub hasło', - 'forgotten_password_link' => 'Zapomniałeś hasła?', - 'reset_emailed' => 'Email z linkiem resetującym hasło został wysłany.', - 'reset_header' => 'Spokojnie!
Wpisz swój adres email w polu poniżej a my wyślemy Ci link -resetujący hasło.', - 'reset_email_address' => 'Podaj swój adres email:', - 'reset_send_email' => 'Wyślij reset hasła emailem', - 'reset_enter_password' => 'Wpisz nowe hasło', - 'reset_new_password' => 'Nowe hasło:', - 'reset_change_password' => 'Zmień hasło', - 'reset_no_user_exists' => 'Użytkownik o takim emailu nie istnieje. Spróbuj jeszcze raz.', - 'reset_email_body' => 'Witaj %s, - -Otrzymałeś ten email ponieważ Ty, lub ktoś inny, wysłał prośbę o zmianę hasła w PHPCI. - -Jeśli to faktycznie Ty, kliknij w następujący link aby zresetować hasło: %ssession/reset-password/%d/%s - -Jeśli nie, zignoruj tego emaila i wszystko pozostanie bez zmian, - -Pozdrawiamy, - -PHPCI', - - 'reset_email_title' => 'Reset Hasła PHPCI dla %s', - 'reset_invalid' => 'Prośba o zmianę hasła jest nieważna.', - 'email_address' => 'Adres email', - 'login' => 'Login / Email Address', - 'password' => 'Hasło', - 'log_in' => 'Zaloguj się', - - - // Top Nav - 'toggle_navigation' => 'Otwórz/zamknij nawigację', - 'n_builds_pending' => '%d budowań w kolejce', - 'n_builds_running' => '%d budowań w toku', - 'edit_profile' => 'Edytuj Profil', - 'sign_out' => 'Wyloguj się', - 'branch_x' => 'Gałąź: %s', - 'created_x' => 'Utworzono: %s', - 'started_x' => 'Rozpoczęto: %s', - - // Sidebar - 'hello_name' => 'Witaj, %s', - 'dashboard' => 'Panel administracyjny', - 'admin_options' => 'Opcje Administratora', - 'add_project' => 'Dodaj Projekt', - 'settings' => 'Ustawienia', - 'manage_users' => 'Zarządaj Uzytkownikami', - 'plugins' => 'Pluginy', - 'view' => 'Podgląd', - 'build_now' => 'Zbuduj', - 'edit_project' => 'Edytuj Projekt', - 'delete_project' => 'Usuń Projekt', - - // Project Summary: - 'no_builds_yet' => 'Brak budowań!', - 'x_of_x_failed' => '%d z ostatnich %d budowań nie powiodło się', - 'x_of_x_failed_short' => '%d / %d nie powiodło się', - 'last_successful_build' => 'Ostatnie budowanie zakończone sukesem odbyło się %s', - 'never_built_successfully' => 'Projekt nie został zbudowany z powodzeniem.', - 'all_builds_passed' => 'Wszystkie z ostatnich %d budowań przeszły.', - 'all_builds_passed_short' => '%d / %d przeszło.', - 'last_failed_build' => 'Ostatnie budowanie zakończone niepowodzeniam było %s.', - 'never_failed_build' => 'Ten projekt nigdy nie zakończył się niepowodzeniem budowania', - 'view_project' => 'Podgląd Projektu', - - // Timeline: - 'latest_builds' => 'Ostatnie Budowania', - 'pending' => 'Oczekujące', - 'running' => 'W toku', - 'success' => 'Sukces', - 'successful' => 'Zakończone sukcesem', - 'failed' => 'Nieudane', - 'manual_build' => 'Budowanie Manualne', - - // Add/Edit Project: - 'new_project' => 'Nowy Projekt', - 'project_x_not_found' => 'Projekt o ID %d nie istnieje.', - 'project_details' => 'Szczegóły Projektu', - 'public_key_help' => 'Aby łatwiej zacząć, wygenerowaliśmy parę kluczy SSH, które możesz użyć -do tego projektu. Żeby je użyć, wystarczy dodać następujący klucz publiczny do sekcji "wdrożyć klucze" -od wybranego kodu źródłowego platformy hostingowej.', - 'select_repository_type' => 'Wybierz typ repozytorium...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'Zdalny URL ', - 'local' => 'Lokalna Ścieżka ', - 'hg' => 'Mercurial', - 'svn' => 'Subversion', - - 'where_hosted' => 'Gdzie hostowany jest Twój projekt?', - 'choose_github' => 'Wybierz repozytorium GitHub:', - - 'repo_name' => 'Nazwa repozytorium / URL (Zdalne) lub Ścieżka (Lokalne)', - 'project_title' => 'Tytuł Projektu', - 'project_private_key' => 'Prywanty klucz dostępu do repozytoriów -(pozostaw puste pole dla zdalnych lokalnych i/lub anonimowych)', - 'build_config' => 'PHPCI zbudowało config dla tego projektu -(jeśli nie możesz dodać pliku phpci.yml do repozytorium projektu)', - 'default_branch' => 'Domyślna nazwa gałęzi', - 'allow_public_status' => 'Włączyć status publiczny dla tego projektu?', - 'archived' => 'W archiwum', - 'archived_menu' => 'W archiwum', - 'save_project' => 'Zachowaj Projekt', - - 'error_mercurial' => 'URL repozytorium Mercurialnego powinno zaczynać się od http:// and https://', - 'error_remote' => 'URL repozytorium powinno zaczynać się od git://, http:// lub https://', - 'error_gitlab' => 'Nazwa Repozytorium GitLab powinna być w następującym formacie: "user@domain.tld:owner/repo.git"', - 'error_github' => 'Nazwa repozytorium powinna być w formacie: "użytkownik/repo"', - 'error_bitbucket' => 'Nazwa repozytorium powinna być w formacie: " użytkownik/repo\'', - 'error_path' => 'Wybrana sieżka nie istnieje', - - // View Project: - 'all_branches' => 'Wszystkie Gałęzie', - 'builds' => 'Budowania', - 'id' => 'ID', - 'date' => 'Data', - 'project' => 'Projekt', - 'commit' => 'Commit', - 'branch' => 'Gałąź', - 'status' => 'Status', - 'prev_link' => '« Poprzedni', - 'next_link' => 'Następny »', - 'public_key' => 'Klucz Publiczny', - 'delete_build' => 'Usuń Budowanie', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Aby automatycznie uruchomić nową budowę po wysłaniu commitów dodaj poniższy adres URL - jako nowy "WebHook" w sekcji Webhooks and Services - Twojego repozytoria GitLab.', - - 'webhooks_help_gitlab' => 'Aby automatycznie uruchomić nową budowę po wysłaniu commitów dodaj poniższy adres URL - jako "WebHook URL" w sekcji Web Hook Twojego repozytoria GitLab.', - - 'webhooks_help_bitbucket' => 'Aby automatycznie uruchomić nową budowę po wysłaniu commitów, dodaj poniższy adres URL - jako usługę "POST" w sekcji - -Services repozytoria Bitbucket.', - - // View Build - 'build_x_not_found' => 'Budowanie o ID %d nie istnieje.', - 'build_n' => 'Budowanie %d', - 'rebuild_now' => 'Przebuduj Teraz', - - - 'committed_by_x' => 'Commitowane przez %s', - 'commit_id_x' => 'Commit: %s', - - 'chart_display' => 'Ten wykres wyświetli się po zakończeniu budowy.', - - 'build' => 'Budowanie', - 'lines' => 'Linie', - 'comment_lines' => 'Linie Komentarza', - 'noncomment_lines' => 'Linie Bez Komentarza', - 'logical_lines' => 'Lokalne Linie', - 'lines_of_code' => 'Linie Kodu', - 'build_log' => 'Log Budowania', - 'quality_trend' => 'Trend Jakości', - 'codeception_errors' => 'Błędy Codeception', - 'phpmd_warnings' => 'Alerty PHPMD', - 'phpcs_warnings' => 'Alerty PHPCS', - 'phpcs_errors' => 'Błędy PHPCS', - 'phplint_errors' => 'Błędy Lint', - 'phpunit_errors' => 'Błędy PHPUnit', - 'phpdoccheck_warnings' => 'Brakuje sekcji DocBlock', - 'issues' => 'Problemy', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Brakuje sekcji DocBlock', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHPSpec', - 'phpunit' => 'PHPUnit', - 'technical_debt' => 'Dług technologiczny', - 'behat' => 'Behat', - - 'file' => 'Plik', - 'line' => 'Linia', - 'class' => 'Klasa', - 'method' => 'Metoda', - 'message' => 'Wiadomość', - 'start' => 'Początek', - 'end' => 'Koniec', - 'from' => 'Od', - 'to' => 'Do', - 'result' => 'Wynik', - 'ok' => 'OK', - 'took_n_seconds' => 'Zajęło %d sekund', - 'build_created' => 'Budowanie Stworzone', - 'build_started' => 'Budowanie Rozpoczęte', - 'build_finished' => 'Budowanie Zakończone', - 'test_message' => 'Wiadomość', - 'test_no_message' => 'Brak wiadomości', - 'test_success' => 'Powodzenie: %d', - 'test_fail' => 'Niepowodzenia: %d', - 'test_skipped' => 'Pominęte: %d', - 'test_error' => 'Błędy: %d', - 'test_todo' => 'Do zrobienia: %d', - 'test_total' => '%d test(ów)', - - // Users - 'name' => 'Nazwa', - 'password_change' => 'Hasło (pozostaw puste jeśli nie chcesz zmienić hasła)', - 'save' => 'Zapisz »', - 'update_your_details' => 'Aktualizuj swoje dane', - 'your_details_updated' => 'Twoje dane zostały zaktualizowane.', - 'add_user' => 'Dodaj Użytkownika', - 'is_admin' => 'Jest Adminem?', - 'yes' => 'Tak', - 'no' => 'Nie', - 'edit' => 'Edytuj', - 'edit_user' => 'Edytuj Użytkownika', - 'delete_user' => 'Usuń Użytkownika', - 'user_n_not_found' => 'Użytkownik z ID %d nie istnieje.', - 'is_user_admin' => 'Czy użytkownik jest administratorem?', - 'save_user' => 'Zapisz Użytkownika', - - // Settings: - 'settings_saved' => 'Ustawienia zostały zapisane.', - 'settings_check_perms' => 'Twoje ustawienia nie mogły zostać zapisane. Sprawdź uprawnienia do pliku config.yml.', - 'settings_cannot_write' => 'PHPCI nie może zapisać do pliku config.yml. Dopóty nie będzie można poprawnie zachować ustawie, -dopóki nie będzie to naprawione.', - 'settings_github_linked' => 'Połaczono z Twoim kontem Github', - 'settings_github_not_linked' => 'Nie udało się połaczyć z Twoim kontem Github', - 'build_settings' => 'Ustawienia budowania', - 'github_application' => 'Aplikacja GitHub', - 'github_sign_in' => 'Zanim będzie można zacząć korzystać z GitHub, musisz najpierw Sign in, a następnie udzielić dostęp dla PHPCI do Twojego konta.', - 'github_phpci_linked' => 'PHPCI zostało pomyślnie połączone z konten GitHub.', - 'github_where_to_find' => 'Gdzie można znaleźć...', - 'github_where_help' => 'Jeśli to jest Twoja aplikacjia i chcesz jej użyć to więcej informacji znajdziesz w sekcji ustawień: - applications', - - 'email_settings' => 'Ustawienia Email', - 'email_settings_help' => 'Aby PHPCI mógł wysyłać emaile z stanem budowy, musisz najpierw skonfigurować poniższe ustawienia SMTP.', - - 'application_id' => 'ID Aplikacji', - 'application_secret' => 'Klucz Secret aplikacji', - - 'smtp_server' => 'Serwer SMTP', - 'smtp_port' => 'Port SMTP', - 'smtp_username' => 'SMTP Login', - 'smtp_password' => 'Hasło SMTP', - 'from_email_address' => 'E-mail adres Od:', - 'default_notification_address' => 'Domyślny adres email powiadamiania', - 'use_smtp_encryption' => 'Użyć szyfrowane SMTP?', - 'none' => 'Żadne', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Uznaj, że budowanie nie powiodło się po', - '5_mins' => '5 Minutach', - '15_mins' => '15 Minutach', - '30_mins' => '30 Minutach', - '1_hour' => '1 Godzinie', - '3_hours' => '3 Godzinach', - - // Plugins - 'cannot_update_composer' => 'PHPCI nie może zaktualizować copmposer.json, ponieważ nie ma uprawnień do zapisu.', - 'x_has_been_removed' => 'Usunięto %s. ', - 'x_has_been_added' => 'Dodano %s do composer.json. Zostanie zainstalowane po -wywołaniu polecenia composer update.', - 'enabled_plugins' => 'Aktywne Pluginy', - 'provided_by_package' => 'Dostarczone w pakiecie', - 'installed_packages' => 'Zainstalowane Pakiety', - 'suggested_packages' => 'Sugerowane Pakiety', - 'title' => 'Tytuł', - 'description' => 'Opis', - 'version' => 'Wersja', - 'install' => 'Zainstaluj »', - 'remove' => 'Usuń »', - 'search_packagist_for_more' => 'Przeszukaj Packagist po więcej pakietów', - 'search' => 'Szukaj »', - - // Installer - 'installation_url' => 'URL instalacyjny PHPCI', - 'db_host' => 'Host Bazy Danych', - 'db_name' => 'Nazwa Bazy Danych', - 'db_user' => 'Nazwa Użytkownika Bazy Danych', - 'db_pass' => 'Hasło Bazy Danych', - 'admin_name' => 'Imię Admina', - 'admin_pass' => 'Hasło Admina', - 'admin_email' => 'Adres Email Admina', - 'config_path' => 'Ścieżka Pliku Config', - 'install_phpci' => 'Zainstaluj PHPCI', - 'welcome_to_phpci' => 'Witaj w PHPCI', - 'please_answer' => 'Odpowiedz na poniższe pytania:', - 'phpci_php_req' => 'PHPCI wymaga przynajmniej PHP 5.3.8 do prawidłowego funkcjonowania.', - 'extension_required' => 'Wymagane rozszerzenie: %s', - 'function_required' => 'PHPCI musi mieć możliwość wywołania funkcji %s(). Czy ona jest wyłączona w php.ini?', - 'requirements_not_met' => 'Nie można zainstalować PHPCI, ponieważ nie wszystkie wymagania zostały spełnione. -Przejrzyj powyższą listę błędów przed kontynuowaniem.', - 'must_be_valid_email' => 'Poprawny adres email jest wymagany.', - 'must_be_valid_url' => 'Poprawny URL jest wymagany.', - 'enter_name' => 'Imię Admina: ', - 'enter_email' => 'Email Admina: ', - 'enter_password' => 'Hasło Admina: ', - 'enter_phpci_url' => 'URL PHPCI (na przykład "http://phpci.local"): ', - - 'enter_db_host' => 'Wpisz hosta MySQL [host lokalny]: ', - 'enter_db_name' => 'Wpisz nazwę bazy danych MySQL [phpci]: ', - 'enter_db_user' => 'Wpisz nazwę użytkownika MySQL [phpci]: ', - 'enter_db_pass' => 'Wpisz hasło MySQL: ', - 'could_not_connect' => 'Z podanymi ustawieniami PHPCI nie udało się połączyć z MySQL. Spróbuj ponownie.', - 'setting_up_db' => 'Ustawianie Twojej bazy danych...', - 'user_created' => 'Utworzono konto użytkownika!', - 'failed_to_create' => 'PHPCI nie udało się założyc Twojego konta administratora.', - 'config_exists' => 'Plik konfiguracji PHPCI istnieje i nie jest pusty.', - 'update_instead' => 'Jeśli próbowałeś zaktualizować PHPCI, użyj phpci:update.', - - // Update - 'update_phpci' => 'Zaktualizuj bazę danych zgodnie ze zmodyfikowanymi modelami.', - 'updating_phpci' => 'Aktualizacja bazy danych PHPCI:', - 'not_installed' => 'Wygląda na to, że PHPCI nie jest zainstalowane.', - 'install_instead' => 'Proszę zainstalować PHPCI poprzez phpci:install', - - // Poll Command - 'poll_github' => 'Odpytuj GitHub, aby sprawdzić czy należy uruchomić budowę.', - 'no_token' => 'Nie znaleziono tokena GitHub', - 'finding_projects' => 'Szukanie projektów do odpytywania', - 'found_n_projects' => 'Znaleziono %d projektów', - 'last_commit_is' => 'Ostatni commit do GitHuba dla %s to %s', - 'adding_new_build' => 'Ostatni commit jest inny w bazie danych, dodaję nową budowę.', - 'finished_processing_builds' => 'Ukończono przetwarzanie budów.', - - // Create Admin - 'create_admin_user' => 'Utwórz admina', - 'incorrect_format' => 'Niepoprawny format', - - // Create Build Command - 'create_build_project' => 'Utwórz budowanie dla projektu', - 'project_id_argument' => 'ID projektu', - 'commit_id_option' => 'ID Commita do budowania', - 'branch_name_option' => 'Gałąź do budowania', - - // Run Command - 'run_all_pending' => 'Uruchom wszystkie oczekujące budowy w PHPCI', - 'finding_builds' => 'Szukam budów do przetwarzania.', - 'found_n_builds' => 'Znaleziono %d budowań', - 'skipping_build' => 'Budowanie %d jest pomijane - Budowanie projektu jest już w toku', - 'marked_as_failed' => 'Budowanie %d nie powiodło się z powodu przekroczenia limitu czasu.', - - // Builder - 'missing_phpci_yml' => 'Projekt nie zawiera pliku phpci.yml lub projekt jest pusty.', - 'build_success' => 'BUDOWANIE ZAKOŃCZONE SUKCESEM', - 'build_failed' => 'BUDOWANIE NIE POWIODŁO SIĘ', - 'removing_build' => 'Usuwanie Budowania.', - 'exception' => 'Wyjątek:', - 'could_not_create_working' => 'Nie można utworzyć wersji roboczej.', - 'working_copy_created' => 'Stworzono wersję roboczą: %s', - 'looking_for_binary' => 'Szukam binarek: %s', - 'found_in_path' => 'Znaleziono w %s: %s', - 'running_plugin' => 'Uruchomiony Plugin: %s', - 'plugin_success' => 'Plugin: Sukces', - 'plugin_failed' => 'Plugin: Niepowodzenie', - 'plugin_missing' => 'Plugin nie istnieje: %s', - 'tap_version' => 'TapParser obsługuje tylko TAP w wersji 13', - 'tap_error' => 'Nieprawidłowy łańcuch TAP, liczba testów nie zgadza się z policzoną ilością testów.', - - // Build Plugins: - 'no_tests_performed' => 'Nie przeprowadzono żadnych testów.', - 'could_not_find' => 'Nie znaleziono %s', - 'no_campfire_settings' => 'Nie zdefiniowano parametrów połączenia dla pluginu Campfire', - 'failed_to_wipe' => 'Nie udało się wyczyścić istniejącego katalogu %s przed kopiowaniem', - 'passing_build' => 'Pomijanie Budowania', - 'failing_build' => 'Niepowodzenie Budowania', - 'log_output' => 'Log Wyjściowy:', - 'n_emails_sent' => 'Wysłano %d emaili.', - 'n_emails_failed' => 'Nie wysłano %d emaili.', - 'unable_to_set_env' => 'Nie można ustawić zmiennej środowiskowej', - 'tag_created' => 'Tag stworzony przez PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% zbudowano pod %BUILD_URI%', - 'hipchat_settings' => 'Proszę podać pokój i authToken dla pluginu hipchat_notify.', - 'irc_settings' => 'Musisz skonfigurować serwer, pokój i swoją nazwę.', - 'invalid_command' => 'Nieprawidłowe polecenie', - 'import_file_key' => 'Potwierdzenie importu musi zawierać klucz "plik"', - 'cannot_open_import' => 'Nie można otworzyć importowanego pliku SQL: %s', - 'unable_to_execute' => 'Nie można wykonać pliku SQL', - 'phar_internal_error' => 'Wewnętrzny Błąd Pluginu Phar', - 'build_file_missing' => 'Podany plik budowy nie istnieje.', - 'property_file_missing' => 'Podany plik właściwości nie istnieje.', - 'could_not_process_report' => 'Nie udało się przetworzyć raportu wygenerowanego przez to narzędzie.', - 'shell_not_enabled' => 'Plugin powłoki jest nieaktywny. Aktywuj go poprzez config.yml.' -); diff --git a/PHPCI/Languages/lang.ru.php b/PHPCI/Languages/lang.ru.php deleted file mode 100644 index 0a7acff2..00000000 --- a/PHPCI/Languages/lang.ru.php +++ /dev/null @@ -1,412 +0,0 @@ - 'Pусский', - 'language' => 'язык', - - // Log in: - 'log_in_to_phpci' => 'Войти в PHPCI', - 'login_error' => 'Неправильный email или пароль', - 'forgotten_password_link' => 'Забыли пароль?', - 'reset_emailed' => 'Вы получите письмо со ссылкой на сброс пароля.', - 'reset_header' => 'Не волнуйтесь!
Просто введите ваш email, и вам придет письмо со ссылкой на сброс пароля.', - 'reset_email_address' => 'Введите ваш email:', - 'reset_send_email' => 'Сброс пароля', - 'reset_enter_password' => 'Пожалуйста, введите новый пароль', - 'reset_new_password' => 'Новый пароль:', - 'reset_change_password' => 'Сменить пароль', - 'reset_no_user_exists' => 'Пользователь с таким email-адресом не найден, пожалуйста, попробуйте еще раз.', - 'reset_email_body' => 'Привет %s, - -Вы получили это письмо, потому что вы или кто-то другой запросили сброс пароля в PHPCI. - -Если это были вы, пожалуйста, перейдите по ссылке для сброса пароля: %ssession/reset-password/%d/%s, - -иначе игнорируйте это письмо и ничего не предпринимайте. - -Спасибо, - -PHPCI', - - 'reset_email_title' => 'Сброс пароля PHPCI для %s', - 'reset_invalid' => 'Некорректный запрос на сброс пароля.', - 'email_address' => 'Email', - 'login' => 'Логин / Email', - 'password' => 'Пароль', - 'log_in' => 'Войти', - - // Top Nav - 'toggle_navigation' => 'Скрыть/показать панель навигации', - 'n_builds_pending' => '%d сборок ожидает', - 'n_builds_running' => '%d сборок запущено', - 'edit_profile' => 'Редактировать профиль', - 'sign_out' => 'Выйти', - 'branch_x' => 'Ветка: %s', - 'created_x' => 'Создан: %s', - 'started_x' => 'Запущен: %s', - - // Sidebar - 'hello_name' => 'Привет, %s', - 'dashboard' => 'Панель управления', - 'admin_options' => 'Меню администратора', - 'add_project' => 'Добавить проект', - 'settings' => 'Настройки', - 'manage_users' => 'Пользователи', - 'plugins' => 'Плагины', - 'view' => 'Отчет', - 'build_now' => 'Собрать', - 'edit_project' => 'Редактировать проект', - 'delete_project' => 'Удалить проект', - - // Project Summary: - 'no_builds_yet' => 'Нет сборок!', - 'x_of_x_failed' => '%d из последних %d сборок были провалены.', - 'x_of_x_failed_short' => '%d / %d провалены.', - 'last_successful_build' => ' Последняя успешная сборка была %s.', - 'never_built_successfully' => ' Этот проект никогда не собирался успешно.', - 'all_builds_passed' => 'Все последние сборки (%d) прошли успешно.', - 'all_builds_passed_short' => '%d / %d успешные.', - 'last_failed_build' => ' Последней проваленной сборкой была %s.', - 'never_failed_build' => ' У этого проекта никогда не было проваленных сборок.', - 'view_project' => 'Обзор проекта', - - // Timeline: - 'latest_builds' => 'Последние сборки', - 'pending' => 'Ожидает', - 'running' => 'Запущена', - 'success' => 'Успешно', - 'successful' => 'Успешна', - 'failed' => 'Провалена', - 'manual_build' => 'Запущена вручную', - - // Add/Edit Project: - 'new_project' => 'Новый проект', - 'project_x_not_found' => 'Проекта с ID %d не существует.', - 'project_details' => 'Подробности проекта', - 'public_key_help' => 'Чтобы было легче начать, мы сгенерировали пару SSH-ключей для использования в вашем проекте. - Для их использования, просто добавьте эту публичную часть ключа в поле "deploy keys" на выбранном вами хостинге исходного кода.', - 'select_repository_type' => 'Выберите тип репозитория...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'Внешний URL', - 'local' => 'Локальный путь', - 'hg' => 'Mercurial', - 'svn' => 'Subversion', - - 'where_hosted' => 'Расположение проекта', - 'choose_github' => 'Выберите GitHub репозиторий:', - - 'repo_name' => 'Репозиторий / Внешний URL / Локальный путь', - 'project_title' => 'Название проекта', - 'project_private_key' => 'Приватный ключ для доступа к репозиторию - (оставьте поле пустым для локального использования и/или анонимного доступа)', - 'build_config' => 'Конфигурация сборки проекта для PHPCI - (если вы не добавили файл phpci.yml в репозиторий вашего проекта)', - 'default_branch' => 'Ветка по умолчанию', - 'allow_public_status' => 'Разрешить публичный статус и изображение (статуса) для проекта', - 'archived' => 'Архивный', - 'archived_menu' => 'Архив', - 'save_project' => 'Сохранить проект', - - 'error_mercurial' => 'URL репозитория Mercurial должен начинаться с http:// или https://', - 'error_remote' => 'URL репозитория должен начинаться с git://, http:// или https://', - 'error_gitlab' => 'Имя репозитория в GitLab должно иметь формат: "user@domain.tld:owner/repo.git"', - 'error_github' => 'Имя репозитория должно иметь формат: "owner/repo"', - 'error_bitbucket' => 'Имя репозитория должно иметь формат: "owner/repo"', - 'error_path' => 'Пути, который вы указали, не существует.', - - // View Project: - 'all_branches' => 'Все ветки', - 'builds' => 'Сборки', - 'id' => 'ID', - 'date' => 'Дата', - 'project' => 'Проект', - 'commit' => 'Коммит', - 'branch' => 'Ветка', - 'status' => 'Статус', - 'prev_link' => '« Пред.', - 'next_link' => 'След. »', - 'public_key' => 'Публичный ключ', - 'delete_build' => 'Удалить сборку', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже в качестве нового хука в разделе настроек Webhooks - and Services вашего GitHub репозитория.', - - 'webhooks_help_gitlab' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже в качестве "WebHook URL" - в разделе "Web Hooks" вашего GitLab репозитория.', - - 'webhooks_help_bitbucket' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже как "POST" сервис в разделе - Services вашего Bitbucket репозитория.', - - // View Build - 'build_x_not_found' => 'Сборки с ID %d не существует.', - 'build_n' => 'Сборка %d', - 'rebuild_now' => 'Пересобрать сейчас', - - - 'committed_by_x' => 'Отправил %s', - 'commit_id_x' => 'Коммит: %s', - - 'chart_display' => 'Этот график будет показан после окончания сборки.', - - 'build' => 'Сборка', - 'lines' => 'Строк', - 'comment_lines' => 'Строк комментариев', - 'noncomment_lines' => 'Строк некомментариев', - 'logical_lines' => 'Строк логики', - 'lines_of_code' => 'Строк кода', - 'build_log' => 'Лог сборки', - 'quality_trend' => 'Тенденция качества', - 'codeception_errors' => 'Ошибки Codeception', - 'phpmd_warnings' => 'Предупреждения PHPMD', - 'phpcs_warnings' => 'Предупреждения PHPCS', - 'phpcs_errors' => 'Ошибки PHPCS', - 'phplint_errors' => 'Ошибки Lint', - 'phpunit_errors' => 'Ошибки PHPUnit', - 'phpdoccheck_warnings' => 'Пропущенные Docblocks', - 'issues' => 'Проблемы', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Missing Docblocks', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - 'technical_debt' => 'Технические долги', - 'behat' => 'Behat', - - 'codeception_feature' => 'Свойство', - 'codeception_suite' => 'Набор', - 'codeception_time' => 'Время', - 'codeception_synopsis' => 'Тестов выполнено: %1$d (за %2$f сек.). Провалов: %3$d.', - - 'file' => 'Файл', - 'line' => 'Строка', - 'class' => 'Класс', - 'method' => 'Метод', - 'message' => 'Сообщение', - 'start' => 'Начало', - 'end' => 'Конец', - 'from' => 'Из', - 'to' => 'В', - 'result' => 'Результат', - 'ok' => 'OK', - 'took_n_seconds' => 'Заняло секунд: %d', - 'build_created' => 'Сборка создана', - 'build_started' => 'Сборка запущена', - 'build_finished' => 'Сборка окончена', - 'test_message' => 'Message', - 'test_no_message' => 'No message', - 'test_success' => 'Успешно: %d', - 'test_fail' => 'Провалено: %d', - 'test_skipped' => 'Пропущено: %d', - 'test_error' => 'Ошибок: %d', - 'test_todo' => 'Todo: %d', - 'test_total' => 'Тестов: %d', - - // Users - 'name' => 'Имя', - 'password_change' => 'Пароль (оставьте поле пустым, если не собираетесь менять его)', - 'save' => 'Сохранить »', - 'update_your_details' => 'Обновить свои данные', - 'your_details_updated' => 'Ваши данные были обновлены.', - 'add_user' => 'Добавить пользователя', - 'is_admin' => 'Является администратором', - 'yes' => 'Да', - 'no' => 'Нет', - 'edit' => 'Править', - 'edit_user' => 'Редактировать пользователя', - 'delete_user' => 'Удалить пользователя', - 'user_n_not_found' => 'Пользователя с ID %d не существует.', - 'is_user_admin' => 'Этот пользователь является администратором', - 'save_user' => 'Сохранить пользователя', - - // Settings: - 'settings_saved' => 'Ваши настройки были сохранены.', - 'settings_check_perms' => 'Ваши настройки не могут быть сохранены, проверьте права на файл настроек config.yml.', - 'settings_cannot_write' => 'PHPCI не может записать config.yml файл, настройки не могут быть сохранены корректно, пока это не будет исправлено.', - 'settings_github_linked' => 'Ваш GitHub аккаунт привязан.', - 'settings_github_not_linked' => 'Ваш GitHub аккаунт не может быть привязан.', - 'build_settings' => 'Настройки сборки', - 'github_application' => 'GitHub приложение', - 'github_sign_in' => 'Перед тем как начать использовать GitHub аккаунт, вам необходимо войти и разрешить доступ для - PHPCI до вашего аккаунта.', - 'github_phpci_linked' => 'PHPCI успешно привязал GitHub аккаунт.', - 'github_where_to_find' => 'Где это найти...', - 'github_where_help' => 'Если вы владелец приложения, которое вы хотели бы использовать, то вы можете найти информацию об этом в разделе - applications настроек.', - - 'email_settings' => 'Настройки email', - 'email_settings_help' => 'Перед тем, как PHPCI начнет отсылать статус сборок по почте, - вам необходимо настроить параметры SMTP ниже.', - - 'application_id' => 'ID приложения', - 'application_secret' => 'Секретный ключ приложения', - - 'smtp_server' => 'SMTP сервер', - 'smtp_port' => 'SMTP порт', - 'smtp_username' => 'SMTP пользователь', - 'smtp_password' => 'SMTP пароль', - 'from_email_address' => 'Отправлять с email', - 'default_notification_address' => 'Email по умолчанию для оповещений', - 'use_smtp_encryption' => 'Использовать SMTP шифрование', - 'none' => 'Нет', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Признать сборку проваленной по прошествии', - '5_mins' => '5 минут', - '15_mins' => '15 минут', - '30_mins' => '30 минут', - '1_hour' => '1 часа', - '3_hours' => '3 часов', - - // Plugins - 'cannot_update_composer' => 'PHPCI не может обновить composer.json, если он недоступен на запись.', - 'x_has_been_removed' => '%s был удален.', - 'x_has_been_added' => '%s был добавлен в composer.json и будет установлен, как только вы запустите composer update.', - 'enabled_plugins' => 'Включенные плагины', - 'provided_by_package' => 'Предоставляется пакетом', - 'installed_packages' => 'Установленные пакеты', - 'suggested_packages' => 'Рекомендуемые пакеты', - 'title' => 'Название', - 'description' => 'Описание', - 'version' => 'Версия', - 'install' => 'Установить »', - 'remove' => 'Удалить »', - 'search_packagist_for_more' => 'Искать на Packagist', - 'search' => 'Искать »', - - // Summary plugin - 'build-summary' => 'Сводка', - 'stage' => 'Этап', - 'duration' => 'Продолжительность', - 'plugin' => 'Плагин', - 'stage_setup' => 'Установка', - 'stage_test' => 'тестирование', - 'stage_complete' => 'Завершение', - 'stage_success' => 'Успешное завершение', - 'stage_failure' => 'Провал', - 'stage_broken' => 'Поломка', - 'stage_fixed' => 'Исправление', - - // Installer - 'installation_url' => 'URL-адрес PHPCI для установки', - 'db_host' => 'Хост базы данных', - 'db_name' => 'Имя базы данных', - 'db_user' => 'Пользователь базы данных', - 'db_pass' => 'Пароль базы данных', - 'admin_name' => 'Имя администратора', - 'admin_pass' => 'Пароль администратора', - 'admin_email' => 'Email администратора', - 'config_path' => 'Путь до файла конфигурации', - 'install_phpci' => 'Установить PHPCI', - 'welcome_to_phpci' => 'Добро пожаловать в PHPCI', - 'please_answer' => 'Пожалуйста, ответьте на несколько вопросов:', - 'phpci_php_req' => 'PHPCI необходима для работы версия PHP не ниже 5.3.8.', - 'extension_required' => 'Требуется расширение PHP: %s', - 'function_required' => 'PHPCI необходима возможность вызывать %s() функцию. Она выключена в php.ini?', - 'requirements_not_met' => 'PHPCI не может быть установлен, пока не все требования выполнены. - Пожалуйста, просмотрите возникшие ошибки перед тем, как продолжить.', - 'must_be_valid_email' => 'Должен быть корректным email-адресом.', - 'must_be_valid_url' => 'Должен быть корректным URL-адресом.', - 'enter_name' => 'Имя администратора: ', - 'enter_email' => 'Email администратора: ', - 'enter_password' => 'Пароль администратора: ', - 'enter_phpci_url' => 'URL-адрес вашего PHPCI (например: "http://phpci.local"): ', - - 'enter_db_host' => 'Пожалуйста, введите хост MySQL [localhost]: ', - 'enter_db_name' => 'Пожалуйста, введите имя базы данных MySQL [phpci]: ', - 'enter_db_user' => 'Пожалуйста, введите пользователя MySQL [phpci]: ', - 'enter_db_pass' => 'Пожалуйста, введите пароль MySQL: ', - 'could_not_connect' => 'PHPCI не может подключится к MySQL с переданными параметрами. Пожалуйста, попробуйте еще раз.', - 'setting_up_db' => 'Установка базы данных... ', - 'user_created' => 'Аккаунт пользователя создан!', - 'failed_to_create' => 'PHPCI не удалось создать аккаунт администратора.', - 'config_exists' => 'Файл конфигурации PHPCI уже существует, и он не пустой.', - 'update_instead' => 'Если вы собираетесь обновить PHPCI, пожалуйста, используйте команду phpci:update.', - - // Update - 'update_phpci' => 'Обновите базу данных с учетом обновленных моделей.', - 'updating_phpci' => 'Обновление базы данных PHPCI: ', - 'not_installed' => 'PHPCI не может быть установлен.', - 'install_instead' => 'Пожалуйста, установите PHPCI с помощью команды phpci:install.', - - // Poll Command - 'poll_github' => 'Опрос GitHub для проверки запуска сборки.', - 'no_token' => 'GitHub токен не найден', - 'finding_projects' => 'Поиск проектов для опроса', - 'found_n_projects' => 'Найдено проектов: %d', - 'last_commit_is' => 'Последний коммит на GitHub для %s - %s', - 'adding_new_build' => 'Последний коммит имеет различия с базой данных, создана сборка.', - 'finished_processing_builds' => 'Процесс сборки завершен.', - - // Create Admin - 'create_admin_user' => 'Добавить аккаунт администратора', - 'incorrect_format' => 'Неверный формат', - - // Create Build Command - 'create_build_project' => 'Создать сборку проекта', - 'project_id_argument' => 'ID проекта', - 'commit_id_option' => 'ID коммита для сборки', - 'branch_name_option' => 'Ветка для сборки', - - // Run Command - 'run_all_pending' => 'Запустить все ожидающие PHPCI сборки.', - 'finding_builds' => 'Поиск сборок для запуска', - 'found_n_builds' => 'Найдено сборок: %d', - 'skipping_build' => 'Сборка %d пропущена - Сборка проекта уже идет.', - 'marked_as_failed' => 'Сборка %d отмечена как неудавшаяся из-за превышения лимита времени.', - - // Builder - 'missing_phpci_yml' => 'Этот проект не содержит файла phpci.yml, или файл пустой.', - 'build_success' => 'СБОРКА УСПЕШНА', - 'build_failed' => 'СБОРКА ПРОВАЛЕНА', - 'removing_build' => 'Удаление сборки.', - 'exception' => 'Исключение: ', - 'could_not_create_working' => 'Не удалось создать рабочую копию.', - 'working_copy_created' => 'Рабочая копия создана: %s', - 'looking_for_binary' => 'Поиск пакета: %s', - 'found_in_path' => 'Найден в %s: %s', - 'running_plugin' => 'ЗАПУЩЕН ПЛАГИН: %s', - 'plugin_success' => 'ПЛАГИН: УСПЕШНО', - 'plugin_failed' => 'ПЛАГИН: ПРОВАЛ', - 'plugin_missing' => 'Плагина не существует: %s', - 'tap_version' => 'TapParser поддерживает только TAP версии 13', - 'tap_error' => 'Некорректная TAP-строка, количество тестов не совпадает с заявленным.', - - // Build Plugins: - 'no_tests_performed' => 'Никакие тесты не были запущены.', - 'could_not_find' => 'Не удается найти %s', - 'no_campfire_settings' => 'Не переданы параметры подключения для плагина Campfire', - 'failed_to_wipe' => 'Не удалось уничтожить существующую директорию %s перед копированием', - 'passing_build' => 'Успех сборки', - 'failing_build' => 'Провал сборки', - 'log_output' => 'Вывод лога: ', - 'n_emails_sent' => 'Писем отправлено: %d.', - 'n_emails_failed' => 'Писем не удалось отправить: %d.', - 'unable_to_set_env' => 'Невозможно установить переменную окружения', - 'tag_created' => 'Метка создана PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% собран: %BUILD_URI%', - 'hipchat_settings' => 'Пожалуйста, укажите комнату и токен (authToken) для плагина hipchat_notify', - 'irc_settings' => 'Вы должны задать сервер, комнату и ник.', - 'invalid_command' => 'Некорректная команда', - 'import_file_key' => 'Выражение импорта должно содержать ключ \'file\'', - 'cannot_open_import' => 'Не удалось открыть файл SQL для импорта: %s', - 'unable_to_execute' => 'Невозможно выполнить файл SQL', - 'phar_internal_error' => 'Внутренняя ошибка плагина Phar', - 'build_file_missing' => 'Указанного файла сборки не существует.', - 'property_file_missing' => 'Указанного файла сборки не существует.', - 'could_not_process_report' => 'Невозможно обработать отчет этой утилиты.', - 'shell_not_enabled' => 'Плагин shell не включен. Пожалуйста, включите его в файле config.yml.' -); diff --git a/PHPCI/Languages/lang.uk.php b/PHPCI/Languages/lang.uk.php deleted file mode 100644 index 54ced220..00000000 --- a/PHPCI/Languages/lang.uk.php +++ /dev/null @@ -1,399 +0,0 @@ - 'Українська', - 'language' => 'Мова', - - // Log in: - 'log_in_to_phpci' => 'Увійти до PHPCI', - 'login_error' => 'Невірний email або пароль', - 'forgotten_password_link' => 'Забули свій пароль?', - 'reset_emailed' => 'Ми відправили вам посилання для скидання вашого паролю.', - 'reset_header' => 'Не хвилюйтесь!
Просто введіть ваш email -і вам буде надіслано листа із посиланням на скидання паролю.', - 'reset_email_address' => 'Введіть свою email адресу:', - 'reset_send_email' => 'Скидання пароля', - 'reset_enter_password' => 'Введіть, будь ласка, новий пароль', - 'reset_new_password' => 'Новий пароль:', - 'reset_change_password' => 'Змінити пароль', - 'reset_no_user_exists' => 'Не існує користувача з такою email адресою, будь ласка, повторіть знову.', - 'reset_email_body' => 'Привіт, %s, - -Ви отримали цей лист, тому що ви або хтось інший запросили скидання пароля в PHPCI. - -Якщо це були ви, будь ласка, перейдіть за посиланням нижче для скидання пароля: %ssession/reset-password/%d/%s, - -або ж проігноруйте цей лист та нічого не робіть. - -Дякуємо, - -PHPCI', - - 'reset_email_title' => 'Скидання пароль PHPCI для %s', - 'reset_invalid' => 'Невірний запит скидання паролю.', - 'email_address' => 'Email адреса', - 'login' => 'Логин / Email адреса', - 'password' => 'Пароль', - 'log_in' => 'Увійти', - - - // Top Nav - 'toggle_navigation' => 'Сховати/відобразити панель навігації', - 'n_builds_pending' => '%d збірок очікує', - 'n_builds_running' => '%d збірок виконується', - 'edit_profile' => 'Редагувати профіль', - 'sign_out' => 'Вийти', - 'branch_x' => 'Гілка: %s', - 'created_x' => 'Створено: %s', - 'started_x' => 'Розпочато: %s', - - // Sidebar - 'hello_name' => 'Привіт, %s', - 'dashboard' => 'Панель управління', - 'admin_options' => 'Меню адміністратора', - 'add_project' => 'Додати проект', - 'settings' => 'Налаштування', - 'manage_users' => 'Управління користувачами', - 'plugins' => 'Плагіни', - 'view' => 'Переглянути', - 'build_now' => 'Зібрати', - 'edit_project' => 'Редагувати проект', - 'delete_project' => 'Видалити проект', - - // Project Summary: - 'no_builds_yet' => 'Немає збірок!', - 'x_of_x_failed' => '%d із останніх %d збірок були провалені.', - 'x_of_x_failed_short' => '%d / %d провалені.', - 'last_successful_build' => 'Останнью успішною збіркою була %s.', - 'never_built_successfully' => 'У цього проекта ніколи не було успішних збірок.', - 'all_builds_passed' => 'Усі із останніх %d збірок успішні.', - 'all_builds_passed_short' => '%d / %d успішні.', - 'last_failed_build' => 'Останньою проваленою збіркою була %s.', - 'never_failed_build' => 'У цього проекта ніколи не було провалених збірок.', - 'view_project' => 'Переглянути проект', - - // Timeline: - 'latest_builds' => 'Останні збірки', - 'pending' => 'Очікує', - 'running' => 'Виконується', - 'success' => 'Успіх', - 'successful' => 'Успішно', - 'failed' => 'Провалена', - 'manual_build' => 'Ручна збірка', - - // Add/Edit Project: - 'new_project' => 'Новий проект', - 'project_x_not_found' => 'Проект із ID %d не існує.', - 'project_details' => 'Деталі проекта', - 'public_key_help' => 'Для полегшення початку, ми згенерували пару SSH-ключів для вас для використання в цьому проекті. -Для їх використання - просто додайте наступний публічний ключ у розділ "deploy keys" обраної вами системи зберігання програмного коду.', - 'select_repository_type' => 'Оберіть тип репозиторію...', - 'github' => 'GitHub', - 'bitbucket' => 'Bitbucket', - 'gitlab' => 'GitLab', - 'remote' => 'Віддалений URL', - 'local' => 'Локальний шлях', - 'hg' => 'Mercurial', - - 'where_hosted' => 'Де зберігається ваш проект?', - 'choose_github' => 'Оберіть GitHub репозиторій:', - - 'repo_name' => 'Ім’я репозиторія / URL (зовнішній) / Шлях (локальний)', - 'project_title' => 'Заголовок проекту', - 'project_private_key' => 'Приватний ключ доступу до репозиторія -(залишити поле порожнім для локального використання та/або анонімного доступу)', - 'build_config' => 'Конфігурація збірки цього проекта для PHPCI -(якщо ви не додали файл phpci.yml до репозиторію вашого проекту)', - 'default_branch' => 'Назва гілки за замовчуванням', - 'allow_public_status' => 'Увімкнути публічну сторінку статусу та зображення для цього проекта?', - 'archived' => 'Архівний', - 'archived_menu' => 'Архів', - 'save_project' => 'Зберегти проект', - - 'error_mercurial' => 'URL репозиторію Mercurial повинен починатись із http:// або https://', - 'error_remote' => 'URL репозиторію повинен починатись із git://, http:// або https://', - 'error_gitlab' => 'Ім’я репозиторія GitLab повинно бути у форматі "user@domain.tld:owner/repo.git"', - 'error_github' => 'Ім’я репозиторія повинно відповідати формату "owner/repo"', - 'error_bitbucket' => 'Ім’я репозиторія повинно відповідати формату "owner/repo"', - 'error_path' => 'Вказаний шлях не існує.', - - // View Project: - 'all_branches' => 'Усі гілки', - 'builds' => 'Збірки', - 'id' => 'ID', - 'date' => 'Дата', - 'project' => 'Проект', - 'commit' => 'Комміт', - 'branch' => 'Гілка', - 'status' => 'Статус', - 'prev_link' => '« Попер.', - 'next_link' => 'Наст. »', - 'public_key' => 'Публічний ключ', - 'delete_build' => 'Видалити збірку', - - 'webhooks' => 'Webhooks', - 'webhooks_help_github' => 'Для автоматичної збірки цього проекту, при надходженні нових комітів, додайте наступний URL -у якості нового "Webhook" у розділі налаштувань -Webhooks and Services -вашого GitHub репозиторію.', - - 'webhooks_help_gitlab' => 'Для автоматичної збірки цього проекту, при надходженні нових комітів, додайте наступний URL -у якості нового "WebHook URL" у розділі "Web Hooks" вашого GitLab репозиторію.', - - 'webhooks_help_bitbucket' => 'Для автоматичної збірки цього проекту, при надходженні нових комітів, додайте наступний URL -у якості нового "POST" сервісу у розділі -Services -вашого Bitbucket репозиторію.', - - // View Build - 'build_x_not_found' => 'Збірка із ID %d не існує.', - 'build_n' => 'Збірка %d', - 'rebuild_now' => 'Перезібрати зараз', - - - 'committed_by_x' => 'Комміт від %s', - 'commit_id_x' => 'Комміт: %s', - - 'chart_display' => 'Цей графік відобразиться після завершення збірки.', - - 'build' => 'Збірка', - 'lines' => 'Рядків', - 'comment_lines' => 'Рядків коментарів', - 'noncomment_lines' => 'Рядків не коментарів', - 'logical_lines' => 'Рядків логіки', - 'lines_of_code' => 'Рядки коду', - 'build_log' => 'Лог збірки', - 'quality_trend' => 'Тенденція якості', - 'codeception_errors' => 'Помилки Codeception', - 'phpmd_warnings' => 'Попередження PHPMD', - 'phpcs_warnings' => 'Попередження PHPCS', - 'phpcs_errors' => 'Помилки PHPCS', - 'phplint_errors' => 'Помилки Lint', - 'phpunit_errors' => 'Помилки PHPUnit', - 'phpdoccheck_warnings' => 'Відсутні Docblocks', - 'issues' => 'Проблеми', - - 'codeception' => 'Codeception', - 'phpcpd' => 'PHP Copy/Paste Detector', - 'phpcs' => 'PHP Code Sniffer', - 'phpdoccheck' => 'Відсутні Docblocks', - 'phpmd' => 'PHP Mess Detector', - 'phpspec' => 'PHP Spec', - 'phpunit' => 'PHP Unit', - - 'file' => 'Файл', - 'line' => 'Рядок', - 'class' => 'Клас', - 'method' => 'Метод', - 'message' => 'Повідомлення', - 'start' => 'Запуск', - 'end' => 'Кінець', - 'from' => 'Від', - 'to' => 'До', - 'result' => 'Результат', - 'ok' => 'OK', - 'took_n_seconds' => 'Зайняло %d секунд', - 'build_created' => 'Збірка створена', - 'build_started' => 'Збірка розпочата', - 'build_finished' => 'Збірка завершена', - 'test_message' => 'Message', - 'test_no_message' => 'No message', - 'test_success' => 'Successful: %d', - 'test_fail' => 'Failures: %d', - 'test_skipped' => 'Skipped: %d', - 'test_error' => 'Errors: %d', - 'test_todo' => 'Todos: %d', - 'test_total' => '%d test(s)', - - // Users - 'name' => 'Ім’я', - 'password_change' => 'Пароль (залишити порожнім, якщо не бажаєте змінювати його)', - 'save' => 'Зберегти »', - 'update_your_details' => 'Оновити ваші деталі', - 'your_details_updated' => 'Ваші деталі були оновлені.', - 'add_user' => 'Додати користувача', - 'is_admin' => 'Адміністратор?', - 'yes' => 'Так', - 'no' => 'Ні', - 'edit' => 'Редагувати', - 'edit_user' => 'Редагувати користувача', - 'delete_user' => 'Видалити користувача', - 'user_n_not_found' => 'Користувач із ID %d не існує.', - 'is_user_admin' => 'Чи є цей користувач адміністратором?', - 'save_user' => 'Зберегти користувача', - - // Settings: - 'settings_saved' => 'Ваші налаштування були збережені.', - 'settings_check_perms' => 'Ваші налаштування не можуть бути збережені, перевірте права на ваш файл налаштувань config.yml.', - 'settings_cannot_write' => 'PHPCI не може записати файл config.yml, налаштування не будуть коректно збережені, -доки це не буде виправлено.', - 'settings_github_linked' => 'Ваш GitHub аккаунт було підключено.', - 'settings_github_not_linked' => 'Ваш GitHub аккаунт не може бути підключеним.', - 'build_settings' => 'Налаштування збірки', - 'github_application' => 'GitHub додаток', - 'github_sign_in' => 'Перед початком користування GitHub, вам необхідно увійти та надати -доступ для PHPCI до вашого аккаунту.', - 'github_phpci_linked' => 'PHPCI успішно зв\'язаний з аккаунтом GitHub.', - 'github_where_to_find' => 'Де це знайти...', - 'github_where_help' => 'Якщо ви є власником додатку, який би ви хотіли використовувати, то ви можете знайти інформацію про це у розділі -налаштувань ваших додатків.', - - 'email_settings' => 'Налаштування Email', - 'email_settings_help' => 'Перед тим, як PHPCI почне надсилати статуси збірок на email, -вам необхідно налаштувати параметри SMTP нижче.', - - 'application_id' => 'ID додатка', - 'application_secret' => 'Таємний ключ додатка', - - 'smtp_server' => 'Сервер SMTP', - 'smtp_port' => 'Порт SMTP', - 'smtp_username' => 'Ім’я користувача SMTP', - 'smtp_password' => 'Пароль SMTP', - 'from_email_address' => 'Відправляти з Email', - 'default_notification_address' => 'Email для повідомлень за замовчуванням', - 'use_smtp_encryption' => 'Використовувати SMTP шифрування?', - 'none' => 'Ні', - 'ssl' => 'SSL', - 'tls' => 'TLS', - - 'failed_after' => 'Вважати збірку проваленою після', - '5_mins' => '5 хвилин', - '15_mins' => '15 хвилин', - '30_mins' => '30 хвилин', - '1_hour' => '1 година', - '3_hours' => '3 години', - - // Plugins - 'cannot_update_composer' => 'PHPCI не може оновити composer.json, оскільки він не є доступним для запису.', - 'x_has_been_removed' => '%s було видалено.', - 'x_has_been_added' => '%s був доданий до composer.json і буде встановлений, як тільки -ви виконаєте composer update.', - 'enabled_plugins' => 'Увімкнені плагіни', - 'provided_by_package' => 'Наданий пакетом', - 'installed_packages' => 'Встановлені пакети', - 'suggested_packages' => 'Запропоновані пакети', - 'title' => 'Заголовок', - 'description' => 'Опис', - 'version' => 'Версія', - 'install' => 'Встановити »', - 'remove' => 'Видалити »', - 'search_packagist_for_more' => 'Знайти більше пакетів на Packagist', - 'search' => 'Знайти »', - - // Installer - 'installation_url' => 'URL встановлення PHPCI', - 'db_host' => 'Хост бази даних', - 'db_name' => 'Назва бази даних', - 'db_user' => 'Ім’я користувача бази даних', - 'db_pass' => 'Пароль бази даних', - 'admin_name' => 'Ім’я адміністратора', - 'admin_pass' => 'Пароль адміністратора', - 'admin_email' => 'Email адреса адміністратора', - 'config_path' => 'Шлях до файла конфігурації', - 'install_phpci' => 'Встановити PHPCI', - 'welcome_to_phpci' => 'Ласкаво просимо до PHPCI', - 'please_answer' => 'Будь ласка, дайте відповідь на наступні питання:', - 'phpci_php_req' => 'PHPCI вимагає для роботи, принаймні, версію PHP 5.3.8.', - 'extension_required' => 'Необхідне розширення: %s', - 'function_required' => 'PHPCI необхідна можливість викликати функцію %s(). Вона відключена у php.ini?', - 'requirements_not_met' => 'Неможливо встановити PHPCI, оскільки не всі вимоги виконані. -Будь ласка, продивіться наявні помилки перед тим, як продовжити.', - 'must_be_valid_email' => 'Повинно бути коректною email адресою.', - 'must_be_valid_url' => 'Повинно бути коректним URL.', - 'enter_name' => 'Ім’я адміністратора: ', - 'enter_email' => 'Email адміністратора: ', - 'enter_password' => 'Пароль адміністратора: ', - 'enter_phpci_url' => 'URL адреса вашого PHPCI (наприклад, "http://phpci.local"): ', - - 'enter_db_host' => 'Будь ласка, введіть хост MySQL [localhost]: ', - 'enter_db_name' => 'Будь ласка, введить ім’я бази даних MySQL [phpci]: ', - 'enter_db_user' => 'Будь ласка, введить ім’я користувача MySQL [phpci]: ', - 'enter_db_pass' => 'Будь ласка, введить ваш пароль MySQL: ', - 'could_not_connect' => 'PHPCI не може підключитися до MySQL із наданими параметрами. Будь ласка, спробуйте ще раз.', - 'setting_up_db' => 'Налаштування вашої бази даних...', - 'user_created' => 'Аккаунт користувача створено!', - 'failed_to_create' => 'PHPCI не вдалося створити ваш аккаунт адміністратора.', - 'config_exists' => 'Файл конфігурації PHPCI вже існує та не є порожнім.', - 'update_instead' => 'Якщо ви збираєтесь оновити PHPCI, будь ласка, використовуйте команду phpci:update.', - - // Update - 'update_phpci' => 'Оновити базу даних для відображення змінених моделей.', - 'updating_phpci' => 'Оновлення бази даних PHPCI:', - 'not_installed' => 'Неможливо встановити PHPCI.', - 'install_instead' => 'Будь ласка, встановіть PHPCI через команду phpci:install.', - - // Poll Command - 'poll_github' => 'Зробити запит до GitHub для перевірки запуску збірки.', - 'no_token' => 'GitHub токен не знайдено', - 'finding_projects' => 'Пошук проектів для запиту', - 'found_n_projects' => 'Знайдено %d проектів', - 'last_commit_is' => 'Останній коміт на GitHub для %s - %s', - 'adding_new_build' => 'Останній коміт має відмінності із базою даних, створена нова збірка.', - 'finished_processing_builds' => 'Завершено обробку збірок.', - - // Create Admin - 'create_admin_user' => 'Створити аккаунт адміністратора', - 'incorrect_format' => 'Невірний формат', - - // Create Build Command - 'create_build_project' => 'Create a build for a project', - 'project_id_argument' => 'A project ID', - 'commit_id_option' => 'Commit ID to build', - 'branch_name_option' => 'Branch to build', - - // Run Command - 'run_all_pending' => 'Запустити всі PHPCI збірки, які очікують.', - 'finding_builds' => 'Пошук збірок для обробки', - 'found_n_builds' => 'Знайдено %d збірок', - 'skipping_build' => 'Збірка %d пропущена - Збірка проекта вже у процесі.', - 'marked_as_failed' => 'Збірка %d відмічена як невдала через перевищення ліміту часу.', - - // Builder - 'missing_phpci_yml' => 'Цей проект не містить файл phpci.yml або він є порожнім.', - 'build_success' => 'ЗБІРКА УСПІШНА', - 'build_failed' => 'ЗБІРКА НЕВДАЛА', - 'removing_build' => 'Видалення збірки.', - 'exception' => 'Виключення:', - 'could_not_create_working' => 'Не вдалося створити робочу копію.', - 'working_copy_created' => 'Робоча копія створена: %s', - 'looking_for_binary' => 'Пошук бінарного пакета: %s', - 'found_in_path' => 'Знайдено у %s: %s', - 'running_plugin' => 'ВИКОНУЄТЬСЯ ПЛАГІН: %s', - 'plugin_success' => 'ПЛАГІН: УСПІШНО', - 'plugin_failed' => 'ПЛАГІН: НЕВДАЛО', - 'plugin_missing' => 'Плагін не існує: %s', - 'tap_version' => 'TapParser підтримує тільки TAP версії 13', - 'tap_error' => 'Некоректний TAP-рядок, кількість тестів не співпадає із вказаними.', - - // Build Plugins: - 'no_tests_performed' => 'Жодних тестів не було запущено.', - 'could_not_find' => 'Неможливо знайти %s', - 'no_campfire_settings' => 'Не вказані параметри з’єднання для плагіна Campfire', - 'failed_to_wipe' => 'Не вдалося знищити існуючу директорію %s перед копіюванням', - 'passing_build' => 'Успішно збірка', - 'failing_build' => 'Невдала збірка', - 'log_output' => 'Вивід лога:', - 'n_emails_sent' => '%d листів відправлено.', - 'n_emails_failed' => '%d листів не вдалося відправити.', - 'unable_to_set_env' => 'Неможливо встановити змінну оточення', - 'tag_created' => 'Тег, створений PHPCI: %s', - 'x_built_at_x' => '%PROJECT_TITLE% зібрано у %BUILD_URI%', - 'hipchat_settings' => 'Будь ласка, вкажіть кімнату та "authToken" параметр для плагіна hipchat_notify', - 'irc_settings' => 'Ви повинні вказати сервер, кімнату та нік.', - 'invalid_command' => 'Невірна команда', - 'import_file_key' => 'Вираз імпорту повинен містити ключ \'file\'', - 'cannot_open_import' => 'Неможливо відкрити файл імпорту SQL: %s', - 'unable_to_execute' => 'Неможливо виконати файл SQL', - 'phar_internal_error' => 'Внутрішня помилка плагіну Phar', - 'build_file_missing' => 'Вказаний файл збірки не існує.', - 'property_file_missing' => 'Вказаний файл властивості не існує.', - 'could_not_process_report' => 'Неможливо обробити звіт, згенерований цією утилітою.', - 'shell_not_enabled' => 'Плагін shell не увімкнений. Будь ласка, увімкніть його через config.yml.' -); diff --git a/PHPCI/Logging/BuildDBLogHandler.php b/PHPCI/Logging/BuildDBLogHandler.php index 91664b25..782471db 100644 --- a/PHPCI/Logging/BuildDBLogHandler.php +++ b/PHPCI/Logging/BuildDBLogHandler.php @@ -12,12 +12,7 @@ namespace PHPCI\Logging; use b8\Store\Factory; use Monolog\Handler\AbstractProcessingHandler; use PHPCI\Model\Build; -use Psr\Log\LogLevel; -/** - * Class BuildDBLogHandler writes the build log to the database. - * @package PHPCI\Logging - */ class BuildDBLogHandler extends AbstractProcessingHandler { /** @@ -27,11 +22,6 @@ class BuildDBLogHandler extends AbstractProcessingHandler protected $logValue; - /** - * @param Build $build - * @param bool $level - * @param bool $bubble - */ public function __construct( Build $build, $level = LogLevel::INFO, @@ -43,10 +33,6 @@ class BuildDBLogHandler extends AbstractProcessingHandler $this->logValue = $build->getLog(); } - /** - * Write a log entry to the build log. - * @param array $record - */ protected function write(array $record) { $message = (string)$record['message']; diff --git a/PHPCI/Logging/BuildLogger.php b/PHPCI/Logging/BuildLogger.php index a68e9e6d..062783e1 100644 --- a/PHPCI/Logging/BuildLogger.php +++ b/PHPCI/Logging/BuildLogger.php @@ -14,10 +14,6 @@ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; -/** - * Class BuildLogger - * @package PHPCI\Logging - */ class BuildLogger implements LoggerAwareInterface { /** @@ -30,11 +26,6 @@ class BuildLogger implements LoggerAwareInterface */ protected $build; - /** - * Set up the BuildLogger class. - * @param LoggerInterface $logger - * @param Build $build - */ public function __construct(LoggerInterface $logger, Build $build) { $this->logger = $logger; @@ -67,7 +58,7 @@ class BuildLogger implements LoggerAwareInterface } } - /** + /** * Add a success-coloured message to the log. * @param string */ @@ -98,17 +89,6 @@ class BuildLogger implements LoggerAwareInterface ); } - /** - * Add a debug message to the log. - * @param string - */ - public function logDebug($message) - { - if (defined('PHPCI_DEBUG_MODE') && PHPCI_DEBUG_MODE) { - $this->log("\033[0;33m" . $message . "\033[0m"); - } - } - /** * Sets a logger instance on the object * diff --git a/PHPCI/Logging/Handler.php b/PHPCI/Logging/Handler.php index e22351da..34d2f179 100644 --- a/PHPCI/Logging/Handler.php +++ b/PHPCI/Logging/Handler.php @@ -11,10 +11,6 @@ namespace PHPCI\Logging; use Psr\Log\LoggerInterface; -/** - * Base Log Handler - * @package PHPCI\Logging - */ class Handler { /** @@ -37,18 +33,11 @@ class Handler */ protected $logger; - /** - * @param LoggerInterface $logger - */ public function __construct(LoggerInterface $logger = null) { $this->logger = $logger; } - /** - * Register a new log handler. - * @param LoggerInterface $logger - */ public static function register(LoggerInterface $logger = null) { $handler = new static($logger); @@ -70,6 +59,7 @@ class Handler public function handleError($level, $message, $file, $line) { if (error_reporting() & $level) { + $exception_level = isset($this->levels[$level]) ? $this->levels[$level] : $level; throw new \ErrorException( @@ -132,13 +122,10 @@ class Handler $this->log($exception); } - /** - * Write to the build log. - * @param \Exception $exception - */ protected function log(\Exception $exception) { if (null !== $this->logger) { + $message = sprintf( '%s: %s (uncaught exception) at %s line %s', get_class($exception), diff --git a/PHPCI/Logging/LoggedBuildContextTidier.php b/PHPCI/Logging/LoggedBuildContextTidier.php index cfcfb8b8..7e550976 100644 --- a/PHPCI/Logging/LoggedBuildContextTidier.php +++ b/PHPCI/Logging/LoggedBuildContextTidier.php @@ -11,15 +11,8 @@ namespace PHPCI\Logging; use PHPCI\Model\Build; -/** - * Class LoggedBuildContextTidier cleans up build log entries. - * @package PHPCI\Logging - */ class LoggedBuildContextTidier { - /** - * @return array - */ public function __invoke() { return $this->tidyLoggedBuildContext(func_get_arg(0)); diff --git a/PHPCI/Logging/LoggerConfig.php b/PHPCI/Logging/LoggerConfig.php index fd929aeb..0a1ea7fb 100644 --- a/PHPCI/Logging/LoggerConfig.php +++ b/PHPCI/Logging/LoggerConfig.php @@ -9,18 +9,14 @@ namespace PHPCI\Logging; -use Monolog\ErrorHandler; use Monolog\Logger; -/** - * Class LoggerConfig - * @package PHPCI\Logging - */ class LoggerConfig { + const KEY_ALWAYS_LOADED = "_"; + private $config; - private $cache = array(); /** * The filepath is expected to return an array which will be @@ -58,27 +54,11 @@ class LoggerConfig */ public function getFor($name) { - if (isset($this->cache[$name])) { - return $this->cache[$name]; - } - $handlers = $this->getHandlers(self::KEY_ALWAYS_LOADED); - if ($name !== self::KEY_ALWAYS_LOADED) { - $handlers = array_merge($handlers, $this->getHandlers($name)); - } - - $logger = new Logger($name, $handlers); - ErrorHandler::register($logger); - $this->cache[$name] = $logger; - - return $logger; + $handlers = array_merge($handlers, $this->getHandlers($name)); + return new Logger($name, $handlers); } - /** - * Return an array of enabled log handlers. - * @param $key - * @return array|mixed - */ protected function getHandlers($key) { $handlers = array(); diff --git a/PHPCI/Logging/OutputLogHandler.php b/PHPCI/Logging/OutputLogHandler.php index 4b4c81a4..3106787e 100644 --- a/PHPCI/Logging/OutputLogHandler.php +++ b/PHPCI/Logging/OutputLogHandler.php @@ -13,10 +13,6 @@ use Monolog\Handler\AbstractProcessingHandler; use Psr\Log\LogLevel; use Symfony\Component\Console\Output\OutputInterface; -/** - * Class OutputLogHandler outputs the build log to the terminal. - * @package PHPCI\Logging - */ class OutputLogHandler extends AbstractProcessingHandler { /** @@ -24,11 +20,6 @@ class OutputLogHandler extends AbstractProcessingHandler */ protected $output; - /** - * @param OutputInterface $output - * @param bool|string $level - * @param bool $bubble - */ public function __construct( OutputInterface $output, $level = LogLevel::INFO, @@ -38,10 +29,6 @@ class OutputLogHandler extends AbstractProcessingHandler $this->output = $output; } - /** - * Write a log entry to the terminal. - * @param array $record - */ protected function write(array $record) { $this->output->writeln((string)$record['formatted']); diff --git a/PHPCI/Migrations/20140513153133_change_build_keys_migration.php b/PHPCI/Migrations/20140513153133_change_build_keys_migration.php index 7fd253cc..b26a9388 100644 --- a/PHPCI/Migrations/20140513153133_change_build_keys_migration.php +++ b/PHPCI/Migrations/20140513153133_change_build_keys_migration.php @@ -23,4 +23,4 @@ class ChangeBuildKeysMigration extends AbstractMigration $project->renameColumn('ssh_private_key', 'git_key'); $project->renameColumn('ssh_public_key', 'public_key'); } -} +} \ No newline at end of file diff --git a/PHPCI/Migrations/20140611170618_choose_branch.php b/PHPCI/Migrations/20140611170618_choose_branch.php index 26b4ed4c..5945c241 100644 --- a/PHPCI/Migrations/20140611170618_choose_branch.php +++ b/PHPCI/Migrations/20140611170618_choose_branch.php @@ -37,4 +37,4 @@ class ChooseBranch extends AbstractMigration $project = $this->table('project'); $project->removeColumn('branch')->save(); } -} +} \ No newline at end of file diff --git a/PHPCI/Migrations/20140730143702_fix_database_columns.php b/PHPCI/Migrations/20140730143702_fix_database_columns.php index a1ac2493..809fc878 100644 --- a/PHPCI/Migrations/20140730143702_fix_database_columns.php +++ b/PHPCI/Migrations/20140730143702_fix_database_columns.php @@ -20,7 +20,7 @@ class FixDatabaseColumns extends AbstractMigration $build->changeColumn('project_id', 'integer', array('null' => false)); $build->changeColumn('commit_id', 'string', array('limit' => 50, 'null' => false)); $build->changeColumn('status', 'integer', array('null' => false)); - $build->changeColumn('log', 'text', array('null' => true)); + $build->changeColumn('log', 'text', array('null' => true, 'default' => '')); $build->changeColumn('branch', 'string', array('limit' => 50, 'null' => false, 'default' => 'master')); $build->changeColumn('created', 'datetime', array('null' => true)); $build->changeColumn('started', 'datetime', array('null' => true)); diff --git a/PHPCI/Migrations/20150131075425_archive_project.php b/PHPCI/Migrations/20150131075425_archive_project.php deleted file mode 100644 index 796fd48b..00000000 --- a/PHPCI/Migrations/20150131075425_archive_project.php +++ /dev/null @@ -1,26 +0,0 @@ -table('project'); - $project->addColumn('archived', 'boolean'); - $project->save(); - } - - /** - * Migrate Down. - */ - public function down() - { - $project = $this->table('project'); - $project->removeColumn('archived'); - $project->save(); - } -} \ No newline at end of file diff --git a/PHPCI/Migrations/20150203105015_fix_column_types.php b/PHPCI/Migrations/20150203105015_fix_column_types.php deleted file mode 100644 index 53db2ad6..00000000 --- a/PHPCI/Migrations/20150203105015_fix_column_types.php +++ /dev/null @@ -1,27 +0,0 @@ -table('build'); - $build->changeColumn('log', 'text', array( - 'null' => true, - 'limit' => MysqlAdapter::TEXT_MEDIUM, - )); - - // Update the build meta value column to MEDIUMTEXT: - $buildMeta = $this->table('build_meta'); - $buildMeta->changeColumn('meta_value', 'text', array( - 'null' => false, - 'limit' => MysqlAdapter::TEXT_MEDIUM, - )); - } -} diff --git a/PHPCI/Migrations/20150324174958_unique_email_and_name_user_fields.php b/PHPCI/Migrations/20150324174958_unique_email_and_name_user_fields.php deleted file mode 100644 index f8d24ba0..00000000 --- a/PHPCI/Migrations/20150324174958_unique_email_and_name_user_fields.php +++ /dev/null @@ -1,30 +0,0 @@ -table('user'); - $user_table - ->addIndex('email', array('unique' => true)) - ->addIndex('name', array('unique' => true)) - ->save(); - } - - /** - * Migrate Down. - */ - public function down() - { - $user_table = $this->table('user'); - $user_table - ->removeIndex('email', array('unique' => true)) - ->removeIndex('name', array('unique' => true)) - ->save(); - } -} diff --git a/PHPCI/Migrations/20151008140800_add_project_groups.php b/PHPCI/Migrations/20151008140800_add_project_groups.php deleted file mode 100644 index f6035014..00000000 --- a/PHPCI/Migrations/20151008140800_add_project_groups.php +++ /dev/null @@ -1,29 +0,0 @@ -table('project_group'); - $table->addColumn('title', 'string', array('limit' => 100, 'null' => false)); - $table->save(); - - $group = new \PHPCI\Model\ProjectGroup(); - $group->setTitle('Projects'); - - /** @var \PHPCI\Model\ProjectGroup $group */ - $group = \b8\Store\Factory::getStore('ProjectGroup')->save($group); - - $table = $this->table('project'); - $table->addColumn('group_id', 'integer', array( - 'signed' => true, - 'null' => false, - 'default' => $group->getId(), - )); - - $table->addForeignKey('group_id', 'project_group', 'id', array('delete'=> 'RESTRICT', 'update' => 'CASCADE')); - $table->save(); - } -} diff --git a/PHPCI/Migrations/20151009100610_remove_unique_name_index.php b/PHPCI/Migrations/20151009100610_remove_unique_name_index.php deleted file mode 100644 index 283dfbc0..00000000 --- a/PHPCI/Migrations/20151009100610_remove_unique_name_index.php +++ /dev/null @@ -1,40 +0,0 @@ -table('user'); - - if ($user->hasIndex('name', array('unique' => true))) { - $user->removeIndex('name', array('unique' => true)); - $user->save(); - } - - $user->addIndex('name', array('unique' => false)); - $user->save(); - } -} diff --git a/PHPCI/Migrations/20151014091859_errors_table.php b/PHPCI/Migrations/20151014091859_errors_table.php deleted file mode 100644 index a064f6e5..00000000 --- a/PHPCI/Migrations/20151014091859_errors_table.php +++ /dev/null @@ -1,24 +0,0 @@ -table('build_error'); - $table->addColumn('build_id', 'integer', array('signed' => true)); - $table->addColumn('plugin', 'string', array('limit' => 100)); - $table->addColumn('file', 'string', array('limit' => 250, 'null' => true)); - $table->addColumn('line_start', 'integer', array('signed' => false, 'null' => true)); - $table->addColumn('line_end', 'integer', array('signed' => false, 'null' => true)); - $table->addColumn('severity', 'integer', array('signed' => false, 'limit' => MysqlAdapter::INT_TINY)); - $table->addColumn('message', 'string', array('limit' => 250)); - $table->addColumn('created_date', 'datetime'); - $table->addIndex(array('build_id', 'created_date'), array('unique' => false)); - $table->addForeignKey('build_id', 'build', 'id', array('delete'=> 'CASCADE', 'update' => 'CASCADE')); - $table->save(); - - } -} diff --git a/PHPCI/Migrations/20151015124825_convert_errors.php b/PHPCI/Migrations/20151015124825_convert_errors.php deleted file mode 100644 index 3622bf14..00000000 --- a/PHPCI/Migrations/20151015124825_convert_errors.php +++ /dev/null @@ -1,183 +0,0 @@ -metaStore = \b8\Store\Factory::getStore('BuildMeta'); - $this->errorStore = \b8\Store\Factory::getStore('BuildError'); - - while ($count == 100) { - $data = $this->metaStore->getErrorsForUpgrade(100); - $count = count($data); - - /** @var \PHPCI\Model\BuildMeta $meta */ - foreach ($data as $meta) { - try { - switch ($meta->getMetaKey()) { - case 'phpmd-data': - $this->processPhpMdMeta($meta); - break; - - case 'phpcs-data': - $this->processPhpCsMeta($meta); - break; - - case 'phpdoccheck-data': - $this->processPhpDocCheckMeta($meta); - break; - - case 'phpcpd-data': - $this->processPhpCpdMeta($meta); - break; - - case 'technicaldebt-data': - $this->processTechnicalDebtMeta($meta); - break; - } - } catch (\Exception $ex) {} - - $this->metaStore->delete($meta); - } - } - } - - protected function processPhpMdMeta(BuildMeta $meta) - { - $data = json_decode($meta->getMetaValue(), true); - - if (is_array($data) && count($data)) { - foreach ($data as $error) { - $buildError = new BuildError(); - $buildError->setBuildId($meta->getBuildId()); - $buildError->setPlugin('php_mess_detector'); - $buildError->setCreatedDate(new \DateTime()); - $buildError->setFile($error['file']); - $buildError->setLineStart($error['line_start']); - $buildError->setLineEnd($error['line_end']); - $buildError->setSeverity(BuildError::SEVERITY_HIGH); - $buildError->setMessage($error['message']); - - $this->errorStore->save($buildError); - } - } - } - - protected function processPhpCsMeta(BuildMeta $meta) - { - $data = json_decode($meta->getMetaValue(), true); - - if (is_array($data) && count($data)) { - foreach ($data as $error) { - $buildError = new BuildError(); - $buildError->setBuildId($meta->getBuildId()); - $buildError->setPlugin('php_code_sniffer'); - $buildError->setCreatedDate(new \DateTime()); - $buildError->setFile($error['file']); - $buildError->setLineStart($error['line']); - $buildError->setLineEnd($error['line']); - $buildError->setMessage($error['message']); - - switch ($error['type']) { - case 'ERROR': - $buildError->setSeverity(BuildError::SEVERITY_HIGH); - break; - - case 'WARNING': - $buildError->setSeverity(BuildError::SEVERITY_LOW); - break; - } - - $this->errorStore->save($buildError); - } - } - } - - protected function processPhpDocCheckMeta(BuildMeta $meta) - { - $data = json_decode($meta->getMetaValue(), true); - - if (is_array($data) && count($data)) { - foreach ($data as $error) { - $buildError = new BuildError(); - $buildError->setBuildId($meta->getBuildId()); - $buildError->setPlugin('php_docblock_checker'); - $buildError->setCreatedDate(new \DateTime()); - $buildError->setFile($error['file']); - $buildError->setLineStart($error['line']); - $buildError->setLineEnd($error['line']); - - switch ($error['type']) { - case 'method': - $buildError->setMessage($error['class'] . '::' . $error['method'] . ' is missing a docblock.'); - $buildError->setSeverity(BuildError::SEVERITY_NORMAL); - break; - - case 'class': - $buildError->setMessage('Class ' . $error['class'] . ' is missing a docblock.'); - $buildError->setSeverity(BuildError::SEVERITY_LOW); - break; - } - - $this->errorStore->save($buildError); - } - } - } - - protected function processPhpCpdMeta(BuildMeta $meta) - { - $data = json_decode($meta->getMetaValue(), true); - - if (is_array($data) && count($data)) { - foreach ($data as $error) { - $buildError = new BuildError(); - $buildError->setBuildId($meta->getBuildId()); - $buildError->setPlugin('php_cpd'); - $buildError->setCreatedDate(new \DateTime()); - $buildError->setFile($error['file']); - $buildError->setLineStart($error['line_start']); - $buildError->setLineEnd($error['line_end']); - $buildError->setSeverity(BuildError::SEVERITY_NORMAL); - $buildError->setMessage('Copy and paste detected.'); - - $this->errorStore->save($buildError); - } - } - } - - protected function processTechnicalDebtMeta(BuildMeta $meta) - { - $data = json_decode($meta->getMetaValue(), true); - - if (is_array($data) && count($data)) { - foreach ($data as $error) { - $buildError = new BuildError(); - $buildError->setBuildId($meta->getBuildId()); - $buildError->setPlugin('technical_debt'); - $buildError->setCreatedDate(new \DateTime()); - $buildError->setFile($error['file']); - $buildError->setLineStart($error['line']); - $buildError->setSeverity(BuildError::SEVERITY_NORMAL); - $buildError->setMessage($error['message']); - - $this->errorStore->save($buildError); - } - } - } -} diff --git a/PHPCI/Migrations/20160623100223_project_table_defaults.php b/PHPCI/Migrations/20160623100223_project_table_defaults.php deleted file mode 100644 index 079db327..00000000 --- a/PHPCI/Migrations/20160623100223_project_table_defaults.php +++ /dev/null @@ -1,18 +0,0 @@ -table('project') - ->changeColumn('build_config', MysqlAdapter::PHINX_TYPE_TEXT, array('null' => true)) - ->changeColumn('archived', MysqlAdapter::PHINX_TYPE_INTEGER, array( - 'length' => MysqlAdapter::INT_TINY, - 'default' => 0, - )) - ->save(); - } -} diff --git a/PHPCI/Model.php b/PHPCI/Model.php index 5d911533..d1adf9ec 100644 --- a/PHPCI/Model.php +++ b/PHPCI/Model.php @@ -9,10 +9,6 @@ namespace PHPCI; -/** - * PHPCI Base Model. - * @package PHPCI - */ abstract class Model extends \b8\Model { diff --git a/PHPCI/Model/Base/BuildBase.php b/PHPCI/Model/Base/BuildBase.php index 7c0fcdd3..119290e2 100644 --- a/PHPCI/Model/Base/BuildBase.php +++ b/PHPCI/Model/Base/BuildBase.php @@ -118,7 +118,7 @@ class BuildBase extends Model 'default' => null, ), 'log' => array( - 'type' => 'mediumtext', + 'type' => 'text', 'nullable' => true, 'default' => null, ), @@ -621,18 +621,6 @@ class BuildBase extends Model return $this->setProjectId($value->getId()); } - /** - * Get BuildError models by BuildId for this Build. - * - * @uses \PHPCI\Store\BuildErrorStore::getByBuildId() - * @uses \PHPCI\Model\BuildError - * @return \PHPCI\Model\BuildError[] - */ - public function getBuildBuildErrors() - { - return Factory::getStore('BuildError', 'PHPCI')->getByBuildId($this->getId()); - } - /** * Get BuildMeta models by BuildId for this Build. * diff --git a/PHPCI/Model/Base/BuildErrorBase.php b/PHPCI/Model/Base/BuildErrorBase.php deleted file mode 100644 index 6364bb29..00000000 --- a/PHPCI/Model/Base/BuildErrorBase.php +++ /dev/null @@ -1,503 +0,0 @@ - null, - 'build_id' => null, - 'plugin' => null, - 'file' => null, - 'line_start' => null, - 'line_end' => null, - 'severity' => null, - 'message' => null, - 'created_date' => null, - ); - - /** - * @var array - */ - protected $getters = array( - // Direct property getters: - 'id' => 'getId', - 'build_id' => 'getBuildId', - 'plugin' => 'getPlugin', - 'file' => 'getFile', - 'line_start' => 'getLineStart', - 'line_end' => 'getLineEnd', - 'severity' => 'getSeverity', - 'message' => 'getMessage', - 'created_date' => 'getCreatedDate', - - // Foreign key getters: - 'Build' => 'getBuild', - ); - - /** - * @var array - */ - protected $setters = array( - // Direct property setters: - 'id' => 'setId', - 'build_id' => 'setBuildId', - 'plugin' => 'setPlugin', - 'file' => 'setFile', - 'line_start' => 'setLineStart', - 'line_end' => 'setLineEnd', - 'severity' => 'setSeverity', - 'message' => 'setMessage', - 'created_date' => 'setCreatedDate', - - // Foreign key setters: - 'Build' => 'setBuild', - ); - - /** - * @var array - */ - public $columns = array( - 'id' => array( - 'type' => 'int', - 'length' => 11, - 'primary_key' => true, - 'auto_increment' => true, - 'default' => null, - ), - 'build_id' => array( - 'type' => 'int', - 'length' => 11, - 'default' => null, - ), - 'plugin' => array( - 'type' => 'varchar', - 'length' => 100, - 'default' => null, - ), - 'file' => array( - 'type' => 'varchar', - 'length' => 250, - 'nullable' => true, - 'default' => null, - ), - 'line_start' => array( - 'type' => 'int', - 'length' => 11, - 'nullable' => true, - 'default' => null, - ), - 'line_end' => array( - 'type' => 'int', - 'length' => 11, - 'nullable' => true, - 'default' => null, - ), - 'severity' => array( - 'type' => 'tinyint', - 'length' => 3, - 'default' => null, - ), - 'message' => array( - 'type' => 'varchar', - 'length' => 250, - 'default' => null, - ), - 'created_date' => array( - 'type' => 'datetime', - 'default' => null, - ), - ); - - /** - * @var array - */ - public $indexes = array( - 'PRIMARY' => array('unique' => true, 'columns' => 'id'), - 'build_id' => array('columns' => 'build_id, created_date'), - ); - - /** - * @var array - */ - public $foreignKeys = array( - 'build_error_ibfk_1' => array( - 'local_col' => 'build_id', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - 'table' => 'build', - 'col' => 'id' - ), - ); - - /** - * Get the value of Id / id. - * - * @return int - */ - public function getId() - { - $rtn = $this->data['id']; - - return $rtn; - } - - /** - * Get the value of BuildId / build_id. - * - * @return int - */ - public function getBuildId() - { - $rtn = $this->data['build_id']; - - return $rtn; - } - - /** - * Get the value of Plugin / plugin. - * - * @return string - */ - public function getPlugin() - { - $rtn = $this->data['plugin']; - - return $rtn; - } - - /** - * Get the value of File / file. - * - * @return string - */ - public function getFile() - { - $rtn = $this->data['file']; - - return $rtn; - } - - /** - * Get the value of LineStart / line_start. - * - * @return int - */ - public function getLineStart() - { - $rtn = $this->data['line_start']; - - return $rtn; - } - - /** - * Get the value of LineEnd / line_end. - * - * @return int - */ - public function getLineEnd() - { - $rtn = $this->data['line_end']; - - return $rtn; - } - - /** - * Get the value of Severity / severity. - * - * @return int - */ - public function getSeverity() - { - $rtn = $this->data['severity']; - - return $rtn; - } - - /** - * Get the value of Message / message. - * - * @return string - */ - public function getMessage() - { - $rtn = $this->data['message']; - - return $rtn; - } - - /** - * Get the value of CreatedDate / created_date. - * - * @return \DateTime - */ - public function getCreatedDate() - { - $rtn = $this->data['created_date']; - - if (!empty($rtn)) { - $rtn = new \DateTime($rtn); - } - - return $rtn; - } - - /** - * Set the value of Id / id. - * - * Must not be null. - * @param $value int - */ - public function setId($value) - { - $this->_validateNotNull('Id', $value); - $this->_validateInt('Id', $value); - - if ($this->data['id'] === $value) { - return; - } - - $this->data['id'] = $value; - - $this->_setModified('id'); - } - - /** - * Set the value of BuildId / build_id. - * - * Must not be null. - * @param $value int - */ - public function setBuildId($value) - { - $this->_validateNotNull('BuildId', $value); - $this->_validateInt('BuildId', $value); - - if ($this->data['build_id'] === $value) { - return; - } - - $this->data['build_id'] = $value; - - $this->_setModified('build_id'); - } - - /** - * Set the value of Plugin / plugin. - * - * Must not be null. - * @param $value string - */ - public function setPlugin($value) - { - $this->_validateNotNull('Plugin', $value); - $this->_validateString('Plugin', $value); - - if ($this->data['plugin'] === $value) { - return; - } - - $this->data['plugin'] = $value; - - $this->_setModified('plugin'); - } - - /** - * Set the value of File / file. - * - * @param $value string - */ - public function setFile($value) - { - $this->_validateString('File', $value); - - if ($this->data['file'] === $value) { - return; - } - - $this->data['file'] = $value; - - $this->_setModified('file'); - } - - /** - * Set the value of LineStart / line_start. - * - * @param $value int - */ - public function setLineStart($value) - { - $this->_validateInt('LineStart', $value); - - if ($this->data['line_start'] === $value) { - return; - } - - $this->data['line_start'] = $value; - - $this->_setModified('line_start'); - } - - /** - * Set the value of LineEnd / line_end. - * - * @param $value int - */ - public function setLineEnd($value) - { - $this->_validateInt('LineEnd', $value); - - if ($this->data['line_end'] === $value) { - return; - } - - $this->data['line_end'] = $value; - - $this->_setModified('line_end'); - } - - /** - * Set the value of Severity / severity. - * - * Must not be null. - * @param $value int - */ - public function setSeverity($value) - { - $this->_validateNotNull('Severity', $value); - $this->_validateInt('Severity', $value); - - if ($this->data['severity'] === $value) { - return; - } - - $this->data['severity'] = $value; - - $this->_setModified('severity'); - } - - /** - * Set the value of Message / message. - * - * Must not be null. - * @param $value string - */ - public function setMessage($value) - { - $this->_validateNotNull('Message', $value); - $this->_validateString('Message', $value); - - if ($this->data['message'] === $value) { - return; - } - - $this->data['message'] = $value; - - $this->_setModified('message'); - } - - /** - * Set the value of CreatedDate / created_date. - * - * Must not be null. - * @param $value \DateTime - */ - public function setCreatedDate($value) - { - $this->_validateNotNull('CreatedDate', $value); - $this->_validateDate('CreatedDate', $value); - - if ($this->data['created_date'] === $value) { - return; - } - - $this->data['created_date'] = $value; - - $this->_setModified('created_date'); - } - - /** - * Get the Build model for this BuildError by Id. - * - * @uses \PHPCI\Store\BuildStore::getById() - * @uses \PHPCI\Model\Build - * @return \PHPCI\Model\Build - */ - public function getBuild() - { - $key = $this->getBuildId(); - - if (empty($key)) { - return null; - } - - $cacheKey = 'Cache.Build.' . $key; - $rtn = $this->cache->get($cacheKey, null); - - if (empty($rtn)) { - $rtn = Factory::getStore('Build', 'PHPCI')->getById($key); - $this->cache->set($cacheKey, $rtn); - } - - return $rtn; - } - - /** - * Set Build - Accepts an ID, an array representing a Build or a Build model. - * - * @param $value mixed - */ - public function setBuild($value) - { - // Is this an instance of Build? - if ($value instanceof \PHPCI\Model\Build) { - return $this->setBuildObject($value); - } - - // Is this an array representing a Build item? - if (is_array($value) && !empty($value['id'])) { - return $this->setBuildId($value['id']); - } - - // Is this a scalar value representing the ID of this foreign key? - return $this->setBuildId($value); - } - - /** - * Set Build - Accepts a Build model. - * - * @param $value \PHPCI\Model\Build - */ - public function setBuildObject(\PHPCI\Model\Build $value) - { - return $this->setBuildId($value->getId()); - } -} diff --git a/PHPCI/Model/Base/BuildMetaBase.php b/PHPCI/Model/Base/BuildMetaBase.php index dc018819..0ac8fa93 100644 --- a/PHPCI/Model/Base/BuildMetaBase.php +++ b/PHPCI/Model/Base/BuildMetaBase.php @@ -99,7 +99,7 @@ class BuildMetaBase extends Model 'default' => null, ), 'meta_value' => array( - 'type' => 'mediumtext', + 'type' => 'text', 'default' => null, ), ); diff --git a/PHPCI/Model/Base/ProjectBase.php b/PHPCI/Model/Base/ProjectBase.php index 0dc0c0eb..305cafbf 100644 --- a/PHPCI/Model/Base/ProjectBase.php +++ b/PHPCI/Model/Base/ProjectBase.php @@ -44,8 +44,6 @@ class ProjectBase extends Model 'build_config' => null, 'ssh_public_key' => null, 'allow_public_status' => null, - 'archived' => null, - 'group_id' => null, ); /** @@ -64,11 +62,8 @@ class ProjectBase extends Model 'build_config' => 'getBuildConfig', 'ssh_public_key' => 'getSshPublicKey', 'allow_public_status' => 'getAllowPublicStatus', - 'archived' => 'getArchived', - 'group_id' => 'getGroupId', // Foreign key getters: - 'Group' => 'getGroup', ); /** @@ -87,11 +82,8 @@ class ProjectBase extends Model 'build_config' => 'setBuildConfig', 'ssh_public_key' => 'setSshPublicKey', 'allow_public_status' => 'setAllowPublicStatus', - 'archived' => 'setArchived', - 'group_id' => 'setGroupId', // Foreign key setters: - 'Group' => 'setGroup', ); /** @@ -156,16 +148,6 @@ class ProjectBase extends Model 'type' => 'int', 'length' => 11, ), - 'archived' => array( - 'type' => 'tinyint', - 'length' => 1, - 'default' => null, - ), - 'group_id' => array( - 'type' => 'int', - 'length' => 11, - 'default' => 1, - ), ); /** @@ -174,20 +156,12 @@ class ProjectBase extends Model public $indexes = array( 'PRIMARY' => array('unique' => true, 'columns' => 'id'), 'idx_project_title' => array('columns' => 'title'), - 'group_id' => array('columns' => 'group_id'), ); /** * @var array */ public $foreignKeys = array( - 'project_ibfk_1' => array( - 'local_col' => 'group_id', - 'update' => 'CASCADE', - 'delete' => '', - 'table' => 'project_group', - 'col' => 'id' - ), ); /** @@ -322,30 +296,6 @@ class ProjectBase extends Model return $rtn; } - /** - * Get the value of Archived / archived. - * - * @return int - */ - public function getArchived() - { - $rtn = $this->data['archived']; - - return $rtn; - } - - /** - * Get the value of GroupId / group_id. - * - * @return int - */ - public function getGroupId() - { - $rtn = $this->data['group_id']; - - return $rtn; - } - /** * Set the value of Id / id. * @@ -556,103 +506,6 @@ class ProjectBase extends Model $this->_setModified('allow_public_status'); } - /** - * Set the value of Archived / archived. - * - * Must not be null. - * @param $value int - */ - public function setArchived($value) - { - $this->_validateNotNull('Archived', $value); - $this->_validateInt('Archived', $value); - - if ($this->data['archived'] === $value) { - return; - } - - $this->data['archived'] = $value; - - $this->_setModified('archived'); - } - - /** - * Set the value of GroupId / group_id. - * - * Must not be null. - * @param $value int - */ - public function setGroupId($value) - { - $this->_validateNotNull('GroupId', $value); - $this->_validateInt('GroupId', $value); - - if ($this->data['group_id'] === $value) { - return; - } - - $this->data['group_id'] = $value; - - $this->_setModified('group_id'); - } - - /** - * Get the ProjectGroup model for this Project by Id. - * - * @uses \PHPCI\Store\ProjectGroupStore::getById() - * @uses \PHPCI\Model\ProjectGroup - * @return \PHPCI\Model\ProjectGroup - */ - public function getGroup() - { - $key = $this->getGroupId(); - - if (empty($key)) { - return null; - } - - $cacheKey = 'Cache.ProjectGroup.' . $key; - $rtn = $this->cache->get($cacheKey, null); - - if (empty($rtn)) { - $rtn = Factory::getStore('ProjectGroup', 'PHPCI')->getById($key); - $this->cache->set($cacheKey, $rtn); - } - - return $rtn; - } - - /** - * Set Group - Accepts an ID, an array representing a ProjectGroup or a ProjectGroup model. - * - * @param $value mixed - */ - public function setGroup($value) - { - // Is this an instance of ProjectGroup? - if ($value instanceof \PHPCI\Model\ProjectGroup) { - return $this->setGroupObject($value); - } - - // Is this an array representing a ProjectGroup item? - if (is_array($value) && !empty($value['id'])) { - return $this->setGroupId($value['id']); - } - - // Is this a scalar value representing the ID of this foreign key? - return $this->setGroupId($value); - } - - /** - * Set Group - Accepts a ProjectGroup model. - * - * @param $value \PHPCI\Model\ProjectGroup - */ - public function setGroupObject(\PHPCI\Model\ProjectGroup $value) - { - return $this->setGroupId($value->getId()); - } - /** * Get Build models by ProjectId for this Project. * diff --git a/PHPCI/Model/Base/ProjectGroupBase.php b/PHPCI/Model/Base/ProjectGroupBase.php deleted file mode 100644 index 3b5eed69..00000000 --- a/PHPCI/Model/Base/ProjectGroupBase.php +++ /dev/null @@ -1,168 +0,0 @@ - null, - 'title' => null, - ); - - /** - * @var array - */ - protected $getters = array( - // Direct property getters: - 'id' => 'getId', - 'title' => 'getTitle', - - // Foreign key getters: - ); - - /** - * @var array - */ - protected $setters = array( - // Direct property setters: - 'id' => 'setId', - 'title' => 'setTitle', - - // Foreign key setters: - ); - - /** - * @var array - */ - public $columns = array( - 'id' => array( - 'type' => 'int', - 'length' => 11, - 'primary_key' => true, - 'auto_increment' => true, - 'default' => null, - ), - 'title' => array( - 'type' => 'varchar', - 'length' => 100, - 'default' => null, - ), - ); - - /** - * @var array - */ - public $indexes = array( - 'PRIMARY' => array('unique' => true, 'columns' => 'id'), - ); - - /** - * @var array - */ - public $foreignKeys = array( - ); - - /** - * Get the value of Id / id. - * - * @return int - */ - public function getId() - { - $rtn = $this->data['id']; - - return $rtn; - } - - /** - * Get the value of Title / title. - * - * @return string - */ - public function getTitle() - { - $rtn = $this->data['title']; - - return $rtn; - } - - /** - * Set the value of Id / id. - * - * Must not be null. - * @param $value int - */ - public function setId($value) - { - $this->_validateNotNull('Id', $value); - $this->_validateInt('Id', $value); - - if ($this->data['id'] === $value) { - return; - } - - $this->data['id'] = $value; - - $this->_setModified('id'); - } - - /** - * Set the value of Title / title. - * - * Must not be null. - * @param $value string - */ - public function setTitle($value) - { - $this->_validateNotNull('Title', $value); - $this->_validateString('Title', $value); - - if ($this->data['title'] === $value) { - return; - } - - $this->data['title'] = $value; - - $this->_setModified('title'); - } - - /** - * Get Project models by GroupId for this ProjectGroup. - * - * @uses \PHPCI\Store\ProjectStore::getByGroupId() - * @uses \PHPCI\Model\Project - * @return \PHPCI\Model\Project[] - */ - public function getGroupProjects() - { - return Factory::getStore('Project', 'PHPCI')->getByGroupId($this->getId()); - } -} diff --git a/PHPCI/Model/Base/UserBase.php b/PHPCI/Model/Base/UserBase.php index 4de48537..e9be15a0 100644 --- a/PHPCI/Model/Base/UserBase.php +++ b/PHPCI/Model/Base/UserBase.php @@ -106,8 +106,6 @@ class UserBase extends Model public $indexes = array( 'PRIMARY' => array('unique' => true, 'columns' => 'id'), 'idx_email' => array('unique' => true, 'columns' => 'email'), - 'email' => array('unique' => true, 'columns' => 'email'), - 'name' => array('columns' => 'name'), ); /** diff --git a/PHPCI/Model/Build.php b/PHPCI/Model/Build.php index a8bfd683..0286b3b8 100644 --- a/PHPCI/Model/Build.php +++ b/PHPCI/Model/Build.php @@ -28,7 +28,7 @@ class Build extends BuildBase const STATUS_SUCCESS = 2; const STATUS_FAILED = 3; - public $currentBuildPath; + public $currentBuildPath = null; /** * Get link to commit from another source (i.e. Github) @@ -46,10 +46,6 @@ class Build extends BuildBase return '#'; } - /** - * Return a template to use to generate a link to a specific file. - * @return null - */ public function getFileLinkTemplate() { return null; @@ -99,21 +95,16 @@ class Build extends BuildBase { $build_config = null; + // Try phpci.yml first: + if (is_file($buildPath . '/phpci.yml')) { + $build_config = file_get_contents($buildPath . '/phpci.yml'); + } + // Try getting the project build config from the database: if (empty($build_config)) { $build_config = $this->getProject()->getBuildConfig(); } - // Try .phpci.yml - if (is_file($buildPath . '/.phpci.yml')) { - $build_config = file_get_contents($buildPath . '/.phpci.yml'); - } - - // Try phpci.yml first: - if (empty($build_config) && is_file($buildPath . '/phpci.yml')) { - $build_config = file_get_contents($buildPath . '/phpci.yml'); - } - // Fall back to zero config plugins: if (empty($build_config)) { $build_config = $this->getZeroConfigPlugins($builder); @@ -128,11 +119,6 @@ class Build extends BuildBase return true; } - /** - * Get an array of plugins to run if there's no phpci.yml file. - * @param Builder $builder - * @return array - */ protected function getZeroConfigPlugins(Builder $builder) { $pluginDir = PHPCI_DIR . 'PHPCI/Plugin/'; @@ -179,11 +165,6 @@ class Build extends BuildBase return $config; } - /** - * Return a value from the build's "extra" JSON array. - * @param null $key - * @return mixed|null|string - */ public function getExtra($key = null) { $data = json_decode($this->data['extra'], true); @@ -198,104 +179,4 @@ class Build extends BuildBase return $rtn; } - - /** - * Returns the commit message for this build. - * @return string - */ - public function getCommitMessage() - { - $rtn = htmlspecialchars($this->data['commit_message']); - - return $rtn; - } - - /** - * Allows specific build types (e.g. Github) to report violations back to their respective services. - * @param Builder $builder - * @param $plugin - * @param $message - * @param int $severity - * @param null $file - * @param null $lineStart - * @param null $lineEnd - * @return BuildError - */ - public function reportError( - Builder $builder, - $plugin, - $message, - $severity = BuildError::SEVERITY_NORMAL, - $file = null, - $lineStart = null, - $lineEnd = null - ) { - unset($builder); - - $error = new BuildError(); - $error->setBuild($this); - $error->setCreatedDate(new \DateTime()); - $error->setPlugin($plugin); - $error->setMessage($message); - $error->setSeverity($severity); - $error->setFile($file); - $error->setLineStart($lineStart); - $error->setLineEnd($lineEnd); - - return Factory::getStore('BuildError')->save($error); - } - - /** - * Return the path to run this build into. - * - * @return string|null - */ - public function getBuildPath() - { - if (!$this->getId()) { - return null; - } - - if (empty($this->currentBuildPath)) { - $buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5); - $this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . DIRECTORY_SEPARATOR; - } - - return $this->currentBuildPath; - } - - /** - * Removes the build directory. - */ - public function removeBuildDirectory() - { - $buildPath = $this->getBuildPath(); - - if (!$buildPath || !is_dir($buildPath)) { - return; - } - - exec(sprintf(IS_WIN ? 'rmdir /S /Q "%s"' : 'rm -Rf "%s"', $buildPath)); - } - - /** - * Get the number of seconds a build has been running for. - * @return int - */ - public function getDuration() - { - $start = $this->getStarted(); - - if (empty($start)) { - return 0; - } - - $end = $this->getFinished(); - - if (empty($end)) { - $end = new \DateTime(); - } - - return $end->getTimestamp() - $start->getTimestamp(); - } } diff --git a/PHPCI/Model/Build/GithubBuild.php b/PHPCI/Model/Build/GithubBuild.php index a9a18913..e0ff0fc0 100644 --- a/PHPCI/Model/Build/GithubBuild.php +++ b/PHPCI/Model/Build/GithubBuild.php @@ -10,8 +10,6 @@ namespace PHPCI\Model\Build; use PHPCI\Builder; -use PHPCI\Helper\Diff; -use PHPCI\Helper\Github; use PHPCI\Model\Build\RemoteGitBuild; /** @@ -45,52 +43,39 @@ class GithubBuild extends RemoteGitBuild { $token = \b8\Config::getInstance()->get('phpci.github.token'); - if (empty($token) || empty($this->data['id'])) { + if (empty($token)) { return; } $project = $this->getProject(); - if (empty($project)) { - return; - } - $url = 'https://api.github.com/repos/'.$project->getReference().'/statuses/'.$this->getCommitId(); $http = new \b8\HttpClient(); - switch ($this->getStatus()) { + switch($this->getStatus()) + { case 0: case 1: $status = 'pending'; - $description = 'PHPCI build running.'; break; case 2: $status = 'success'; - $description = 'PHPCI build passed.'; break; case 3: $status = 'failure'; - $description = 'PHPCI build failed.'; break; default: $status = 'error'; - $description = 'PHPCI build failed to complete.'; break; } $phpciUrl = \b8\Config::getInstance()->get('phpci.url'); - - $params = array( - 'state' => $status, - 'target_url' => $phpciUrl . '/build/view/' . $this->getId(), - 'description' => $description, - 'context' => 'PHPCI', - ); - + $params = array( 'state' => $status, + 'target_url' => $phpciUrl . '/build/view/' . $this->getId()); $headers = array( 'Authorization: token ' . $token, 'Content-Type: application/x-www-form-urlencoded' - ); + ); $http->setHeaders($headers); $http->request('POST', $url, json_encode($params)); @@ -110,31 +95,18 @@ class GithubBuild extends RemoteGitBuild } } - /** - * Get a parsed version of the commit message, with links to issues and commits. - * @return string - */ public function getCommitMessage() { - $rtn = parent::getCommitMessage($this->data['commit_message']); + $rtn = $this->data['commit_message']; - $project = $this->getProject(); - - if (!is_null($project)) { - $reference = $project->getReference(); - $commitLink = '#$1'; - $rtn = preg_replace('/\#([0-9]+)/', $commitLink, $rtn); - $rtn = preg_replace('/\@([a-zA-Z0-9_]+)/', '@$1', $rtn); - } + $reference = $this->getProject()->getReference(); + $commitLink = '#$1'; + $rtn = preg_replace('/\#([0-9]+)/', $commitLink, $rtn); + $rtn = preg_replace('/\@([a-zA-Z0-9_]+)/', '@$1', $rtn); return $rtn; } - /** - * Get a template to use for generating links to files. - * e.g. https://github.com/block8/phpci/blob/master/{FILE}#L{LINE} - * @return string - */ public function getFileLinkTemplate() { $reference = $this->getProject()->getReference(); @@ -142,7 +114,7 @@ class GithubBuild extends RemoteGitBuild if ($this->getExtra('build_type') == 'pull_request') { $matches = array(); - preg_match('/[\/:]([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra('remote_url'), $matches); + preg_match('/\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra('remote_url'), $matches); $reference = $matches[1]; $branch = $this->getExtra('remote_branch'); @@ -151,17 +123,11 @@ class GithubBuild extends RemoteGitBuild $link = 'https://github.com/' . $reference . '/'; $link .= 'blob/' . $branch . '/'; $link .= '{FILE}'; - $link .= '#L{LINE}-L{LINE_END}'; + $link .= '#L{LINE}'; return $link; } - /** - * Handle any post-clone tasks, like applying a pull request patch on top of the branch. - * @param Builder $builder - * @param $cloneTo - * @return bool - */ protected function postCloneSetup(Builder $builder, $cloneTo) { $buildType = $this->getExtra('build_type'); @@ -186,69 +152,4 @@ class GithubBuild extends RemoteGitBuild return $success; } - - /** - * @inheritDoc - */ - public function reportError( - Builder $builder, - $plugin, - $message, - $severity = BuildError::SEVERITY_NORMAL, - $file = null, - $lineStart = null, - $lineEnd = null - ) { - $diffLineNumber = $this->getDiffLineNumber($builder, $file, $lineStart); - - if (!is_null($diffLineNumber)) { - $helper = new Github(); - - $repo = $this->getProject()->getReference(); - $prNumber = $this->getExtra('pull_request_number'); - $commit = $this->getCommitId(); - - if (!empty($prNumber)) { - $helper->createPullRequestComment($repo, $prNumber, $commit, $file, $diffLineNumber, $message); - } else { - $helper->createCommitComment($repo, $commit, $file, $diffLineNumber, $message); - } - } - - return parent::reportError($builder, $plugin, $message, $severity, $file, $lineStart, $lineEnd); - } - - /** - * Uses git diff to figure out what the diff line position is, based on the error line number. - * @param Builder $builder - * @param $file - * @param $line - * @return int|null - */ - protected function getDiffLineNumber(Builder $builder, $file, $line) - { - $line = (integer)$line; - - $builder->logExecOutput(false); - - $prNumber = $this->getExtra('pull_request_number'); - $path = $builder->buildPath; - - if (!empty($prNumber)) { - $builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file); - } else { - $commitId = $this->getCommitId(); - $compare = $commitId == 'Manual' ? 'HEAD' : $commitId; - $builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file); - } - - $builder->logExecOutput(true); - - $diff = $builder->getLastOutput(); - - $helper = new Diff(); - $lines = $helper->getLinePositions($diff); - - return isset($lines[$line]) ? $lines[$line] : null; - } } diff --git a/PHPCI/Model/Build/GitlabBuild.php b/PHPCI/Model/Build/GitlabBuild.php index a1e0562c..086bc046 100644 --- a/PHPCI/Model/Build/GitlabBuild.php +++ b/PHPCI/Model/Build/GitlabBuild.php @@ -47,7 +47,7 @@ class GitlabBuild extends RemoteGitBuild 'http://%s/%s/blob/%s/{FILE}#L{LINE}', $this->getProject()->getAccessInformation("domain"), $this->getProject()->getReference(), - $this->getCommitId() + $this->getBranch() ); } diff --git a/PHPCI/Model/Build/LocalBuild.php b/PHPCI/Model/Build/LocalBuild.php index 5131abe1..3fd5e532 100644 --- a/PHPCI/Model/Build/LocalBuild.php +++ b/PHPCI/Model/Build/LocalBuild.php @@ -35,14 +35,12 @@ class LocalBuild extends Build return $this->handleConfig($builder, $buildPath) !== false; } - $configHandled = $this->handleConfig($builder, $reference); + $buildSettings = $this->handleConfig($builder, $reference); - if ($configHandled === false) { + if ($buildSettings === false) { return false; } - $buildSettings = $builder->getConfig('build_settings'); - if (isset($buildSettings['prefer_symlink']) && $buildSettings['prefer_symlink'] === true) { return $this->handleSymlink($builder, $reference, $buildPath); } else { @@ -56,13 +54,6 @@ class LocalBuild extends Build return true; } - /** - * Check if this is a "bare" git repository, and if so, unarchive it. - * @param Builder $builder - * @param $reference - * @param $buildPath - * @return bool - */ protected function handleBareRepository(Builder $builder, $reference, $buildPath) { $gitConfig = parse_ini_file($reference.'/config', true); @@ -77,13 +68,6 @@ class LocalBuild extends Build return false; } - /** - * Create a symlink if required. - * @param Builder $builder - * @param $reference - * @param $buildPath - * @return bool - */ protected function handleSymlink(Builder $builder, $reference, $buildPath) { if (is_link($buildPath) && is_file($buildPath)) { diff --git a/PHPCI/Model/Build/MercurialBuild.php b/PHPCI/Model/Build/MercurialBuild.php index 0f38940b..500b5372 100644 --- a/PHPCI/Model/Build/MercurialBuild.php +++ b/PHPCI/Model/Build/MercurialBuild.php @@ -13,87 +13,36 @@ use PHPCI\Model\Build; use PHPCI\Builder; /** - * Mercurial Build Model - * @author Pavel Gopanenko - * @package PHPCI - * @subpackage Core - */ +* Mercurial Build Model +* @author Pavel Gopanenko +* @package PHPCI +* @subpackage Core +*/ class MercurialBuild extends Build { /** - * Get the URL to be used to clone this remote repository. - */ + * Get the URL to be used to clone this remote repository. + */ protected function getCloneUrl() { return $this->getProject()->getReference(); } /** - * Create a working copy by cloning, copying, or similar. - */ + * Create a working copy by cloning, copying, or similar. + */ public function createWorkingCopy(Builder $builder, $buildPath) { - $key = trim($this->getProject()->getSshPublicKey()); - - if (!empty($key) && strpos($this->getProject()->getReference(), 'ssh') > -1) { - $success = $this->cloneBySsh($builder, $buildPath); - } else { - $success = $this->cloneByHttp($builder, $buildPath); - } - - if (!$success) { - $builder->logFailure('Failed to clone remote git repository.'); - return false; - } + $this->cloneByHttp($builder, $buildPath); return $this->handleConfig($builder, $buildPath); } /** - * Use a HTTP-based Mercurial clone. - */ + * Use an mercurial clone. + */ protected function cloneByHttp(Builder $builder, $cloneTo) { return $builder->executeCommand('hg clone %s "%s" -r %s', $this->getCloneUrl(), $cloneTo, $this->getBranch()); } - - /** - * Use an SSH-based Mercurial clone. - */ - protected function cloneBySsh(Builder $builder, $cloneTo) - { - $keyFile = $this->writeSshKey(); - - // Do the git clone: - $cmd = 'hg clone --ssh "ssh -i '.$keyFile.'" %s "%s"'; - $success = $builder->executeCommand($cmd, $this->getCloneUrl(), $cloneTo); - - if ($success) { - $success = $this->postCloneSetup($builder, $cloneTo); - } - - // Remove the key file: - unlink($keyFile); - return $success; - } - - /** - * Handle post-clone tasks (switching branch, etc.) - * @param Builder $builder - * @param $cloneTo - * @return bool - */ - protected function postCloneSetup(Builder $builder, $cloneTo) - { - $success = true; - $commit = $this->getCommitId(); - - // Allow switching to a specific branch: - if (!empty($commit) && $commit != 'Manual') { - $cmd = 'cd "%s" && hg checkout %s'; - $success = $builder->executeCommand($cmd, $cloneTo, $this->getBranch()); - } - - return $success; - } } diff --git a/PHPCI/Model/Build/RemoteGitBuild.php b/PHPCI/Model/Build/RemoteGitBuild.php index faaccfb5..125515c3 100644 --- a/PHPCI/Model/Build/RemoteGitBuild.php +++ b/PHPCI/Model/Build/RemoteGitBuild.php @@ -54,7 +54,7 @@ class RemoteGitBuild extends Build */ protected function cloneByHttp(Builder $builder, $cloneTo) { - $cmd = 'git clone --recursive '; + $cmd = 'git clone '; $depth = $builder->getConfig('clone_depth'); @@ -84,7 +84,7 @@ class RemoteGitBuild extends Build } // Do the git clone: - $cmd = 'git clone --recursive '; + $cmd = 'git clone '; $depth = $builder->getConfig('clone_depth'); @@ -113,27 +113,21 @@ class RemoteGitBuild extends Build return $success; } - /** - * Handle any post-clone tasks, like switching branches. - * @param Builder $builder - * @param $cloneTo - * @return bool - */ protected function postCloneSetup(Builder $builder, $cloneTo) { $success = true; $commit = $this->getCommitId(); - $chdir = IS_WIN ? 'cd /d "%s"' : 'cd "%s"'; - if (!empty($commit) && $commit != 'Manual') { - $cmd = $chdir . ' && git checkout %s --quiet'; - $success = $builder->executeCommand($cmd, $cloneTo, $commit); - } + $cmd = 'cd "%s"'; - // Always update the commit hash with the actual HEAD hash - if ($builder->executeCommand($chdir . ' && git rev-parse HEAD', $cloneTo)) { - $this->setCommitId(trim($builder->getLastOutput())); + if (IS_WIN) { + $cmd = 'cd /d "%s"'; + } + + $cmd .= ' && git checkout %s --quiet'; + + $success = $builder->executeCommand($cmd, $cloneTo, $this->getCommitId()); } return $success; diff --git a/PHPCI/Model/Build/SubversionBuild.php b/PHPCI/Model/Build/SubversionBuild.php deleted file mode 100644 index af884933..00000000 --- a/PHPCI/Model/Build/SubversionBuild.php +++ /dev/null @@ -1,182 +0,0 @@ - - * @package PHPCI - * @subpackage Core - */ -class SubversionBuild extends Build -{ - protected $svnCommand = 'svn export -q --non-interactive '; - - /** - * Get the URL to be used to clone this remote repository. - */ - protected function getCloneUrl() - { - $url = $this->getProject()->getReference(); - - if (substr($url, -1) != '/') { - $url .= '/'; - } - - $branch = $this->getBranch(); - - if (empty($branch) || $branch == 'trunk') { - $url .= 'trunk'; - } else { - $url .= 'branches/' . $branch; - } - - return $url; - } - - /** - * @param Builder $builder - * - * @return void - */ - protected function extendSvnCommandFromConfig(Builder $builder) - { - $cmd = $this->svnCommand; - - $svn = $builder->getConfig('svn'); - if ($svn) { - foreach ($svn as $key => $value) { - $cmd .= " --$key $value "; - } - } - - $depth = $builder->getConfig('clone_depth'); - - if (!is_null($depth)) { - $cmd .= ' --depth ' . intval($depth) . ' '; - } - - $this->svnCommand = $cmd; - } - - /** - * Create a working copy by cloning, copying, or similar. - */ - public function createWorkingCopy(Builder $builder, $buildPath) - { - $this->handleConfig($builder, $buildPath); - - $this->extendSvnCommandFromConfig($builder); - - $key = trim($this->getProject()->getSshPrivateKey()); - - if (!empty($key)) { - $success = $this->cloneBySsh($builder, $buildPath); - } else { - $success = $this->cloneByHttp($builder, $buildPath); - } - - if (!$success) { - $builder->logFailure('Failed to export remote subversion repository.'); - return false; - } - - return $this->handleConfig($builder, $buildPath); - } - - /** - * Use an HTTP-based svn export. - */ - protected function cloneByHttp(Builder $builder, $cloneTo) - { - $cmd = $this->svnCommand; - - if ($this->getCommitId() != 'Manual') { - $cmd .= ' -r %s %s "%s"'; - $success = $builder->executeCommand($cmd, $this->getCommitId(), $this->getCloneUrl(), $cloneTo); - } else { - $cmd .= ' %s "%s"'; - $success = $builder->executeCommand($cmd, $this->getCloneUrl(), $cloneTo); - } - - return $success; - } - - /** - * Use an SSH-based svn export. - */ - protected function cloneBySsh(Builder $builder, $cloneTo) - { - $cmd = $this->svnCommand . ' %s "%s"'; - - if (!IS_WIN) { - $keyFile = $this->writeSshKey($cloneTo); - $sshWrapper = $this->writeSshWrapper($cloneTo, $keyFile); - $cmd = 'export SVN_SSH="' . $sshWrapper . '" && ' . $cmd; - } - - $success = $builder->executeCommand($cmd, $this->getCloneUrl(), $cloneTo); - - if (!IS_WIN) { - // Remove the key file and svn wrapper: - unlink($keyFile); - unlink($sshWrapper); - } - - return $success; - } - - /** - * Create an SSH key file on disk for this build. - * @param $cloneTo - * @return string - */ - protected function writeSshKey($cloneTo) - { - $keyPath = dirname($cloneTo . '/temp'); - $keyFile = $keyPath . '.key'; - - // Write the contents of this project's svn key to the file: - file_put_contents($keyFile, $this->getProject()->getSshPrivateKey()); - chmod($keyFile, 0600); - - // Return the filename: - return $keyFile; - } - - /** - * Create an SSH wrapper script for Svn to use, to disable host key checking, etc. - * @param $cloneTo - * @param $keyFile - * @return string - */ - protected function writeSshWrapper($cloneTo, $keyFile) - { - $path = dirname($cloneTo . '/temp'); - $wrapperFile = $path . '.sh'; - - $sshFlags = '-o CheckHostIP=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o PasswordAuthentication=no'; - - // Write out the wrapper script for this build: - $script = <<getSeverity()) { - case self::SEVERITY_CRITICAL: - return 'critical'; - - case self::SEVERITY_HIGH: - return 'high'; - - case self::SEVERITY_NORMAL: - return 'normal'; - - case self::SEVERITY_LOW: - return 'low'; - } - } - - /** - * Get the class to apply to HTML elements representing this error. - * @return string - */ - public function getSeverityClass() - { - switch ($this->getSeverity()) { - case self::SEVERITY_CRITICAL: - return 'danger'; - - case self::SEVERITY_HIGH: - return 'warning'; - - case self::SEVERITY_NORMAL: - return 'info'; - - case self::SEVERITY_LOW: - return 'default'; - } - } -} diff --git a/PHPCI/Model/Project.php b/PHPCI/Model/Project.php index 4b5268b2..98283d77 100644 --- a/PHPCI/Model/Project.php +++ b/PHPCI/Model/Project.php @@ -22,12 +22,6 @@ use b8\Store; */ class Project extends ProjectBase { - /** - * Return the latest build from a specific branch, of a specific status, for this project. - * @param string $branch - * @param null $status - * @return mixed|null - */ public function getLatestBuild($branch = 'master', $status = null) { $criteria = array('branch' => $branch, 'project_id' => $this->getId()); @@ -50,33 +44,6 @@ class Project extends ProjectBase return null; } - /** - * Return the previous build from a specific branch, for this project. - * @param string $branch - * @return mixed|null - */ - public function getPreviousBuild($branch = 'master') - { - $criteria = array('branch' => $branch, 'project_id' => $this->getId()); - - $order = array('id' => 'DESC'); - $builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, array(), $order); - - if (is_array($builds['items']) && count($builds['items'])) { - $previous = array_shift($builds['items']); - - if (isset($previous) && $previous instanceof Build) { - return $previous; - } - } - - return null; - } - - /** - * Store this project's access_information data - * @param string|array $value - */ public function setAccessInformation($value) { if (is_array($value)) { @@ -86,17 +53,12 @@ class Project extends ProjectBase parent::setAccessInformation($value); } - /** - * Get this project's access_information data. Pass a specific key or null for all data. - * @param string|null $key - * @return mixed|null|string - */ public function getAccessInformation($key = null) { $info = $this->data['access_information']; // Handle old-format (serialized) access information first: - if (!empty($info) && !in_array(substr($info, 0, 1), array('{', '['))) { + if (!empty($info) && substr($info, 0, 1) != '{') { $data = unserialize($info); } else { $data = json_decode($info, true); @@ -127,10 +89,6 @@ class Project extends ProjectBase } } - /** - * Return the name of a FontAwesome icon to represent this project, depending on its type. - * @return string - */ public function getIcon() { switch ($this->getType()) { diff --git a/PHPCI/Model/ProjectGroup.php b/PHPCI/Model/ProjectGroup.php deleted file mode 100644 index f85e6339..00000000 --- a/PHPCI/Model/ProjectGroup.php +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/PHPCI/Plugin/Atoum.php b/PHPCI/Plugin/Atoum.php index 877f009b..4bbdb27b 100644 --- a/PHPCI/Plugin/Atoum.php +++ b/PHPCI/Plugin/Atoum.php @@ -10,25 +10,14 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; -/** - * Atoum plugin, runs Atoum tests within a project. - * @package PHPCI\Plugin - */ class Atoum implements \PHPCI\Plugin { private $args; private $config; private $directory; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -53,10 +42,6 @@ class Atoum implements \PHPCI\Plugin } } - /** - * Run the Atoum plugin. - * @return bool - */ public function execute() { $cmd = $this->executable; @@ -82,7 +67,7 @@ class Atoum implements \PHPCI\Plugin } if (count($output) == 0) { $status = false; - $this->phpci->log(Lang::get('no_tests_performed')); + $this->phpci->log("No test have been performed!"); } return $status; diff --git a/PHPCI/Plugin/Behat.php b/PHPCI/Plugin/Behat.php index d63016dc..f6334d05 100644 --- a/PHPCI/Plugin/Behat.php +++ b/PHPCI/Plugin/Behat.php @@ -10,9 +10,7 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; -use PHPCI\Model\BuildError; /** * Behat BDD Plugin @@ -26,18 +24,6 @@ class Behat implements \PHPCI\Plugin protected $build; protected $features; - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -66,73 +52,13 @@ class Behat implements \PHPCI\Plugin $behat = $this->executable; if (!$behat) { - $this->phpci->logFailure(Lang::get('could_not_find', 'behat')); - + $this->phpci->logFailure('Could not find behat.'); return false; } $success = $this->phpci->executeCommand($behat . ' %s', $this->features); chdir($curdir); - list($errorCount, $data) = $this->parseBehatOutput(); - - $this->build->storeMeta('behat-warnings', $errorCount); - $this->build->storeMeta('behat-data', $data); - return $success; } - - /** - * Parse the behat output and return details on failures - * - * @return array - */ - public function parseBehatOutput() - { - $output = $this->phpci->getLastOutput(); - - $parts = explode('---', $output); - - if (count($parts) <= 1) { - return array(0, array()); - } - - $lines = explode(PHP_EOL, $parts[1]); - - $storeFailures = false; - $data = array(); - - foreach ($lines as $line) { - $line = trim($line); - if ($line == 'Failed scenarios:') { - $storeFailures = true; - continue; - } - - if (strpos($line, ':') === false) { - $storeFailures = false; - } - - if ($storeFailures) { - $lineParts = explode(':', $line); - $data[] = array( - 'file' => $lineParts[0], - 'line' => $lineParts[1] - ); - - $this->build->reportError( - $this->phpci, - 'behat', - 'Behat scenario failed.', - BuildError::SEVERITY_HIGH, - $lineParts[0], - $lineParts[1] - ); - } - } - - $errorCount = count($data); - - return array($errorCount, $data); - } } diff --git a/PHPCI/Plugin/Campfire.php b/PHPCI/Plugin/Campfire.php index 59ab9128..d4506a07 100644 --- a/PHPCI/Plugin/Campfire.php +++ b/PHPCI/Plugin/Campfire.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -29,41 +28,30 @@ class Campfire implements \PHPCI\Plugin private $verbose; private $roomId; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - * @throws \Exception - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { - $this->phpci = $phpci; - $this->build = $build; - $this->message = $options['message']; + $this->phpci = $phpci; + $this->build = $build; + + $this->message = $options['message']; $this->userAgent = "PHPCI/1.0 (+http://www.phptesting.org/)"; - $this->cookie = "phpcicookie"; + $this->cookie = "phpcicookie"; $buildSettings = $phpci->getConfig('build_settings'); - if (isset($buildSettings['campfire'])) { - $campfire = $buildSettings['campfire']; - $this->url = $campfire['url']; + $campfire = $buildSettings['campfire']; + $this->url = $campfire['url']; $this->authToken = $campfire['authToken']; - $this->roomId = $campfire['roomId']; + $this->roomId = $campfire['roomId']; } else { - throw new \Exception(Lang::get('no_campfire_settings')); + throw new \Exception("No connection parameters given for Campfire plugin"); } } - /** - * Run the Campfire plugin. - * @return bool|mixed - */ public function execute() { - $url = PHPCI_URL . "build/view/" . $this->build->getId(); + $url = PHPCI_URL."build/view/".$this->build->getId(); $message = str_replace("%buildurl%", $url, $this->message); $this->joinRoom($this->roomId); $status = $this->speak($message, $this->roomId); @@ -73,35 +61,19 @@ class Campfire implements \PHPCI\Plugin } - /** - * Join a Campfire room. - * @param $roomId - */ public function joinRoom($roomId) { $this->getPageByPost('/room/'.$roomId.'/join.json'); } - /** - * Leave a Campfire room. - * @param $roomId - */ public function leaveRoom($roomId) { $this->getPageByPost('/room/'.$roomId.'/leave.json'); } - /** - * Send a message to a campfire room. - * @param $message - * @param $roomId - * @param bool $isPaste - * @return bool|mixed - */ public function speak($message, $roomId, $isPaste = false) { $page = '/room/'.$roomId.'/speak.json'; - if ($isPaste) { $type = 'PasteMessage'; } else { @@ -112,12 +84,6 @@ class Campfire implements \PHPCI\Plugin } - /** - * Make a request to Campfire. - * @param $page - * @param null $data - * @return bool|mixed - */ private function getPageByPost($page, $data = null) { $url = $this->url . $page; @@ -144,13 +110,12 @@ class Campfire implements \PHPCI\Plugin // We tend to get one space with an otherwise blank response $output = trim($output); - if (strlen($output)) { /* Responses are JSON. Decode it to a data structure */ return json_decode($output); } - // Simple 200 OK response (such as for joining a room) + // TODO: check for other result codes here return true; } } diff --git a/PHPCI/Plugin/CleanBuild.php b/PHPCI/Plugin/CleanBuild.php index 684e8e7a..af0a6e02 100644 --- a/PHPCI/Plugin/CleanBuild.php +++ b/PHPCI/Plugin/CleanBuild.php @@ -25,23 +25,11 @@ class CleanBuild implements \PHPCI\Plugin protected $phpci; protected $build; - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @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->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array(); + $this->phpci = $phpci; + $this->build = $build; + $this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array(); } /** @@ -57,7 +45,7 @@ class CleanBuild implements \PHPCI\Plugin $this->phpci->executeCommand($cmd, $this->phpci->buildPath . 'composer.lock'); $success = true; - + foreach ($this->remove as $file) { $ok = $this->phpci->executeCommand($cmd, $this->phpci->buildPath . $file); diff --git a/PHPCI/Plugin/Codeception.php b/PHPCI/Plugin/Codeception.php index c28e3a48..e29b81a2 100644 --- a/PHPCI/Plugin/Codeception.php +++ b/PHPCI/Plugin/Codeception.php @@ -10,154 +10,92 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; -use PHPCI\Plugin\Util\TestResultParsers\Codeception as Parser; -use Psr\Log\LogLevel; /** * Codeception Plugin - Enables full acceptance, unit, and functional testing. * @author Don Gilbert - * @author Igor Timoshenko - * @author Adam Cooper * @package PHPCI * @subpackage Plugins */ -class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin +class Codeception implements \PHPCI\Plugin { - /** @var string */ + /** + * @var string + */ protected $args = ''; - /** @var Builder */ + /** + * @var Builder + */ protected $phpci; - /** @var Build */ protected $build; /** - * @var string $ymlConfigFile The path of a yml config for Codeception + * @var string|string[] $xmlConfigFile The path (or array of paths) of an xml config for PHPUnit */ - protected $ymlConfigFile; + protected $xmlConfigFile; - /** - * @var string $path The path to the codeception tests folder. - */ - protected $path; - - /** - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool - */ - public static function canExecute($stage, Builder $builder, Build $build) - { - return $stage == 'test' && !is_null(self::findConfigFile($builder->buildPath)); - } - - /** - * Try and find the codeception YML config file. - * @param $buildPath - * @return null|string - */ - public static function findConfigFile($buildPath) - { - if (file_exists($buildPath . 'codeception.yml')) { - return 'codeception.yml'; - } - - if (file_exists($buildPath . 'codeception.dist.yml')) { - return 'codeception.dist.yml'; - } - - return null; - } - - /** - * Set up the plugin, configure options, etc. - * @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->path = 'tests' . DIRECTORY_SEPARATOR . '_output' . DIRECTORY_SEPARATOR; - if (empty($options['config'])) { - $this->ymlConfigFile = self::findConfigFile($this->phpci->buildPath); - } else { - $this->ymlConfigFile = $options['config']; + if (isset($options['config'])) { + $this->xmlConfigFile = $options['config']; } if (isset($options['args'])) { $this->args = (string) $options['args']; } - if (isset($options['path'])) { - $this->path = $options['path']; - } } /** - * Runs Codeception tests + * Runs Codeception tests, optionally using specified config file(s). */ public function execute() { - if (empty($this->ymlConfigFile)) { - throw new \Exception("No configuration file found"); - } + $success = true; // Run any config files first. This can be either a single value or an array. - return $this->runConfigFile($this->ymlConfigFile); - } - - /** - * Run tests from a Codeception config file. - * @param $configPath - * @return bool|mixed - * @throws \Exception - */ - protected function runConfigFile($configPath) - { - $this->phpci->logExecOutput(false); - - $codecept = $this->phpci->findBinary('codecept'); - - if (!$codecept) { - $this->phpci->logFailure(Lang::get('could_not_find', 'codecept')); - - return false; + if ($this->xmlConfigFile !== null) { + $success &= $this->runConfigFile($this->xmlConfigFile); } - $cmd = 'cd "%s" && ' . $codecept . ' run -c "%s" --xml ' . $this->args; - - if (IS_WIN) { - $cmd = 'cd /d "%s" && ' . $codecept . ' run -c "%s" --xml ' . $this->args; - } - - $configPath = $this->phpci->buildPath . $configPath; - $success = $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $configPath); - - $this->phpci->log( - 'Codeception XML path: '. $this->phpci->buildPath . $this->path . 'report.xml', - Loglevel::DEBUG - ); - - $xml = file_get_contents($this->phpci->buildPath . $this->path . 'report.xml', false); - $parser = new Parser($this->phpci, $xml); - $output = $parser->parse(); - - $meta = array( - 'tests' => $parser->getTotalTests(), - 'timetaken' => $parser->getTotalTimeTaken(), - 'failures' => $parser->getTotalFailures() - ); - - $this->build->storeMeta('codeception-meta', $meta); - $this->build->storeMeta('codeception-data', $output); - $this->build->storeMeta('codeception-errors', $parser->getTotalFailures()); - $this->phpci->logExecOutput(true); - + return $success; + } + + protected function runConfigFile($configPath) + { + if (is_array($configPath)) { + return $this->recurseArg($configPath, array($this, "runConfigFile")); + } else { + + $codecept = $this->phpci->findBinary('codecept'); + + if (!$codecept) { + $this->phpci->logFailure('Could not find codeception.'); + return false; + } + + $cmd = 'cd "%s" && ' . $codecept . ' run -c "%s" '. $this->args; + if (IS_WIN) { + $cmd = 'cd /d "%s" && ' . $codecept . ' run -c "%s" '. $this->args; + } + + $configPath = $this->phpci->buildPath . $configPath; + $success = $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $configPath); + + return $success; + } + } + + protected function recurseArg($array, $callable) + { + $success = true; + foreach ($array as $subItem) { + $success &= call_user_func($callable, $subItem); + } return $success; } } diff --git a/PHPCI/Plugin/Composer.php b/PHPCI/Plugin/Composer.php index 7bd86ac3..dbea469c 100644 --- a/PHPCI/Plugin/Composer.php +++ b/PHPCI/Plugin/Composer.php @@ -12,7 +12,6 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; -use PHPCI\Helper\Lang; /** * Composer Plugin - Provides access to Composer functionality. @@ -27,18 +26,10 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected $preferDist; protected $phpci; protected $build; - protected $nodev; - /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool - */ public static function canExecute($stage, Builder $builder, Build $build) { - $path = $builder->buildPath . DIRECTORY_SEPARATOR . 'composer.json'; + $path = $builder->buildPath . '/composer.json'; if (file_exists($path) && $stage == 'setup') { return true; @@ -47,25 +38,17 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return false; } - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { - $path = $phpci->buildPath; - $this->phpci = $phpci; - $this->build = $build; - $this->directory = $path; - $this->action = 'install'; + $path = $phpci->buildPath; + $this->phpci = $phpci; + $this->build = $build; + $this->directory = $path; + $this->action = 'install'; $this->preferDist = false; - $this->preferSource = false; - $this->nodev = false; if (array_key_exists('directory', $options)) { - $this->directory = $path . DIRECTORY_SEPARATOR . $options['directory']; + $this->directory = $path . '/' . $options['directory']; } if (array_key_exists('action', $options)) { @@ -75,15 +58,6 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin if (array_key_exists('prefer_dist', $options)) { $this->preferDist = (bool)$options['prefer_dist']; } - - if (array_key_exists('prefer_source', $options)) { - $this->preferDist = false; - $this->preferSource = (bool)$options['prefer_source']; - } - - if (array_key_exists('no_dev', $options)) { - $this->nodev = (bool)$options['no_dev']; - } } /** @@ -93,6 +67,11 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin { $composerLocation = $this->phpci->findBinary(array('composer', 'composer.phar')); + if (!$composerLocation) { + $this->phpci->logFailure('Could not find Composer.'); + return false; + } + $cmd = ''; if (IS_WIN) { @@ -103,17 +82,10 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin if ($this->preferDist) { $this->phpci->log('Using --prefer-dist flag'); - $cmd .= ' --prefer-dist'; - } - - if ($this->preferSource) { + $cmd .= '--prefer-dist'; + } else { $this->phpci->log('Using --prefer-source flag'); - $cmd .= ' --prefer-source'; - } - - if ($this->nodev) { - $this->phpci->log('Using --no-dev flag'); - $cmd .= ' --no-dev'; + $cmd .= '--prefer-source'; } $cmd .= ' --working-dir="%s" %s'; diff --git a/PHPCI/Plugin/CopyBuild.php b/PHPCI/Plugin/CopyBuild.php index f9646cac..9be32395 100644 --- a/PHPCI/Plugin/CopyBuild.php +++ b/PHPCI/Plugin/CopyBuild.php @@ -11,7 +11,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Model\Build; -use PHPCI\Helper\Lang; /** * Copy Build Plugin - Copies the entire build to another directory. @@ -27,20 +26,14 @@ class CopyBuild implements \PHPCI\Plugin protected $phpci; protected $build; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { - $path = $phpci->buildPath; - $this->phpci = $phpci; - $this->build = $build; - $this->directory = isset($options['directory']) ? $options['directory'] : $path; - $this->wipe = isset($options['wipe']) ? (bool)$options['wipe'] : false; - $this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false; + $path = $phpci->buildPath; + $this->phpci = $phpci; + $this->build = $build; + $this->directory = isset($options['directory']) ? $options['directory'] : $path; + $this->wipe = isset($options['wipe']) ? (bool)$options['wipe'] : false; + $this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false; } /** @@ -68,25 +61,17 @@ class CopyBuild implements \PHPCI\Plugin return $success; } - /** - * Wipe the destination directory if it already exists. - * @throws \Exception - */ protected function wipeExistingDirectory() { - if ($this->wipe === true && $this->directory != '/' && is_dir($this->directory)) { + if ($this->wipe == true && $this->directory != '/' && is_dir($this->directory)) { $cmd = 'rm -Rf "%s*"'; $success = $this->phpci->executeCommand($cmd, $this->directory); - if (!$success) { - throw new \Exception(Lang::get('failed_to_wipe', $this->directory)); + throw new \Exception('Failed to wipe existing directory ' . $this->directory . ' before copy'); } } } - /** - * Delete any ignored files from the build prior to copying. - */ protected function deleteIgnoredFiles() { if ($this->ignore) { diff --git a/PHPCI/Plugin/Deployer.php b/PHPCI/Plugin/Deployer.php deleted file mode 100644 index 9c56a340..00000000 --- a/PHPCI/Plugin/Deployer.php +++ /dev/null @@ -1,73 +0,0 @@ - -* @package PHPCI -* @subpackage Plugins -*/ -class Deployer implements \PHPCI\Plugin -{ - protected $webhookUrl; - protected $reason; - protected $updateOnly; - - /** - * Set up the plugin, configure options, etc. - * @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->reason = 'PHPCI Build #%BUILD% - %COMMIT_MESSAGE%'; - - if (isset($options['webhook_url'])) { - $this->webhookUrl = $options['webhook_url']; - } - - if (isset($options['reason'])) { - $this->reason = $options['reason']; - } - - $this->updateOnly = isset($options['update_only']) ? (bool) $options['update_only'] : true; - } - - /** - * Copies files from the root of the build directory into the target folder - */ - public function execute() - { - if (empty($this->webhookUrl)) { - $this->phpci->logFailure('You must specify a webhook URL.'); - return false; - } - - $http = new HttpClient(); - - $response = $http->post($this->webhookUrl, array( - 'reason' => $this->phpci->interpolate($this->reason), - 'source' => 'PHPCI', - 'url' => $this->phpci->interpolate('%BUILD_URI%'), - 'branch' => $this->phpci->interpolate('%BRANCH%'), - 'update_only' => $this->updateOnly - )); - - return $response['success']; - } -} diff --git a/PHPCI/Plugin/Email.php b/PHPCI/Plugin/Email.php index 17e235e2..70fca197 100644 --- a/PHPCI/Plugin/Email.php +++ b/PHPCI/Plugin/Email.php @@ -9,13 +9,9 @@ namespace PHPCI\Plugin; -use Exception; use b8\View; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; -use PHPCI\Helper\Email as EmailHelper; -use Psr\Log\LogLevel; /** * Email Plugin - Provides simple email capability to PHPCI. @@ -30,36 +26,43 @@ class Email implements \PHPCI\Plugin */ protected $phpci; - /** - * @var \PHPCI\Model\Build - */ - protected $build; - /** * @var array */ protected $options; /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param \Swift_Mailer $mailer - * @param array $options + * @var \Swift_Mailer */ + protected $mailer; + + /** + * @var string + */ + protected $fromAddress; + public function __construct( Builder $phpci, Build $build, + \Swift_Mailer $mailer, array $options = array() ) { - $this->phpci = $phpci; - $this->build = $build; - $this->options = $options; + $this->phpci = $phpci; + $this->build = $build; + $this->options = $options; + + $phpCiSettings = $phpci->getSystemConfig('phpci'); + + $this->fromAddress = isset($phpCiSettings['email_settings']['from_address']) + ? $phpCiSettings['email_settings']['from_address'] + : "notifications-ci@phptesting.org"; + + $this->mailer = $mailer; } /** - * Send a notification mail. - */ + * Connects to MySQL and runs a specified set of queries. + */ public function execute() { $addresses = $this->getEmailAddresses(); @@ -70,95 +73,76 @@ class Email implements \PHPCI\Plugin return false; } - $buildStatus = $this->build->isSuccessful() ? "Passing Build" : "Failing Build"; - $projectName = $this->build->getProject()->getTitle(); + $subjectTemplate = "PHPCI - %s - %s"; + $projectName = $this->phpci->getBuildProjectTitle(); + $logText = $this->build->getLog(); - try { - $view = $this->getMailTemplate(); - } catch (Exception $e) { - $this->phpci->log( - sprintf('Unknown mail template "%s", falling back to default.', $this->options['template']), - LogLevel::WARNING + if ($this->build->isSuccessful()) { + $sendFailures = $this->sendSeparateEmails( + $addresses, + sprintf($subjectTemplate, $projectName, "Passing Build"), + sprintf("Log Output:
%s
", $logText) + ); + } else { + $view = new View('Email/failed'); + $view->build = $this->build; + $view->project = $this->build->getProject(); + + $emailHtml = $view->render(); + + $sendFailures = $this->sendSeparateEmails( + $addresses, + sprintf($subjectTemplate, $projectName, "Failing Build"), + $emailHtml ); - $view = $this->getDefaultMailTemplate(); } - $view->build = $this->build; - $view->project = $this->build->getProject(); - - $layout = new View('Email/layout'); - $layout->build = $this->build; - $layout->project = $this->build->getProject(); - $layout->content = $view->render(); - $body = $layout->render(); - - $sendFailures = $this->sendSeparateEmails( - $addresses, - sprintf("PHPCI - %s - %s", $projectName, $buildStatus), - $body - ); - // This is a success if we've not failed to send anything. - $this->phpci->log(sprintf("%d emails sent", (count($addresses) - $sendFailures))); - $this->phpci->log(sprintf("%d emails failed to send", $sendFailures)); + $this->phpci->log(sprintf("%d emails sent", (count($addresses) - count($sendFailures)))); + $this->phpci->log(sprintf("%d emails failed to send", count($sendFailures))); - return ($sendFailures === 0); + return (count($sendFailures) == 0); } /** - * @param string $toAddress Single address to send to + * @param string[]|string $toAddresses Array or single address to send to * @param string[] $ccList * @param string $subject Email subject * @param string $body Email body * @return array Array of failed addresses */ - protected function sendEmail($toAddress, $ccList, $subject, $body) + public function sendEmail($toAddresses, $ccList, $subject, $body) { - $email = new EmailHelper(); - - $email->setEmailTo($toAddress, $toAddress); - $email->setSubject($subject); - $email->setBody($body); - $email->setHtml(true); + $message = \Swift_Message::newInstance($subject) + ->setFrom($this->fromAddress) + ->setTo($toAddresses) + ->setBody($body) + ->setContentType("text/html"); if (is_array($ccList) && count($ccList)) { - foreach ($ccList as $address) { - $email->addCc($address, $address); - } + $message->setCc($ccList); } - return $email->send(); + $failedAddresses = array(); + $this->mailer->send($message, $failedAddresses); + + return $failedAddresses; } - /** - * Send an email to a list of specified subjects. - * - * @param array $toAddresses - * List of destination addresses for message. - * @param string $subject - * Mail subject - * @param string $body - * Mail body - * - * @return int number of failed messages - */ public function sendSeparateEmails(array $toAddresses, $subject, $body) { - $failures = 0; + $failures = array(); $ccList = $this->getCcAddresses(); foreach ($toAddresses as $address) { - if (!$this->sendEmail($address, $ccList, $subject, $body)) { - $failures++; + $newFailures = $this->sendEmail($address, $ccList, $subject, $body); + foreach ($newFailures as $failure) { + $failures[] = $failure; } } return $failures; } - /** - * Get the list of email addresses to send to. - * @return array - */ protected function getEmailAddresses() { $addresses = array(); @@ -174,18 +158,13 @@ class Email implements \PHPCI\Plugin } } - if (empty($addresses) && isset($this->options['default_mailto_address'])) { + if (isset($this->options['default_mailto_address'])) { $addresses[] = $this->options['default_mailto_address']; + return $addresses; } - - return array_unique($addresses); + return $addresses; } - /** - * Get the list of email addresses to CC. - * - * @return array - */ protected function getCcAddresses() { $ccAddresses = array(); @@ -198,30 +177,4 @@ class Email implements \PHPCI\Plugin return $ccAddresses; } - - /** - * Get the mail template used to sent the mail. - * - * @return View - */ - protected function getMailTemplate() - { - if (isset($this->options['template'])) { - return new View('Email/' . $this->options['template']); - } - - return $this->getDefaultMailTemplate(); - } - - /** - * Get the default mail template. - * - * @return View - */ - protected function getDefaultMailTemplate() - { - $template = $this->build->isSuccessful() ? 'short' : 'long'; - - return new View('Email/' . $template); - } } diff --git a/PHPCI/Plugin/Env.php b/PHPCI/Plugin/Env.php index b89bf67d..bb65f51f 100644 --- a/PHPCI/Plugin/Env.php +++ b/PHPCI/Plugin/Env.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -25,12 +24,6 @@ class Env implements \PHPCI\Plugin protected $build; protected $env_vars; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -52,10 +45,10 @@ class Env implements \PHPCI\Plugin // This allows the standard syntax: "FOO: bar" $env_var = "$key=$value"; } - + if (!putenv($this->phpci->interpolate($env_var))) { $success = false; - $this->phpci->logFailure(Lang::get('unable_to_set_env')); + $this->phpci->logFailure("Unable to set environment variable"); } } return $success; diff --git a/PHPCI/Plugin/FlowdockNotify.php b/PHPCI/Plugin/FlowdockNotify.php deleted file mode 100644 index 8ac9f2ab..00000000 --- a/PHPCI/Plugin/FlowdockNotify.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @package PHPCI - * @subpackage Plugins - */ -class FlowdockNotify implements \PHPCI\Plugin -{ - private $api_key; - private $email; - const MESSAGE_DEFAULT = 'Build %BUILD% has finished for commit %SHORT_COMMIT% - (%COMMIT_EMAIL%)> on branch %BRANCH%'; - - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - * @throws \Exception - */ - public function __construct(Builder $phpci, Build $build, array $options = array()) - { - $this->phpci = $phpci; - $this->build = $build; - if (!is_array($options) || !isset($options['api_key'])) { - throw new \Exception('Please define the api_key for Flowdock Notify plugin!'); - } - $this->api_key = trim($options['api_key']); - $this->message = isset($options['message']) ? $options['message'] : self::MESSAGE_DEFAULT; - $this->email = isset($options['email']) ? $options['email'] : 'PHPCI'; - } - - /** - * Run the Flowdock plugin. - * @return bool - * @throws \Exception - */ - public function execute() - { - - $message = $this->phpci->interpolate($this->message); - $successfulBuild = $this->build->isSuccessful() ? 'Success' : 'Failed'; - $push = new Push($this->api_key); - $flowMessage = TeamInboxMessage::create() - ->setSource("PHPCI") - ->setFromAddress($this->email) - ->setFromName($this->build->getProject()->getTitle()) - ->setSubject($successfulBuild) - ->setTags(['#ci']) - ->setLink($this->build->getBranchLink()) - ->setContent($message); - - if (!$push->sendTeamInboxMessage($flowMessage, array('connect_timeout' => 5000, 'timeout' => 5000))) { - throw new \Exception(sprintf('Flowdock Failed: %s', $flowMessage->getResponseErrors())); - } - return true; - } -} diff --git a/PHPCI/Plugin/Git.php b/PHPCI/Plugin/Git.php index 60d6b551..4fe6f530 100644 --- a/PHPCI/Plugin/Git.php +++ b/PHPCI/Plugin/Git.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -25,12 +24,6 @@ class Git implements \PHPCI\Plugin protected $build; protected $actions = array(); - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -38,10 +31,6 @@ class Git implements \PHPCI\Plugin $this->actions = $options; } - /** - * Run the Git plugin. - * @return bool - */ public function execute() { $buildPath = $this->phpci->buildPath; @@ -68,12 +57,6 @@ class Git implements \PHPCI\Plugin return $success; } - /** - * Determine which action to run, and run it. - * @param $action - * @param array $options - * @return bool - */ protected function runAction($action, array $options = array()) { switch ($action) { @@ -94,11 +77,6 @@ class Git implements \PHPCI\Plugin return false; } - /** - * Handle a merge action. - * @param $options - * @return bool - */ protected function runMergeAction($options) { if (array_key_exists('branch', $options)) { @@ -108,15 +86,10 @@ class Git implements \PHPCI\Plugin } } - /** - * Handle a tag action. - * @param $options - * @return bool - */ protected function runTagAction($options) { $tagName = date('Ymd-His'); - $message = Lang::get('tag_created', date('Y-m-d H:i:s')); + $message = 'Tag created by PHPCI: ' . date('Y-m-d H:i:s'); if (array_key_exists('name', $options)) { $tagName = $this->phpci->interpolate($options['name']); @@ -130,11 +103,6 @@ class Git implements \PHPCI\Plugin return $this->phpci->executeCommand($cmd, $tagName, $message); } - /** - * Handle a pull action. - * @param $options - * @return bool - */ protected function runPullAction($options) { $branch = $this->build->getBranch(); @@ -151,11 +119,6 @@ class Git implements \PHPCI\Plugin return $this->phpci->executeCommand('git pull %s %s', $remote, $branch); } - /** - * Handle a push action. - * @param $options - * @return bool - */ protected function runPushAction($options) { $branch = $this->build->getBranch(); diff --git a/PHPCI/Plugin/Grunt.php b/PHPCI/Plugin/Grunt.php index 4d62ffd8..106a11b4 100644 --- a/PHPCI/Plugin/Grunt.php +++ b/PHPCI/Plugin/Grunt.php @@ -28,18 +28,6 @@ class Grunt implements \PHPCI\Plugin protected $grunt; protected $gruntfile; - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $path = $phpci->buildPath; @@ -52,7 +40,7 @@ class Grunt implements \PHPCI\Plugin // Handle options: if (isset($options['directory'])) { - $this->directory = $path . DIRECTORY_SEPARATOR . $options['directory']; + $this->directory = $path . '/' . $options['directory']; } if (isset($options['task'])) { diff --git a/PHPCI/Plugin/Gulp.php b/PHPCI/Plugin/Gulp.php index b6c6cab4..b79fdbfc 100644 --- a/PHPCI/Plugin/Gulp.php +++ b/PHPCI/Plugin/Gulp.php @@ -28,18 +28,6 @@ class Gulp implements \PHPCI\Plugin protected $gulp; protected $gulpfile; - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $path = $phpci->buildPath; @@ -52,7 +40,7 @@ class Gulp implements \PHPCI\Plugin // Handle options: if (isset($options['directory'])) { - $this->directory = $path . DIRECTORY_SEPARATOR . $options['directory']; + $this->directory = $path . '/' . $options['directory']; } if (isset($options['task'])) { diff --git a/PHPCI/Plugin/HipchatNotify.php b/PHPCI/Plugin/HipchatNotify.php index a39b94fe..10d804ef 100644 --- a/PHPCI/Plugin/HipchatNotify.php +++ b/PHPCI/Plugin/HipchatNotify.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -21,17 +20,12 @@ use PHPCI\Model\Build; */ class HipchatNotify implements \PHPCI\Plugin { - protected $authToken; - protected $color; - protected $notify; + private $authToken; + private $userAgent; + private $cookie; + private $color; + private $notify; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - * @throws \Exception - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -47,7 +41,7 @@ class HipchatNotify implements \PHPCI\Plugin if (isset($options['message'])) { $this->message = $options['message']; } else { - $this->message = Lang::get('x_built_at_x'); + $this->message = '%PROJECT_TITLE% built at %BUILD_URI%'; } if (isset($options['color'])) { @@ -62,15 +56,11 @@ class HipchatNotify implements \PHPCI\Plugin $this->notify = false; } } else { - throw new \Exception(Lang::get('hipchat_settings')); + throw new \Exception('Please define room and authToken for hipchat_notify plugin!'); } } - /** - * Run the HipChat plugin. - * @return bool - */ public function execute() { $hipChat = new \HipChat\HipChat($this->authToken); diff --git a/PHPCI/Plugin/Irc.php b/PHPCI/Plugin/Irc.php index a7610a8c..cdc72491 100644 --- a/PHPCI/Plugin/Irc.php +++ b/PHPCI/Plugin/Irc.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -29,18 +28,6 @@ class Irc implements \PHPCI\Plugin protected $room; protected $nick; - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -60,16 +47,12 @@ class Irc implements \PHPCI\Plugin } } - /** - * Run IRC plugin. - * @return bool - */ public function execute() { $msg = $this->phpci->interpolate($this->message); if (empty($this->server) || empty($this->room) || empty($this->nick)) { - $this->phpci->logFailure(Lang::get('irc_settings')); + $this->phpci->logFailure('You must configure a server, room and nick.'); } if (empty($this->port)) { @@ -77,56 +60,19 @@ class Irc implements \PHPCI\Plugin } $sock = fsockopen($this->server, $this->port); - stream_set_timeout($sock, 1); + fputs($sock, 'USER ' . $this->nick . ' phptesting.org ' . $this->nick . ' :' . $this->nick . "\r\n"); + fputs($sock, 'NICK ' . $this->nick . "\r\n"); + fputs($sock, 'JOIN ' . $this->room . "\r\n"); + fputs($sock, 'PRIVMSG ' . $this->room . ' :' . $msg . "\r\n"); - $connectCommands = array( - 'USER ' . $this->nick . ' 0 * :' . $this->nick, - 'NICK ' . $this->nick, - ); - $this->executeIrcCommands($sock, $connectCommands); - $this->executeIrcCommand($sock, 'JOIN ' . $this->room); - $this->executeIrcCommand($sock, 'PRIVMSG ' . $this->room . ' :' . $msg); + while (fgets($sock)) { + // We don't need to do anything, + // but the IRC server doesn't appear to post the message + // unless we wait for responses. + } fclose($sock); return true; } - - /** - * @param resource $socket - * @param array $commands - * @return bool - */ - private function executeIrcCommands($socket, array $commands) - { - foreach ($commands as $command) { - fputs($socket, $command . "\n"); - } - - $pingBack = false; - - // almost all servers expect pingback! - while ($response = fgets($socket)) { - $matches = array(); - if (preg_match('/^PING \\:([A-Z0-9]+)/', $response, $matches)) { - $pingBack = $matches[1]; - } - } - - if ($pingBack) { - $command = 'PONG :' . $pingBack . "\n"; - fputs($socket, $command); - } - } - - /** - * - * @param resource $socket - * @param string $command - * @return bool - */ - private function executeIrcCommand($socket, $command) - { - return $this->executeIrcCommands($socket, array($command)); - } } diff --git a/PHPCI/Plugin/Lint.php b/PHPCI/Plugin/Lint.php index a7ddc55c..a43682ba 100644 --- a/PHPCI/Plugin/Lint.php +++ b/PHPCI/Plugin/Lint.php @@ -27,23 +27,11 @@ class Lint implements PHPCI\Plugin protected $phpci; protected $build; - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { - $this->phpci = $phpci; + $this->phpci = $phpci; $this->build = $build; - $this->directories = array(''); + $this->directories = array(''); $this->ignore = $phpci->ignore; if (!empty($options['directory'])) { @@ -80,32 +68,19 @@ class Lint implements PHPCI\Plugin return $success; } - /** - * Lint an item (file or directory) by calling the appropriate method. - * @param $php - * @param $item - * @param $itemPath - * @return bool - */ protected function lintItem($php, $item, $itemPath) { $success = true; if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) { $success = false; - } elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . DIRECTORY_SEPARATOR)) { + } elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . '/')) { $success = false; } return $success; } - /** - * Run php -l against a directory of files. - * @param $php - * @param $path - * @return bool - */ protected function lintDirectory($php, $path) { $success = true; @@ -130,12 +105,6 @@ class Lint implements PHPCI\Plugin return $success; } - /** - * Run php -l against a specific file. - * @param $php - * @param $path - * @return bool - */ protected function lintFile($php, $path) { $success = true; diff --git a/PHPCI/Plugin/Mysql.php b/PHPCI/Plugin/Mysql.php old mode 100644 new mode 100755 index fdb521ef..94257896 --- a/PHPCI/Plugin/Mysql.php +++ b/PHPCI/Plugin/Mysql.php @@ -11,7 +11,6 @@ namespace PHPCI\Plugin; use PDO; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -108,7 +107,7 @@ class Mysql implements \PHPCI\Plugin // SQL file execution $this->executeFile($query['import']); } else { - throw new \Exception(Lang::get('invalid_command')); + throw new \Exception("Invalid command"); } } } catch (\Exception $ex) { @@ -126,19 +125,19 @@ class Mysql implements \PHPCI\Plugin protected function executeFile($query) { if (!isset($query['file'])) { - throw new \Exception(Lang::get('import_file_key')); + throw new \Exception("Import statement must contain a 'file' key"); } $import_file = $this->phpci->buildPath . $this->phpci->interpolate($query['file']); if (!is_readable($import_file)) { - throw new \Exception(Lang::get('cannot_open_import', $import_file)); + throw new \Exception("Cannot open SQL import file: $import_file"); } $database = isset($query['database']) ? $this->phpci->interpolate($query['database']) : null; $import_command = $this->getImportCommand($import_file, $database); if (!$this->phpci->executeCommand($import_command)) { - throw new \Exception(Lang::get('unable_to_execute')); + throw new \Exception("Unable to execute SQL file"); } return true; @@ -166,11 +165,10 @@ class Mysql implements \PHPCI\Plugin $args = array( ':import_file' => escapeshellarg($import_file), ':decomp_cmd' => $decomp_cmd, - ':host' => escapeshellarg($this->host), ':user' => escapeshellarg($this->user), ':pass' => escapeshellarg($this->pass), ':database' => ($database === null)? '': escapeshellarg($database), ); - return strtr('cat :import_file :decomp_cmd | mysql -h:host -u:user -p:pass :database', $args); + return strtr('cat :import_file :decomp_cmd | mysql -u:user -p:pass :database', $args); } } diff --git a/PHPCI/Plugin/PackageBuild.php b/PHPCI/Plugin/PackageBuild.php index fb116640..e5dcda41 100644 --- a/PHPCI/Plugin/PackageBuild.php +++ b/PHPCI/Plugin/PackageBuild.php @@ -25,20 +25,14 @@ class PackageBuild implements \PHPCI\Plugin protected $format; protected $phpci; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { - $path = $phpci->buildPath; - $this->build = $build; - $this->phpci = $phpci; - $this->directory = isset($options['directory']) ? $options['directory'] : $path; - $this->filename = isset($options['filename']) ? $options['filename'] : 'build'; - $this->format = isset($options['format']) ? $options['format'] : 'zip'; + $path = $phpci->buildPath; + $this->build = $build; + $this->phpci = $phpci; + $this->directory = isset($options['directory']) ? $options['directory'] : $path; + $this->filename = isset($options['filename']) ? $options['filename'] : 'build'; + $this->format = isset($options['format']) ? $options['format'] : 'zip'; } /** @@ -46,7 +40,7 @@ class PackageBuild implements \PHPCI\Plugin */ public function execute() { - $path = $this->phpci->buildPath; + $path = $this->phpci->buildPath; $build = $this->build; if ($this->directory == $path) { @@ -69,7 +63,8 @@ class PackageBuild implements \PHPCI\Plugin } foreach ($this->format as $format) { - switch ($format) { + switch($format) + { case 'tar': $cmd = 'tar cfz "%s/%s.tar.gz" ./*'; break; diff --git a/PHPCI/Plugin/Pdepend.php b/PHPCI/Plugin/Pdepend.php index faef406d..54bffd5e 100644 --- a/PHPCI/Plugin/Pdepend.php +++ b/PHPCI/Plugin/Pdepend.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -48,12 +47,6 @@ class Pdepend implements \PHPCI\Plugin */ protected $location; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -73,19 +66,21 @@ class Pdepend implements \PHPCI\Plugin */ public function execute() { - if (!file_exists($this->location)) { - mkdir($this->location); - } if (!is_writable($this->location)) { - throw new \Exception(sprintf('The location %s is not writable or does not exist.', $this->location)); + throw new \Exception(sprintf('The location %s is not writable.', $this->location)); } $pdepend = $this->phpci->findBinary('pdepend'); + if (!$pdepend) { + $this->phpci->logFailure('Could not find pdepend.'); + return false; + } + $cmd = $pdepend . ' --summary-xml="%s" --jdepend-chart="%s" --overview-pyramid="%s" %s "%s"'; $this->removeBuildArtifacts(); - + // If we need to ignore directories if (count($this->phpci->ignore)) { $ignore = ' --ignore=' . implode(',', $this->phpci->ignore); @@ -115,8 +110,11 @@ class Pdepend implements \PHPCI\Plugin $config['url'] . '/build/pdepend/' . $this->pyramid ) ); + } else { + $this->phpci->logFailure(sprintf("The function '%s' failed")); } + return $success; } diff --git a/PHPCI/Plugin/Pgsql.php b/PHPCI/Plugin/Pgsql.php index 60057464..9a5f630c 100644 --- a/PHPCI/Plugin/Pgsql.php +++ b/PHPCI/Plugin/Pgsql.php @@ -73,9 +73,9 @@ class Pgsql implements \PHPCI\Plugin } /** - * Connects to PgSQL and runs a specified set of queries. - * @return boolean - */ + * Connects to PgSQL and runs a specified set of queries. + * @return boolean + */ public function execute() { try { @@ -83,7 +83,7 @@ class Pgsql implements \PHPCI\Plugin $pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts); foreach ($this->queries as $query) { - $pdo->query($this->phpci->interpolate($query)); + $pdo->query($query); } } catch (\Exception $ex) { $this->phpci->logFailure($ex->getMessage()); diff --git a/PHPCI/Plugin/Phar.php b/PHPCI/Plugin/Phar.php index c734bb6c..03415007 100644 --- a/PHPCI/Plugin/Phar.php +++ b/PHPCI/Plugin/Phar.php @@ -3,7 +3,6 @@ namespace PHPCI\Plugin; use Exception; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; use Phar as PHPPhar; @@ -204,31 +203,24 @@ class Phar implements \PHPCI\Plugin return $this->stub; } - /** - * Get stub content for the Phar file. - * @return string - */ public function getStubContent() { $content = ''; $filename = $this->getStub(); if ($filename) { - $content = file_get_contents($this->getPHPCI()->buildPath . DIRECTORY_SEPARATOR . $this->getStub()); + $content = file_get_contents($this->getPHPCI()->buildPath . '/' . $this->getStub()); } return $content; } - /** - * Run the phar plugin. - * @return bool - */ + // Execution public function execute() { $success = false; try { - $file = $this->getDirectory() . DIRECTORY_SEPARATOR . $this->getFilename(); - $phar = new PHPPhar($file, 0, $this->getFilename()); + + $phar = new PHPPhar($this->getDirectory() . '/' . $this->getFilename(), 0, $this->getFilename()); $phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp()); $stub = $this->getStubContent(); @@ -237,8 +229,9 @@ class Phar implements \PHPCI\Plugin } $success = true; + } catch (Exception $e) { - $this->getPHPCI()->log(Lang::get('phar_internal_error')); + $this->getPHPCI()->log('Phar Plugin Internal Error'); $this->getPHPCI()->log($e->getMessage()); } diff --git a/PHPCI/Plugin/Phing.php b/PHPCI/Plugin/Phing.php index e322b72e..21f7a972 100644 --- a/PHPCI/Plugin/Phing.php +++ b/PHPCI/Plugin/Phing.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -32,12 +31,6 @@ class Phing implements \PHPCI\Plugin protected $phpci; protected $build; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->setPhpci($phpci); @@ -47,7 +40,7 @@ class Phing implements \PHPCI\Plugin * Set working directory */ if (isset($options['directory'])) { - $directory = $phpci->buildPath . DIRECTORY_SEPARATOR . $options['directory']; + $directory = $phpci->buildPath . '/' . $options['directory']; } else { $directory = $phpci->buildPath; } @@ -81,6 +74,11 @@ class Phing implements \PHPCI\Plugin { $phingExecutable = $this->phpci->findBinary('phing'); + if (!$phingExecutable) { + $this->phpci->logFailure('Could not find Phing executable.'); + return false; + } + $cmd[] = $phingExecutable . ' -f ' . $this->getBuildFilePath(); if ($this->getPropertyFile()) { @@ -140,10 +138,6 @@ class Phing implements \PHPCI\Plugin return $this->targets; } - /** - * Converts an array of targets into a string. - * @return string - */ private function targetsToString() { return implode(' ', $this->targets); @@ -180,16 +174,12 @@ class Phing implements \PHPCI\Plugin public function setBuildFile($buildFile) { if (!file_exists($this->getDirectory() . $buildFile)) { - throw new \Exception(Lang::get('build_file_missing')); + throw new \Exception('Specified build file does not exists.'); } $this->buildFile = $buildFile; } - /** - * Get phing build file path. - * @return string - */ public function getBuildFilePath() { return $this->getDirectory() . $this->buildFile; @@ -208,12 +198,8 @@ class Phing implements \PHPCI\Plugin */ public function propertiesToString() { - /** - * fix the problem when execute phing out of the build dir - * @ticket 748 - */ - if (!isset($this->properties['project.basedir'])) { - $this->properties['project.basedir'] = $this->getDirectory(); + if (empty($this->properties)) { + return ''; } $propertiesString = array(); @@ -255,8 +241,8 @@ class Phing implements \PHPCI\Plugin */ public function setPropertyFile($propertyFile) { - if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) { - throw new \Exception(Lang::get('property_file_missing')); + if (!file_exists($this->getDirectory() . '/' . $propertyFile)) { + throw new \Exception('Specified property file does not exists.'); } $this->propertyFile = $propertyFile; diff --git a/PHPCI/Plugin/PhpCodeSniffer.php b/PHPCI/Plugin/PhpCodeSniffer.php old mode 100644 new mode 100755 index 6f4ed4e0..37778e8a --- a/PHPCI/Plugin/PhpCodeSniffer.php +++ b/PHPCI/Plugin/PhpCodeSniffer.php @@ -12,7 +12,6 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; -use PHPCI\Model\BuildError; /** * PHP Code Sniffer Plugin - Allows PHP Code Sniffer testing. @@ -73,13 +72,6 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin */ protected $ignore; - /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool - */ public static function canExecute($stage, Builder $builder, Build $build) { if ($stage == 'test') { @@ -128,10 +120,6 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $this->setOptions($options); } - /** - * Handle this plugin's options. - * @param $options - */ protected function setOptions($options) { foreach (array('directory', 'standard', 'path', 'ignore', 'allowed_warnings', 'allowed_errors') as $key) { @@ -150,6 +138,11 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $phpcs = $this->phpci->findBinary('phpcs'); + if (!$phpcs) { + $this->phpci->logFailure('Could not find phpcs.'); + return false; + } + $this->phpci->logExecOutput(false); $cmd = $phpcs . ' --report=json %s %s %s %s %s "%s"'; @@ -164,13 +157,14 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin ); $output = $this->phpci->getLastOutput(); - list($errors, $warnings) = $this->processReport($output); + list($errors, $warnings, $data) = $this->processReport($output); $this->phpci->logExecOutput(true); $success = true; $this->build->storeMeta('phpcs-warnings', $warnings); $this->build->storeMeta('phpcs-errors', $errors); + $this->build->storeMeta('phpcs-data', $data); if ($this->allowed_warnings != -1 && $warnings > $this->allowed_warnings) { $success = false; @@ -183,10 +177,6 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return $success; } - /** - * Process options and produce an arguments string for PHPCS. - * @return array - */ protected function getFlags() { $ignore = ''; @@ -208,39 +198,33 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return array($ignore, $standard, $suffixes); } - /** - * Process the PHPCS output report. - * @param $output - * @return array - * @throws \Exception - */ protected function processReport($output) { $data = json_decode(trim($output), true); if (!is_array($data)) { $this->phpci->log($output); - throw new \Exception(PHPCI\Helper\Lang::get('could_not_process_report')); + throw new \Exception('Could not process PHPCS report JSON.'); } $errors = $data['totals']['errors']; $warnings = $data['totals']['warnings']; + $rtn = array(); + foreach ($data['files'] as $fileName => $file) { $fileName = str_replace($this->phpci->buildPath, '', $fileName); foreach ($file['messages'] as $message) { - $this->build->reportError( - $this->phpci, - 'php_code_sniffer', - 'PHPCS: ' . $message['message'], - $message['type'] == 'ERROR' ? BuildError::SEVERITY_HIGH : BuildError::SEVERITY_LOW, - $fileName, - $message['line'] + $rtn[] = array( + 'file' => $fileName, + 'line' => $message['line'], + 'type' => $message['type'], + 'message' => $message['message'], ); } } - return array($errors, $warnings); + return array($errors, $warnings, $rtn); } } diff --git a/PHPCI/Plugin/PhpCpd.php b/PHPCI/Plugin/PhpCpd.php old mode 100755 new mode 100644 index aa076d2d..18fb5f86 --- a/PHPCI/Plugin/PhpCpd.php +++ b/PHPCI/Plugin/PhpCpd.php @@ -10,9 +10,7 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; -use PHPCI\Model\BuildError; /** * PHP Copy / Paste Detector - Allows PHP Copy / Paste Detector testing. @@ -29,7 +27,7 @@ class PhpCpd implements \PHPCI\Plugin /** * @var string, based on the assumption the root may not hold the code to be - * tested, extends the base path + * tested, exteds the base path */ protected $path; @@ -38,24 +36,23 @@ class PhpCpd implements \PHPCI\Plugin */ protected $ignore; - /** - * Set up the plugin, configure options, etc. - * @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->path = $phpci->buildPath; + $this->standard = 'PSR1'; $this->ignore = $phpci->ignore; if (!empty($options['path'])) { $this->path = $phpci->buildPath . $options['path']; } + if (!empty($options['standard'])) { + $this->standard = $options['standard']; + } + if (!empty($options['ignore'])) { $this->ignore = $options['ignore']; } @@ -70,9 +67,9 @@ class PhpCpd implements \PHPCI\Plugin if (count($this->ignore)) { $map = function ($item) { // remove the trailing slash - $item = rtrim($item, DIRECTORY_SEPARATOR); + $item = (substr($item, -1) == '/' ? substr($item, 0, -1) : $item); - if (is_file(rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $item)) { + if (is_file($this->path . '/' . $item)) { return ' --names-exclude ' . $item; } else { return ' --exclude ' . $item; @@ -86,64 +83,55 @@ class PhpCpd implements \PHPCI\Plugin $phpcpd = $this->phpci->findBinary('phpcpd'); + if (!$phpcpd) { + $this->phpci->logFailure('Could not find phpcpd.'); + return false; + } + $tmpfilename = tempnam('/tmp', 'phpcpd'); $cmd = $phpcpd . ' --log-pmd "%s" %s "%s"'; $success = $this->phpci->executeCommand($cmd, $tmpfilename, $ignore, $this->path); print $this->phpci->getLastOutput(); - - $errorCount = $this->processReport(file_get_contents($tmpfilename)); + + list($errorCount, $data) = $this->processReport(file_get_contents($tmpfilename)); $this->build->storeMeta('phpcpd-warnings', $errorCount); + $this->build->storeMeta('phpcpd-data', $data); unlink($tmpfilename); return $success; } - /** - * Process the PHPCPD XML report. - * @param $xmlString - * @return array - * @throws \Exception - */ protected function processReport($xmlString) { $xml = simplexml_load_string($xmlString); if ($xml === false) { $this->phpci->log($xmlString); - throw new \Exception(Lang::get('could_not_process_report')); + throw new \Exception('Could not process PHPCPD report XML.'); } $warnings = 0; + $data = array(); + foreach ($xml->duplication as $duplication) { foreach ($duplication->file as $file) { $fileName = (string)$file['path']; $fileName = str_replace($this->phpci->buildPath, '', $fileName); - $message = <<codefragment} -``` -CPD; - - $this->build->reportError( - $this->phpci, - 'php_cpd', - $message, - BuildError::SEVERITY_NORMAL, - $fileName, - $file['line'], - (int) $file['line'] + (int) $duplication['lines'] + $data[] = array( + 'file' => $fileName, + 'line_start' => (int) $file['line'], + 'line_end' => (int) $file['line'] + (int) $duplication['lines'], + 'code' => (string) $duplication->codefragment ); } $warnings++; } - return $warnings; + return array($warnings, $data); } } diff --git a/PHPCI/Plugin/PhpCsFixer.php b/PHPCI/Plugin/PhpCsFixer.php index 9aa0d33f..1d2f6afe 100644 --- a/PHPCI/Plugin/PhpCsFixer.php +++ b/PHPCI/Plugin/PhpCsFixer.php @@ -10,11 +10,10 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** -* PHP CS Fixer - Works with the PHP Coding Standards Fixer for testing coding standards. +* PHP CS Fixer - Works with the PHP CS Fixer for testing coding standards. * @author Gabriel Baker * @package PHPCI * @subpackage Plugins @@ -32,23 +31,11 @@ class PhpCsFixer implements \PHPCI\Plugin protected $build; protected $workingDir = ''; - protected $level = ' --level=psr2'; - protected $verbose = ''; - protected $diff = ''; - protected $levels = array('psr0', 'psr1', 'psr2', 'symfony'); + protected $level = ' --level=all'; + protected $verbose = ''; + protected $diff = ''; + protected $levels = array('psr0', 'psr1', 'psr2', 'all'); - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -58,10 +45,6 @@ class PhpCsFixer implements \PHPCI\Plugin $this->buildArgs($options); } - /** - * Run PHP CS Fixer. - * @return bool - */ public function execute() { $curdir = getcwd(); @@ -69,6 +52,11 @@ class PhpCsFixer implements \PHPCI\Plugin $phpcsfixer = $this->phpci->findBinary('php-cs-fixer'); + if (!$phpcsfixer) { + $this->phpci->logFailure('Could not find php-cs-fixer.'); + return false; + } + $cmd = $phpcsfixer . ' fix . %s %s %s'; $success = $this->phpci->executeCommand($cmd, $this->verbose, $this->diff, $this->level); @@ -77,10 +65,6 @@ class PhpCsFixer implements \PHPCI\Plugin return $success; } - /** - * Build an args string for PHPCS Fixer. - * @param $options - */ public function buildArgs($options) { if (isset($options['verbose']) && $options['verbose']) { diff --git a/PHPCI/Plugin/PhpDocblockChecker.php b/PHPCI/Plugin/PhpDocblockChecker.php old mode 100644 new mode 100755 index 2396497c..eafbda96 --- a/PHPCI/Plugin/PhpDocblockChecker.php +++ b/PHPCI/Plugin/PhpDocblockChecker.php @@ -45,13 +45,6 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected $skipClasses = false; protected $skipMethods = false; - /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool - */ public static function canExecute($stage, Builder $builder, Build $build) { if ($stage == 'test') { @@ -61,12 +54,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return false; } - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ + public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -104,6 +92,11 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin // Check that the binary exists: $checker = $this->phpci->findBinary('phpdoccheck'); + if (!$checker) { + $this->phpci->logFailure('Could not find phpdoccheck.'); + return false; + } + // Build ignore string: $ignore = ''; if (count($this->ignore)) { @@ -138,12 +131,12 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin // Re-enable exec output logging: $this->phpci->logExecOutput(true); - $output = json_decode($this->phpci->getLastOutput(), true); + $output = json_decode($this->phpci->getLastOutput()); $errors = count($output); $success = true; $this->build->storeMeta('phpdoccheck-warnings', $errors); - $this->reportErrors($output); + $this->build->storeMeta('phpdoccheck-data', $output); if ($this->allowed_warnings != -1 && $errors > $this->allowed_warnings) { $success = false; @@ -151,30 +144,4 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return $success; } - - /** - * Report all of the errors we've encountered line-by-line. - * @param $output - */ - protected function reportErrors($output) - { - foreach ($output as $error) { - $message = 'Class ' . $error['class'] . ' is missing a docblock.'; - $severity = PHPCI\Model\BuildError::SEVERITY_LOW; - - if ($error['type'] == 'method') { - $message = $error['class'] . '::' . $error['method'] . ' is missing a docblock.'; - $severity = PHPCI\Model\BuildError::SEVERITY_NORMAL; - } - - $this->build->reportError( - $this->phpci, - 'php_docblock_checker', - $message, - $severity, - $error['file'], - $error['line'] - ); - } - } } diff --git a/PHPCI/Plugin/PhpLoc.php b/PHPCI/Plugin/PhpLoc.php index c8dedb91..6e402cc7 100644 --- a/PHPCI/Plugin/PhpLoc.php +++ b/PHPCI/Plugin/PhpLoc.php @@ -30,13 +30,6 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin */ protected $phpci; - /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool - */ public static function canExecute($stage, Builder $builder, Build $build) { if ($stage == 'test') { @@ -46,12 +39,6 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return false; } - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -69,20 +56,24 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin public function execute() { $ignore = ''; - if (count($this->phpci->ignore)) { - $map = function ($item) { - return ' --exclude ' . rtrim($item, DIRECTORY_SEPARATOR); + $map = function ($item) { + return ' --exclude ' . (substr($item, -1) == '/' ? substr($item, 0, -1) : $item); }; - $ignore = array_map($map, $this->phpci->ignore); + $ignore = implode('', $ignore); } $phploc = $this->phpci->findBinary('phploc'); + if (!$phploc) { + $this->phpci->logFailure('Could not find phploc.'); + return false; + } + $success = $this->phpci->executeCommand($phploc . ' %s "%s"', $ignore, $this->directory); - $output = $this->phpci->getLastOutput(); + $output = $this->phpci->getLastOutput(); if (preg_match_all('/\((LOC|CLOC|NCLOC|LLOC)\)\s+([0-9]+)/', $output, $matches)) { $data = array(); diff --git a/PHPCI/Plugin/PhpMessDetector.php b/PHPCI/Plugin/PhpMessDetector.php old mode 100644 new mode 100755 index ec92bc61..6b0f3a65 --- a/PHPCI/Plugin/PhpMessDetector.php +++ b/PHPCI/Plugin/PhpMessDetector.php @@ -38,7 +38,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * @var string, based on the assumption the root may not hold the code to be - * tested, extends the base path only if the provided path is relative. Absolute + * tested, exteds the base path only if the provided path is relative. Absolute * paths are used verbatim */ protected $path; @@ -50,18 +50,11 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Array of PHPMD rules. Can be one of the builtins (codesize, unusedcode, naming, design, controversial) - * or a filename (detected by checking for a / in it), either absolute or relative to the project root. + * or a filenname (detected by checking for a / in it), either absolute or relative to the project root. * @var array */ protected $rules; - /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool - */ public static function canExecute($stage, Builder $builder, Build $build) { if ($stage == 'test') { @@ -71,18 +64,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return false; } - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ + public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -121,19 +103,20 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $phpmdBinaryPath = $this->phpci->findBinary('phpmd'); + if (!$phpmdBinaryPath) { + $this->phpci->logFailure('Could not find phpmd.'); + return false; + } + $this->executePhpMd($phpmdBinaryPath); - $errorCount = $this->processReport(trim($this->phpci->getLastOutput())); + list($errorCount, $data) = $this->processReport(trim($this->phpci->getLastOutput())); $this->build->storeMeta('phpmd-warnings', $errorCount); + $this->build->storeMeta('phpmd-data', $data); return $this->wasLastExecSuccessful($errorCount); } - /** - * Override a default setting. - * @param $options - * @param $key - */ protected function overrideSetting($options, $key) { if (isset($options[$key]) && is_array($options[$key])) { @@ -141,12 +124,6 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } } - /** - * Process PHPMD's XML output report. - * @param $xmlString - * @return array - * @throws \Exception - */ protected function processReport($xmlString) { $xml = simplexml_load_string($xmlString); @@ -157,6 +134,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } $warnings = 0; + $data = array(); foreach ($xml->file as $file) { $fileName = (string)$file['name']; @@ -164,26 +142,23 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin foreach ($file->violation as $violation) { $warnings++; - - $this->build->reportError( - $this->phpci, - 'php_mess_detector', - (string)$violation, - PHPCI\Model\BuildError::SEVERITY_HIGH, - $fileName, - (int)$violation['beginline'], - (int)$violation['endline'] + $warning = array( + 'file' => $fileName, + 'line_start' => (int)$violation['beginline'], + 'line_end' => (int)$violation['endline'], + 'rule' => (string)$violation['rule'], + 'ruleset' => (string)$violation['ruleset'], + 'priority' => (int)$violation['priority'], + 'message' => (string)$violation, ); + + $data[] = $warning; } } - return $warnings; + return array($warnings, $data); } - /** - * Try and process the rules parameter from phpci.yml. - * @return bool - */ protected function tryAndProcessRules() { if (!empty($this->rules) && !is_array($this->rules)) { @@ -200,10 +175,6 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return true; } - /** - * Execute PHP Mess Detector. - * @param $binaryPath - */ protected function executePhpMd($binaryPath) { $cmd = $binaryPath . ' "%s" xml %s %s %s'; @@ -236,10 +207,6 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $this->phpci->logExecOutput(true); } - /** - * Get the path PHPMD should be run against. - * @return string - */ protected function getTargetPath() { $path = $this->phpci->buildPath . $this->path; diff --git a/PHPCI/Plugin/PhpParallelLint.php b/PHPCI/Plugin/PhpParallelLint.php index febed528..3787fd0c 100644 --- a/PHPCI/Plugin/PhpParallelLint.php +++ b/PHPCI/Plugin/PhpParallelLint.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -41,24 +40,12 @@ class PhpParallelLint implements \PHPCI\Plugin */ protected $ignore; - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @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->directory = $phpci->buildPath; - $this->ignore = $this->phpci->ignore; + $this->phpci = $phpci; + $this->build = $build; + $this->directory = $phpci->buildPath; + $this->ignore = $this->phpci->ignore; if (isset($options['directory'])) { $this->directory = $phpci->buildPath.$options['directory']; @@ -78,6 +65,11 @@ class PhpParallelLint implements \PHPCI\Plugin $phplint = $this->phpci->findBinary('parallel-lint'); + if (!$phplint) { + $this->phpci->logFailure('Could not find parallel-lint.'); + return false; + } + $cmd = $phplint . ' %s "%s"'; $success = $this->phpci->executeCommand( $cmd, @@ -95,17 +87,12 @@ class PhpParallelLint implements \PHPCI\Plugin return $success; } - /** - * Produce an argument string for PHP Parallel Lint. - * @return array - */ protected function getFlags() { - $ignoreFlags = array(); - foreach ($this->ignore as $ignoreDir) { - $ignoreFlags[] = '--exclude "' . $this->phpci->buildPath . $ignoreDir . '"'; + $ignore = ''; + if (count($this->ignore)) { + $ignore = ' --exclude ' . implode(' --exclude ', $this->ignore); } - $ignore = implode(' ', $ignoreFlags); return array($ignore); } diff --git a/PHPCI/Plugin/PhpSpec.php b/PHPCI/Plugin/PhpSpec.php index e468a718..7fbc332e 100644 --- a/PHPCI/Plugin/PhpSpec.php +++ b/PHPCI/Plugin/PhpSpec.php @@ -36,12 +36,6 @@ class PhpSpec implements PHPCI\Plugin */ protected $options; - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -59,6 +53,11 @@ class PhpSpec implements PHPCI\Plugin $phpspec = $this->phpci->findBinary(array('phpspec', 'phpspec.php')); + if (!$phpspec) { + $this->phpci->logFailure('Could not find phpspec.'); + return false; + } + $success = $this->phpci->executeCommand($phpspec . ' --format=junit --no-code-generation run'); $output = $this->phpci->getLastOutput(); diff --git a/PHPCI/Plugin/PhpTalLint.php b/PHPCI/Plugin/PhpTalLint.php deleted file mode 100644 index 8513ec36..00000000 --- a/PHPCI/Plugin/PhpTalLint.php +++ /dev/null @@ -1,265 +0,0 @@ - - * @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 . DIRECTORY_SEPARATOR)) { - $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(); - - $lint = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; - $lint .= 'vendor' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR; - $lint .= 'tools' . DIRECTORY_SEPARATOR . '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(); - - 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/PHPCI/Plugin/PhpUnit.php b/PHPCI/Plugin/PhpUnit.php index f716f079..c643416b 100644 --- a/PHPCI/Plugin/PhpUnit.php +++ b/PHPCI/Plugin/PhpUnit.php @@ -49,13 +49,6 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin */ protected $xmlConfigFile; - /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool - */ public static function canExecute($stage, Builder $builder, Build $build) { if ($stage == 'test' && !is_null(self::findConfigFile($builder->buildPath))) { @@ -65,19 +58,14 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return false; } - /** - * Try and find the phpunit XML config file. - * @param $buildPath - * @return null|string - */ public static function findConfigFile($buildPath) { if (file_exists($buildPath . 'phpunit.xml')) { return 'phpunit.xml'; } - if (file_exists($buildPath . 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml')) { - return 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml'; + if (file_exists($buildPath . 'tests/phpunit.xml')) { + return 'tests/phpunit.xml'; } if (file_exists($buildPath . 'phpunit.xml.dist')) { @@ -85,24 +73,12 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } if (file_exists($buildPath . 'tests/phpunit.xml.dist')) { - return 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml.dist'; + return 'tests/phpunit.xml.dist'; } return null; } - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -133,7 +109,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } if (isset($options['coverage'])) { - $this->coverage = ' --coverage-html ' . $this->phpci->interpolate($options['coverage']) . ' '; + $this->coverage = " --coverage-html {$options['coverage']} "; } } @@ -142,11 +118,6 @@ 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); @@ -162,7 +133,6 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } $tapString = $this->phpci->getLastOutput(); - $tapString = mb_convert_encoding($tapString, "UTF-8", "ISO-8859-1"); try { $tapParser = new TapParser($tapString); @@ -182,11 +152,6 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return $success; } - /** - * Run the tests defined in a PHPUnit config file. - * @param $configPath - * @return bool|mixed - */ protected function runConfigFile($configPath) { if (is_array($configPath)) { @@ -194,11 +159,18 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } else { if ($this->runFrom) { $curdir = getcwd(); - chdir($this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->runFrom); + chdir($this->phpci->buildPath.'/'.$this->runFrom); } + $phpunit = $this->phpci->findBinary('phpunit'); + if (!$phpunit) { + $this->phpci->logFailure('Could not find phpunit.'); + return false; + } + + $cmd = $phpunit . ' --tap %s -c "%s" ' . $this->coverage . $this->path; $success = $this->phpci->executeCommand($cmd, $this->args, $this->phpci->buildPath . $configPath); @@ -210,11 +182,6 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } } - /** - * Run the PHPUnit tests in a specific directory or array of directories. - * @param $directory - * @return bool|mixed - */ protected function runDir($directory) { if (is_array($directory)) { @@ -225,6 +192,11 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $phpunit = $this->phpci->findBinary('phpunit'); + if (!$phpunit) { + $this->phpci->logFailure('Could not find phpunit.'); + return false; + } + $cmd = $phpunit . ' --tap %s "%s"'; $success = $this->phpci->executeCommand($cmd, $this->args, $this->phpci->buildPath . $directory); chdir($curdir); @@ -232,11 +204,6 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } } - /** - * @param $array - * @param $callable - * @return bool|mixed - */ protected function recurseArg($array, $callable) { $success = true; diff --git a/PHPCI/Plugin/Shell.php b/PHPCI/Plugin/Shell.php index 5e914f3e..fceea3e2 100644 --- a/PHPCI/Plugin/Shell.php +++ b/PHPCI/Plugin/Shell.php @@ -10,7 +10,6 @@ namespace PHPCI\Plugin; use PHPCI\Builder; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; /** @@ -38,18 +37,6 @@ class Shell implements \PHPCI\Plugin */ protected $commands = array(); - /** - * Standard Constructor - * - * $options['directory'] Output Directory. Default: %BUILDPATH% - * $options['filename'] Phar Filename. Default: build.phar - * $options['regexp'] Regular Expression Filename Capture. Default: /\.php$/ - * $options['stub'] Stub Content. No Default Value - * - * @param Builder $phpci - * @param Build $build - * @param array $options - */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $this->phpci = $phpci; @@ -80,7 +67,7 @@ class Shell implements \PHPCI\Plugin public function execute() { if (!defined('ENABLE_SHELL_PLUGIN') || !ENABLE_SHELL_PLUGIN) { - throw new \Exception(Lang::get('shell_not_enabled')); + throw new \Exception('The shell plugin is not enabled.'); } $success = true; diff --git a/PHPCI/Plugin/SlackNotify.php b/PHPCI/Plugin/SlackNotify.php deleted file mode 100644 index 0e8d1cad..00000000 --- a/PHPCI/Plugin/SlackNotify.php +++ /dev/null @@ -1,137 +0,0 @@ - - * @package PHPCI - * @subpackage Plugins - */ -class SlackNotify implements \PHPCI\Plugin -{ - private $webHook; - private $room; - private $username; - private $message; - private $icon; - private $show_status; - - /** - * Set up the plugin, configure options, etc. - * @param Builder $phpci - * @param Build $build - * @param array $options - * @throws \Exception - */ - public function __construct(Builder $phpci, Build $build, array $options = array()) - { - $this->phpci = $phpci; - $this->build = $build; - - if (is_array($options) && isset($options['webhook_url'])) { - $this->webHook = trim($options['webhook_url']); - - if (isset($options['message'])) { - $this->message = $options['message']; - } else { - $this->message = '<%PROJECT_URI%|%PROJECT_TITLE%> - <%BUILD_URI%|Build #%BUILD%> has finished '; - $this->message .= 'for commit <%COMMIT_URI%|%SHORT_COMMIT% (%COMMIT_EMAIL%)> '; - $this->message .= 'on branch <%BRANCH_URI%|%BRANCH%>'; - } - - if (isset($options['room'])) { - $this->room = $options['room']; - } else { - $this->room = '#phpci'; - } - - if (isset($options['username'])) { - $this->username = $options['username']; - } else { - $this->username = 'PHPCI'; - } - - if (isset($options['show_status'])) { - $this->show_status = (bool) $options['show_status']; - } else { - $this->show_status = true; - } - - if (isset($options['icon'])) { - $this->icon = $options['icon']; - } - } else { - throw new \Exception('Please define the webhook_url for slack_notify plugin!'); - } - } - - /** - * Run the Slack plugin. - * @return bool - */ - public function execute() - { - $body = $this->phpci->interpolate($this->message); - - $client = new \Maknz\Slack\Client($this->webHook); - - $message = $client->createMessage(); - - if (!empty($this->room)) { - $message->setChannel($this->room); - } - - if (!empty($this->username)) { - $message->setUsername($this->username); - } - - if (!empty($this->icon)) { - $message->setIcon($this->icon); - } - - // Include an attachment which shows the status and hide the message - if ($this->show_status) { - $successfulBuild = $this->build->isSuccessful(); - - if ($successfulBuild) { - $status = 'Success'; - $color = 'good'; - } else { - $status = 'Failed'; - $color = 'danger'; - } - - // Build up the attachment data - $attachment = new \Maknz\Slack\Attachment(array( - 'fallback' => $body, - 'pretext' => $body, - 'color' => $color, - 'fields' => array( - new \Maknz\Slack\AttachmentField(array( - 'title' => 'Status', - 'value' => $status, - 'short' => false - )) - ) - )); - - $message->attach($attachment); - - $body = ''; - } - - $message->send($body); - - return true; - } -} diff --git a/PHPCI/Plugin/Sqlite.php b/PHPCI/Plugin/Sqlite.php index f80ece3d..1ffdcc88 100644 --- a/PHPCI/Plugin/Sqlite.php +++ b/PHPCI/Plugin/Sqlite.php @@ -70,7 +70,7 @@ class Sqlite implements \PHPCI\Plugin $pdo = new PDO('sqlite:' . $this->path, $opts); foreach ($this->queries as $query) { - $pdo->query($this->phpci->interpolate($query)); + $pdo->query($query); } } catch (\Exception $ex) { $this->phpci->logFailure($ex->getMessage()); diff --git a/PHPCI/Plugin/TechnicalDebt.php b/PHPCI/Plugin/TechnicalDebt.php deleted file mode 100755 index 6d4711b5..00000000 --- a/PHPCI/Plugin/TechnicalDebt.php +++ /dev/null @@ -1,207 +0,0 @@ - -* @package PHPCI -* @subpackage Plugins -*/ -class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin -{ - /** - * @var \PHPCI\Builder - */ - protected $phpci; - - /** - * @var array - */ - protected $suffixes; - - /** - * @var string - */ - protected $directory; - - /** - * @var int - */ - protected $allowed_errors; - - /** - * @var string, based on the assumption the root may not hold the code to be - * tested, extends the base path - */ - protected $path; - - /** - * @var array - paths to ignore - */ - protected $ignore; - - /** - * @var array - terms to search for - */ - protected $searches; - - - /** - * Check if this plugin can be executed. - * - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool - */ - public static function canExecute($stage, Builder $builder, Build $build) - { - if ($stage == 'test') { - return true; - } - - return false; - } - - /** - * @param \PHPCI\Builder $phpci - * @param \PHPCI\Model\Build $build - * @param array $options - */ - public function __construct(Builder $phpci, Build $build, array $options = array()) - { - $this->phpci = $phpci; - $this->build = $build; - $this->suffixes = array('php'); - $this->directory = $phpci->buildPath; - $this->path = ''; - $this->ignore = $this->phpci->ignore; - $this->allowed_errors = 0; - $this->searches = array('TODO', 'FIXME', 'TO DO', 'FIX ME'); - - if (isset($options['searches']) && is_array($options['searches'])) { - $this->searches = $options['searches']; - } - - if (isset($options['zero_config']) && $options['zero_config']) { - $this->allowed_errors = -1; - } - - $this->setOptions($options); - } - - /** - * Handle this plugin's options. - * @param $options - */ - protected function setOptions($options) - { - foreach (array('directory', 'path', 'ignore', 'allowed_errors') as $key) { - if (array_key_exists($key, $options)) { - $this->{$key} = $options[$key]; - } - } - } - - /** - * Runs the plugin - */ - public function execute() - { - $success = true; - $this->phpci->logExecOutput(false); - - $errorCount = $this->getErrorList(); - - $this->phpci->log("Found $errorCount instances of " . implode(', ', $this->searches)); - - $this->build->storeMeta('technical_debt-warnings', $errorCount); - - if ($this->allowed_errors != -1 && $errorCount > $this->allowed_errors) { - $success = false; - } - - return $success; - } - - /** - * Gets the number and list of errors returned from the search - * - * @return array - */ - public function getErrorList() - { - $dirIterator = new \RecursiveDirectoryIterator($this->directory); - $iterator = new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::SELF_FIRST); - $files = array(); - - $ignores = $this->ignore; - $ignores[] = 'phpci.yml'; - $ignores[] = '.phpci.yml'; - - foreach ($iterator as $file) { - $filePath = $file->getRealPath(); - $skipFile = false; - foreach ($ignores as $ignore) { - if (stripos($filePath, $ignore) !== false) { - $skipFile = true; - break; - } - } - - // Ignore hidden files, else .git, .sass_cache, etc. all get looped over - if (stripos($filePath, DIRECTORY_SEPARATOR . '.') !== false) { - $skipFile = true; - } - - if ($skipFile == false) { - $files[] = $file->getRealPath(); - } - } - - $files = array_filter(array_unique($files)); - $errorCount = 0; - - foreach ($files as $file) { - foreach ($this->searches as $search) { - $fileContent = file_get_contents($file); - $allLines = explode(PHP_EOL, $fileContent); - $beforeString = strstr($fileContent, $search, true); - - if (false !== $beforeString) { - $lines = explode(PHP_EOL, $beforeString); - $lineNumber = count($lines); - $content = trim($allLines[$lineNumber - 1]); - - $errorCount++; - - $fileName = str_replace($this->directory, '', $file); - - $this->build->reportError( - $this->phpci, - 'technical_debt', - $content, - PHPCI\Model\BuildError::SEVERITY_LOW, - $fileName, - $lineNumber - ); - } - } - } - - return $errorCount; - } -} diff --git a/PHPCI/Plugin/Util/ComposerPluginInformation.php b/PHPCI/Plugin/Util/ComposerPluginInformation.php index d8dcc91f..c870514e 100644 --- a/PHPCI/Plugin/Util/ComposerPluginInformation.php +++ b/PHPCI/Plugin/Util/ComposerPluginInformation.php @@ -2,12 +2,7 @@ namespace PHPCI\Plugin\Util; -use PHPCI\Plugin; -/** - * Class ComposerPluginInformation - * @package PHPCI\Plugin\Util - */ class ComposerPluginInformation implements InstalledPluginInformation { /** @@ -65,16 +60,13 @@ class ComposerPluginInformation implements InstalledPluginInformation public function getPluginClasses() { return array_map( - function (Plugin $plugin) { + function ($plugin) { return $plugin->class; }, $this->getInstalledPlugins() ); } - /** - * Load a list of available plugins from the installed composer packages. - */ protected function loadPluginInfo() { if ($this->pluginInfo !== null) { diff --git a/PHPCI/Plugin/Util/Executor.php b/PHPCI/Plugin/Util/Executor.php index bdd06b7e..15754f84 100644 --- a/PHPCI/Plugin/Util/Executor.php +++ b/PHPCI/Plugin/Util/Executor.php @@ -2,17 +2,8 @@ namespace PHPCI\Plugin\Util; -use b8\Store\Factory as StoreFactory; -use Exception; -use PHPCI\Helper\Lang; -use PHPCI\Logging\BuildLogger; -use PHPCI\Model\Build; -use PHPCI\Store\BuildStore; +use \PHPCI\Logging\BuildLogger; -/** - * Plugin Executor - Runs the configured plugins for a given build stage. - * @package PHPCI\Plugin\Util - */ class Executor { /** @@ -25,20 +16,10 @@ class Executor */ protected $pluginFactory; - /** - * @var BuildStore - */ - protected $store; - - /** - * @param Factory $pluginFactory - * @param BuildLogger $logger - */ - public function __construct(Factory $pluginFactory, BuildLogger $logger, BuildStore $store = null) + public function __construct(Factory $pluginFactory, BuildLogger $logger) { $this->pluginFactory = $pluginFactory; $this->logger = $logger; - $this->store = $store ?: StoreFactory::getStore('Build'); } /** @@ -50,114 +31,34 @@ class Executor public function executePlugins(&$config, $stage) { $success = true; - $pluginsToExecute = array(); - - // If we have global plugins to execute for this stage, add them to the list to be executed: - if (array_key_exists($stage, $config) && is_array($config[$stage])) { - $pluginsToExecute[] = $config[$stage]; + // Ignore any stages for which we don't have plugins set: + if (!array_key_exists($stage, $config) || !is_array($config[$stage])) { + return $success; } - $pluginsToExecute = $this->getBranchSpecificPlugins($config, $stage, $pluginsToExecute); + foreach ($config[$stage] as $plugin => $options) { + $this->logger->log('RUNNING PLUGIN: ' . $plugin); - foreach ($pluginsToExecute as $pluginSet) { - if (!$this->doExecutePlugins($pluginSet, $stage)) { - $success = false; + // Is this plugin allowed to fail? + if ($stage == 'test' && !isset($options['allow_failures'])) { + $options['allow_failures'] = false; } - } - return $success; - } - - /** - * Check the config for any plugins specific to the branch we're currently building. - * @param $config - * @param $stage - * @param $pluginsToExecute - * @return array - */ - protected function getBranchSpecificPlugins(&$config, $stage, $pluginsToExecute) - { - /** @var \PHPCI\Model\Build $build */ - $build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build'); - $branch = $build->getBranch(); - - // If we don't have any branch-specific plugins: - if (!isset($config['branch-' . $branch][$stage]) || !is_array($config['branch-' . $branch][$stage])) { - return $pluginsToExecute; - } - - // If we have branch-specific plugins to execute, add them to the list to be executed: - $branchConfig = $config['branch-' . $branch]; - $plugins = $branchConfig[$stage]; - - $runOption = 'after'; - - if (!empty($branchConfig['run-option'])) { - $runOption = $branchConfig['run-option']; - } - - switch ($runOption) { - // Replace standard plugin set for this stage with just the branch-specific ones: - case 'replace': - $pluginsToExecute = array(); - $pluginsToExecute[] = $plugins; - break; - - // Run branch-specific plugins before standard plugins: - case 'before': - array_unshift($pluginsToExecute, $plugins); - break; - - // Run branch-specific plugins after standard plugins: - case 'after': - array_push($pluginsToExecute, $plugins); - break; - - default: - array_push($pluginsToExecute, $plugins); - break; - } - - return $pluginsToExecute; - } - - /** - * Execute the list of plugins found for a given testing stage. - * @param $plugins - * @param $stage - * @return bool - * @throws \Exception - */ - protected function doExecutePlugins(&$plugins, $stage) - { - $success = true; - - foreach ($plugins as $plugin => $options) { - $this->logger->log(Lang::get('running_plugin', $plugin)); - - $this->setPluginStatus($stage, $plugin, Build::STATUS_RUNNING); - - // Try and execute it + // Try and execute it: if ($this->executePlugin($plugin, $options)) { - // Execution was successful - $this->logger->logSuccess(Lang::get('plugin_success')); - $this->setPluginStatus($stage, $plugin, Build::STATUS_SUCCESS); - } else { - // Execution failed - $this->logger->logFailure(Lang::get('plugin_failed')); - $this->setPluginStatus($stage, $plugin, Build::STATUS_FAILED); - if ($stage === 'setup') { - // If we're in the "setup" stage, execution should not continue after - // a plugin has failed: - throw new Exception('Plugin failed: ' . $plugin); - } elseif ($stage === 'test') { - // If we're in the "test" stage and the plugin is not allowed to fail, - // then mark the build as failed: - if (empty($options['allow_failures'])) { - $success = false; - } + // Execution was successful: + $this->logger->logSuccess('PLUGIN STATUS: SUCCESS!'); + + } else { + + // If we're in the "test" stage and the plugin is not allowed to fail, + // then mark the build as failed: + if ($stage == 'test' && !$options['allow_failures']) { + $success = false; } + + $this->logger->logFailure('PLUGIN STATUS: FAILED'); } } @@ -181,66 +82,24 @@ class Executor } if (!class_exists($class)) { - $this->logger->logFailure(Lang::get('plugin_missing', $plugin)); + $this->logger->logFailure('Plugin does not exist: ' . $plugin); return false; } + $rtn = true; + + // Try running it: try { - // Build and run it $obj = $this->pluginFactory->buildPlugin($class, $options); - return $obj->execute(); + + if (!$obj->execute()) { + $rtn = false; + } } catch (\Exception $ex) { - $this->logger->logFailure(Lang::get('exception') . $ex->getMessage(), $ex); - return false; - } - } - - /** - * Change the status of a plugin for a given stage. - * - * @param string $stage The builder stage. - * @param string $plugin The plugin name. - * @param int $status The new status. - */ - protected function setPluginStatus($stage, $plugin, $status) - { - $summary = $this->getBuildSummary(); - - if (!isset($summary[$stage][$plugin])) { - $summary[$stage][$plugin] = array(); + $this->logger->logFailure('EXCEPTION: ' . $ex->getMessage(), $ex); + $rtn = false; } - $summary[$stage][$plugin]['status'] = $status; - - if ($status === Build::STATUS_RUNNING) { - $summary[$stage][$plugin]['started'] = time(); - } elseif ($status >= Build::STATUS_SUCCESS) { - $summary[$stage][$plugin]['ended'] = time(); - } - - $this->setBuildSummary($summary); - } - - /** - * Fetch the summary data of the current build. - * - * @return array - */ - private function getBuildSummary() - { - $build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build'); - $metas = $this->store->getMeta('plugin-summary', $build->getProjectId(), $build->getId()); - return isset($metas[0]['meta_value']) ? $metas[0]['meta_value'] : array(); - } - - /** - * Sets the summary data of the current build. - * - * @param array summary - */ - private function setBuildSummary($summary) - { - $build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build'); - $this->store->setMeta($build->getProjectId(), $build->getId(), 'plugin-summary', json_encode($summary)); + return $rtn; } } diff --git a/PHPCI/Plugin/Util/Factory.php b/PHPCI/Plugin/Util/Factory.php index b6d11e5e..971b3e23 100644 --- a/PHPCI/Plugin/Util/Factory.php +++ b/PHPCI/Plugin/Util/Factory.php @@ -2,14 +2,14 @@ namespace PHPCI\Plugin\Util; -/** - * Plugin Factory - Loads Plugins and passes required dependencies. - * @package PHPCI\Plugin\Util - */ + + class Factory { - const TYPE_ARRAY = "array"; - const TYPE_CALLABLE = "callable"; + + const TYPE_ARRAY = "array"; + const TYPE_CALLABLE = "callable"; + const INTERFACE_PHPCI_PLUGIN = '\PHPCI\Plugin'; private $currentPluginOptions; @@ -19,9 +19,6 @@ class Factory */ private $container; - /** - * @param \Pimple $container - */ public function __construct(\Pimple $container = null) { if ($container) { @@ -62,10 +59,6 @@ class Factory return false; } - /** - * Get most recently used factory options. - * @return mixed - */ public function getLastOptions() { return $this->currentPluginOptions; @@ -76,11 +69,11 @@ class Factory * be passed along with any resources registered with the factory. * * @param $className - * @param array|null $options + * @param array $options * @throws \InvalidArgumentException if $className doesn't represent a valid plugin * @return \PHPCI\Plugin */ - public function buildPlugin($className, $options = array()) + public function buildPlugin($className, array $options = array()) { $this->currentPluginOptions = $options; @@ -136,12 +129,6 @@ class Factory $this->container[$resourceID] = $loader; } - /** - * Get an internal resource ID. - * @param null $type - * @param null $name - * @return string - */ private function getInternalID($type = null, $name = null) { $type = $type ? : ""; @@ -149,12 +136,7 @@ class Factory return $type . "-" . $name; } - /** - * @param string $type - * @param string $name - * @return mixed - */ - public function getResourceFor($type = null, $name = null) + private function getResourceFor($type = null, $name = null) { $fullId = $this->getInternalID($type, $name); if (isset($this->container[$fullId])) { @@ -174,10 +156,6 @@ class Factory return null; } - /** - * @param \ReflectionParameter $param - * @return null|string - */ private function getParamType(\ReflectionParameter $param) { $class = $param->getClass(); @@ -185,19 +163,13 @@ class Factory return $class->getName(); } elseif ($param->isArray()) { return self::TYPE_ARRAY; - } elseif (is_callable($param)) { + } elseif ($param->isCallable()) { return self::TYPE_CALLABLE; } else { return null; } } - /** - * @param $existingArgs - * @param \ReflectionParameter $param - * @return array - * @throws \DomainException - */ private function addArgFromParam($existingArgs, \ReflectionParameter $param) { $name = $param->getName(); diff --git a/PHPCI/Plugin/Util/FilesPluginInformation.php b/PHPCI/Plugin/Util/FilesPluginInformation.php index 35587283..5465f470 100644 --- a/PHPCI/Plugin/Util/FilesPluginInformation.php +++ b/PHPCI/Plugin/Util/FilesPluginInformation.php @@ -2,12 +2,6 @@ namespace PHPCI\Plugin\Util; -use PHPCI\Plugin; - -/** - * Class FilesPluginInformation - * @package PHPCI\Plugin\Util - */ class FilesPluginInformation implements InstalledPluginInformation { @@ -27,18 +21,11 @@ class FilesPluginInformation implements InstalledPluginInformation */ protected $pluginInfo = null; - /** - * @param $dirPath - * @return FilesPluginInformation - */ public static function newFromDir($dirPath) { return new self(new \DirectoryIterator($dirPath)); } - /** - * @param \Iterator $files - */ public function __construct(\Iterator $files) { $this->files = $files; @@ -56,7 +43,6 @@ class FilesPluginInformation implements InstalledPluginInformation if ($this->pluginInfo === null) { $this->loadPluginInfo(); } - return $this->pluginInfo; } @@ -69,54 +55,44 @@ class FilesPluginInformation implements InstalledPluginInformation public function getPluginClasses() { return array_map( - function (\stdClass $plugin) { - return $plugin->class; + function ($plugin) { + return $plugin->class; }, $this->getInstalledPlugins() ); } - /** - * Load plugin information from a given list of files. - */ protected function loadPluginInfo() { $this->pluginInfo = array(); foreach ($this->files as $fileInfo) { if ($fileInfo instanceof \SplFileInfo) { - if ($fileInfo->isFile() && $fileInfo->getExtension() == 'php') { + if ($fileInfo->isFile() && $fileInfo->getExtension()=='php') { $this->addPluginFromFile($fileInfo); } } } } - /** - * Add a plugin to the list from a given file. - * @param \SplFileInfo $fileInfo - */ protected function addPluginFromFile(\SplFileInfo $fileInfo) { $class = $this->getFullClassFromFile($fileInfo); if (!is_null($class)) { - $newPlugin = new \stdClass(); - $newPlugin->class = $class; + $newPlugin = new \stdClass(); + $newPlugin->class = $class; $newPlugin->source = "core"; - $parts = explode('\\', $newPlugin->class); - $newPlugin->name = end($parts); + $parts = explode('\\', $newPlugin->class); + $newPlugin->name = end($parts); $this->pluginInfo[] = $newPlugin; } } - /** - * Determine plugin class name for a given file. - * @param \SplFileInfo $fileInfo - * @return null|string - */ protected function getFullClassFromFile(\SplFileInfo $fileInfo) { + //TODO: Something less horrible than a regular expression + // on the contents of a file $contents = file_get_contents($fileInfo->getRealPath()); $matches = array(); @@ -124,11 +100,11 @@ class FilesPluginInformation implements InstalledPluginInformation if (isset($matches[1])) { $className = $matches[1]; - + $matches = array(); preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches); $namespace = $matches[1]; - + return $namespace . '\\' . $className; } else { return null; diff --git a/PHPCI/Plugin/Util/InstalledPluginInformation.php b/PHPCI/Plugin/Util/InstalledPluginInformation.php index 821c511c..133b8de8 100644 --- a/PHPCI/Plugin/Util/InstalledPluginInformation.php +++ b/PHPCI/Plugin/Util/InstalledPluginInformation.php @@ -1,10 +1,7 @@ pluginInformations[] = $information; @@ -32,11 +24,9 @@ class PluginInformationCollection implements InstalledPluginInformation public function getInstalledPlugins() { $arr = array(); - foreach ($this->pluginInformations as $single) { $arr = array_merge($arr, $single->getInstalledPlugins()); } - return $arr; } @@ -49,11 +39,9 @@ class PluginInformationCollection implements InstalledPluginInformation public function getPluginClasses() { $arr = array(); - foreach ($this->pluginInformations as $single) { $arr = array_merge($arr, $single->getPluginClasses()); } - return $arr; } } diff --git a/PHPCI/Plugin/Util/TapParser.php b/PHPCI/Plugin/Util/TapParser.php index 86981566..a18e89e5 100644 --- a/PHPCI/Plugin/Util/TapParser.php +++ b/PHPCI/Plugin/Util/TapParser.php @@ -2,52 +2,20 @@ namespace PHPCI\Plugin\Util; -use Exception; -use PHPCI\Helper\Lang; -use Symfony\Component\Yaml\Yaml; - -/** - * Processes TAP format strings into usable test result data. - * @package PHPCI\Plugin\Util - */ class TapParser { - const TEST_COUNTS_PATTERN = '/^\d+\.\.(\d+)/'; - const TEST_LINE_PATTERN = '/^(ok|not ok)(?:\s+\d+)?(?:\s+\-)?\s*(.*?)(?:\s*#\s*(skip|todo)\s*(.*))?\s*$/i'; - const TEST_YAML_START = '/^(\s*)---/'; - const TEST_DIAGNOSTIC = '/^#/'; - const TEST_COVERAGE = '/^Generating/'; + const TEST_COUNTS_PATTERN = '/([0-9]+)\.\.([0-9]+)/'; + const TEST_LINE_PATTERN = '/(ok|not ok)\s+[0-9]+\s+\-\s+([^\n]+)::([^\n]+)/'; + const TEST_MESSAGE_PATTERN = '/message\:\s+\'([^\']+)\'/'; + const TEST_COVERAGE_PATTERN = '/Generating code coverage report/'; + const TEST_SKIP_PATTERN = '/ok\s+[0-9]+\s+\-\s+#\s+SKIP/'; /** * @var string */ protected $tapString; - - /** - * @var int - */ protected $failures = 0; - /** - * @var array - */ - protected $lines; - - /** - * @var integer - */ - protected $lineNumber; - - /** - * @var integer - */ - protected $testCount; - - /** - * @var array - */ - protected $results; - /** * Create a new TAP parser for a given string. * @param string $tapString The TAP format string to be parsed. @@ -64,221 +32,78 @@ class TapParser { // Split up the TAP string into an array of lines, then // trim all of the lines so there's no leading or trailing whitespace. - $this->lines = array_map('rtrim', explode("\n", $this->tapString)); - $this->lineNumber = 0; + $lines = explode("\n", $this->tapString); + $lines = array_map(function ($line) { + return trim($line); + }, $lines); - $this->testCount = false; - $this->results = array(); + // Check TAP version: + $versionLine = array_shift($lines); - $header = $this->findTapLog(); - - $line = $this->nextLine(); - if ($line === $header) { - throw new Exception("Duplicated TAP log, please check the configuration."); + if ($versionLine != 'TAP version 13') { + throw new \Exception('TapParser only supports TAP version 13'); } - while ($line !== false && ($this->testCount === false || count($this->results) < $this->testCount)) { - $this->parseLine($line); - $line = $this->nextLine(); - } - - if (false !== $this->testCount && count($this->results) !== $this->testCount) { - throw new Exception(Lang::get('tap_error')); - } - - return $this->results; - } - - /** Looks for the start of the TAP log in the string. - * - * @return string The TAP header line. - * - * @throws Exception if no TAP log is found or versions mismatch. - */ - protected function findTapLog() - { - // Look for the beginning of the TAP output - do { - $header = $this->nextLine(); - } while ($header !== false && substr($header, 0, 12) !== 'TAP version '); - - // - if ($header === false) { - throw new Exception('No TAP log found, please check the configuration.'); - } elseif ($header !== 'TAP version 13') { - throw new Exception(Lang::get('tap_version')); - } - - return $header; - } - - /** Fetch the next line. - * - * @return string|false The next line or false if the end has been reached. - */ - protected function nextLine() - { - if ($this->lineNumber < count($this->lines)) { - return $this->lines[$this->lineNumber++]; - } - return false; - } - - /** - * @param string $line - * - * @return boolean - */ - protected function testLine($line) - { - if (preg_match(self::TEST_LINE_PATTERN, $line, $matches)) { - $this->results[] = $this->processTestLine( - $matches[1], - isset($matches[2]) ? $matches[2] : '', - isset($matches[3]) ? $matches[3] : null, - isset($matches[4]) ? $matches[4] : null - ); - - return true; - } - - return false; - } - - /** - * @param string $line - * - * @return boolean - */ - protected function yamlLine($line) - { - if (preg_match(self::TEST_YAML_START, $line, $matches)) { - $diagnostic = $this->processYamlBlock($matches[1]); - $test = array_pop($this->results); - if (isset($test['message'], $diagnostic['message'])) { - $test['message'] .= PHP_EOL . $diagnostic['message']; - unset($diagnostic['message']); + if (isset($lines[count($lines) - 1]) && preg_match(self::TEST_COVERAGE_PATTERN, $lines[count($lines) - 1])) { + array_pop($lines); + if ($lines[count($lines) - 1] == "") { + array_pop($lines); } - $this->results[] = array_replace($test, $diagnostic); - - return true; } - return false; + $matches = array(); + $totalTests = 0; + if (preg_match(self::TEST_COUNTS_PATTERN, $lines[0], $matches)) { + array_shift($lines); + $totalTests = (int) $matches[2]; + } + + if (isset($lines[count($lines) - 1]) && + preg_match(self::TEST_COUNTS_PATTERN, $lines[count($lines) - 1], $matches)) { + array_pop($lines); + $totalTests = (int) $matches[2]; + } + + $rtn = $this->processTestLines($lines); + + if ($totalTests != count($rtn)) { + throw new \Exception('Invalid TAP string, number of tests does not match specified test count.'); + } + + return $rtn; } - /** Parse a single line. - * - * @param string $line - * - * @throws Exception - */ - protected function parseLine($line) + protected function processTestLines($lines) { - if (preg_match(self::TEST_DIAGNOSTIC, $line) || preg_match(self::TEST_COVERAGE, $line) || !$line) { - return; - } + $rtn = array(); - if (preg_match(self::TEST_COUNTS_PATTERN, $line, $matches)) { - $this->testCount = intval($matches[1]); + foreach ($lines as $line) { + $matches = array(); - return; - } + if (preg_match(self::TEST_LINE_PATTERN, $line, $matches)) { + $ok = ($matches[1] == 'ok' ? true : false); - if ($this->testLine($line)) { - return; - } + if (!$ok) { + $this->failures++; + } - if ($this->yamlLine($line)) { - return; - } + $item = array( + 'pass' => $ok, + 'suite' => $matches[2], + 'test' => $matches[3], + ); - throw new Exception(sprintf('Incorrect TAP data, line %d: %s', $this->lineNumber, $line)); - } - - /** - * Process an individual test line. - * - * @param string $result - * @param string $message - * @param string $directive - * @param string $reason - * - * @return array - */ - protected function processTestLine($result, $message, $directive, $reason) - { - $test = array( - 'pass' => true, - 'message' => $message, - 'severity' => 'success', - ); - - if ($result !== 'ok') { - $test['pass'] = false; - $test['severity'] = substr($message, 0, 6) === 'Error:' ? 'error' : 'fail'; - $this->failures++; - } - - if ($directive) { - $test = $this->processDirective($test, $directive, $reason); - } - - return $test; - } - - /** Process an indented Yaml block. - * - * @param string $indent The block indentation to ignore. - * - * @return array The processed Yaml content. - */ - protected function processYamlBlock($indent) - { - $startLine = $this->lineNumber + 1; - $endLine = $indent . '...'; - $yamlLines = array(); - - do { - $line = $this->nextLine(); - - if ($line === false) { - throw new Exception(Lang::get('tap_error_endless_yaml', $startLine)); - } elseif ($line === $endLine) { - break; + $rtn[] = $item; + } elseif (preg_match(self::TEST_SKIP_PATTERN, $line, $matches)) { + $rtn[] = array('message' => 'SKIP'); + } elseif (preg_match(self::TEST_MESSAGE_PATTERN, $line, $matches)) { + $rtn[count($rtn) - 1]['message'] = $matches[1]; } - - $yamlLines[] = substr($line, strlen($indent)); - } while (true); - - return Yaml::parse(join("\n", $yamlLines)); - } - - /** Process a TAP directive - * - * @param array $test - * @param string $directive - * @param string $reason - * @return array - */ - protected function processDirective($test, $directive, $reason) - { - $test['severity'] = strtolower($directive) === 'skip' ? 'skipped' : 'todo'; - - if (!empty($reason)) { - if (!empty($test['message'])) { - $test['message'] .= ', '.$test['severity'].': '; - } - $test['message'] .= $reason; } - return $test; + return $rtn; } - /** - * Get the total number of failures from the current TAP file. - * @return int - */ public function getTotalFailures() { return $this->failures; diff --git a/PHPCI/Plugin/Util/TestResultParsers/Codeception.php b/PHPCI/Plugin/Util/TestResultParsers/Codeception.php deleted file mode 100644 index 24af62e4..00000000 --- a/PHPCI/Plugin/Util/TestResultParsers/Codeception.php +++ /dev/null @@ -1,114 +0,0 @@ - - * @package PHPCI\Plugin\Util\TestResultParsers - */ -class Codeception implements ParserInterface -{ - protected $phpci; - protected $resultsXml; - - protected $results; - - protected $totalTests; - protected $totalTimeTaken; - protected $totalFailures; - protected $totalErrors; - - /** - * @param Builder $phpci - * @param $resultsXml - */ - public function __construct(Builder $phpci, $resultsXml) - { - $this->phpci = $phpci; - $this->resultsXml = $resultsXml; - $this->totalTests = 0; - } - - /** - * @return array An array of key/value pairs for storage in the plugins result metadata - */ - public function parse() - { - $rtn = array(); - - $this->results = new \SimpleXMLElement($this->resultsXml); - - // calculate total results - foreach ($this->results->testsuite as $testsuite) { - $this->totalTests += (int) $testsuite['tests']; - $this->totalTimeTaken += (float) $testsuite['time']; - $this->totalFailures += (int) $testsuite['failures']; - $this->totalErrors += (int) $testsuite['errors']; - - foreach ($testsuite->testcase as $testcase) { - $testresult = array( - 'suite' => (string) $testsuite['name'], - 'file' => str_replace($this->phpci->buildPath, '/', (string) $testcase['file']), - 'name' => (string) $testcase['name'], - 'feature' => (string) $testcase['feature'], - 'assertions' => (int) $testcase['assertions'], - 'time' => (float) $testcase['time'] - ); - - if (isset($testcase['class'])) { - $testresult['class'] = (string) $testcase['class']; - } - - // PHPUnit testcases does not have feature field. Use class::method instead - if (!$testresult['feature']) { - $testresult['feature'] = sprintf('%s::%s', $testresult['class'], $testresult['name']); - } - - if (isset($testcase->failure) || isset($testcase->error)) { - $testresult['pass'] = false; - $testresult['message'] = (string)$testcase->failure . (string)$testcase->error; - } else { - $testresult['pass'] = true; - } - - $rtn[] = $testresult; - } - } - - return $rtn; - } - - /** - * Get the total number of tests performed. - * - * @return int - */ - public function getTotalTests() - { - return $this->totalTests; - } - - /** - * The time take to complete all tests - * - * @return mixed - */ - public function getTotalTimeTaken() - { - return $this->totalTimeTaken; - } - - /** - * A count of the test failures - * - * @return mixed - */ - public function getTotalFailures() - { - return $this->totalFailures + $this->totalErrors; - } -} diff --git a/PHPCI/Plugin/Util/TestResultParsers/ParserInterface.php b/PHPCI/Plugin/Util/TestResultParsers/ParserInterface.php deleted file mode 100644 index d0c77cb7..00000000 --- a/PHPCI/Plugin/Util/TestResultParsers/ParserInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -buildPath; $this->phpci = $phpci; $this->build = $build; - $this->directory = isset($options['directory']) ? $this->phpci->interpolate($options['directory']) : $path; + $this->directory = isset($options['directory']) ? $options['directory'] : $path; } /** @@ -61,8 +56,8 @@ class Wipe implements \PHPCI\Plugin if (IS_WIN) { $cmd = 'rmdir /S /Q "%s"'; } - return $this->phpci->executeCommand($cmd, $this->directory); + $success = $this->phpci->executeCommand($cmd, $this->directory); } - return true; + return $success; } } diff --git a/PHPCI/Plugin/Xmpp.php b/PHPCI/Plugin/Xmpp.php index ccfc4399..8614e208 100644 --- a/PHPCI/Plugin/Xmpp.php +++ b/PHPCI/Plugin/Xmpp.php @@ -132,9 +132,8 @@ class XMPP implements \PHPCI\Plugin */ public function findConfigFile() { - if (file_exists($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) { - if (md5(file_get_contents($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) - !== md5($this->getConfigFormat())) { + if (file_exists('.sendxmpprc')) { + if (md5(file_get_contents('.sendxmpprc')) !== md5($this->getConfigFormat())) { return null; } @@ -149,7 +148,12 @@ class XMPP implements \PHPCI\Plugin */ public function execute() { - $sendxmpp = $this->phpci->findBinary('sendxmpp'); + $sendxmpp = $this->phpci->findBinary('/usr/bin/sendxmpp'); + + if (!$sendxmpp) { + $this->phpci->logFailure('Could not find sendxmpp.'); + return false; + } /* * Without recipients we can't send notification @@ -161,10 +165,9 @@ class XMPP implements \PHPCI\Plugin /* * Try to build conf file */ - $config_file = $this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc'; if (is_null($this->findConfigFile())) { - file_put_contents($config_file, $this->getConfigFormat()); - chmod($config_file, 0600); + file_put_contents('.sendxmpprc', $this->getConfigFormat()); + chmod('.sendxmpprc', 0600); } /* @@ -175,7 +178,7 @@ class XMPP implements \PHPCI\Plugin $tls = ' -t'; } - $message_file = $this->phpci->buildPath . DIRECTORY_SEPARATOR . uniqid('xmppmessage'); + $message_file = uniqid('xmppmessage'); if ($this->buildMessage($message_file) === false) { return false; } @@ -183,10 +186,10 @@ class XMPP implements \PHPCI\Plugin /* * Send XMPP notification for all recipients */ - $cmd = $sendxmpp . "%s -f %s -m %s %s"; + $cmd = $sendxmpp . "%s -f .sendxmpprc -m %s %s"; $recipients = implode(' ', $this->recipients); - $success = $this->phpci->executeCommand($cmd, $tls, $config_file, $message_file, $recipients); + $success = $this->phpci->executeCommand($cmd, $tls, $message_file, $recipients); print $this->phpci->getLastOutput(); diff --git a/PHPCI/ProcessControl/Factory.php b/PHPCI/ProcessControl/Factory.php deleted file mode 100644 index 7622fd49..00000000 --- a/PHPCI/ProcessControl/Factory.php +++ /dev/null @@ -1,63 +0,0 @@ - - */ -class Factory -{ - /** - * ProcessControl singleton. - * - * @var ProcessControlInterface - */ - protected static $instance = null; - - /** - * Returns the ProcessControl singleton. - * - * @return ProcessControlInterface - */ - public static function getInstance() - { - if (static::$instance === null) { - static::$instance = static::createProcessControl(); - } - return static::$instance; - } - - /** - * Create a ProcessControl depending on available extensions and the underlying OS. - * - * Check PosixProcessControl, WindowsProcessControl and UnixProcessControl, in that order. - * - * @return ProcessControlInterface - * - * @internal - */ - public static function createProcessControl() - { - switch (true) { - case PosixProcessControl::isAvailable(): - return new PosixProcessControl(); - - case WindowsProcessControl::isAvailable(): - return new WindowsProcessControl(); - - case UnixProcessControl::isAvailable(): - return new UnixProcessControl(); - } - - throw new \Exception("No ProcessControl implementation available."); - } -} diff --git a/PHPCI/ProcessControl/PosixProcessControl.php b/PHPCI/ProcessControl/PosixProcessControl.php deleted file mode 100644 index bac55ee2..00000000 --- a/PHPCI/ProcessControl/PosixProcessControl.php +++ /dev/null @@ -1,52 +0,0 @@ - - */ -class PosixProcessControl implements ProcessControlInterface -{ - /** - * - * @param int $pid - * @return bool - */ - public function isRunning($pid) - { - // Signal "0" is not sent to the process, but posix_kill checks the process anyway; - return posix_kill($pid, 0); - } - - /** - * Sends a TERMINATE or KILL signal to the process using posix_kill. - * - * @param int $pid - * @param bool $forcefully Whether to send TERMINATE (false) or KILL (true). - */ - public function kill($pid, $forcefully = false) - { - posix_kill($pid, $forcefully ? 9 : 15); - } - - /** - * Check whether this posix_kill is available. - * - * @return bool - * - * @internal - */ - public static function isAvailable() - { - return function_exists('posix_kill'); - } -} diff --git a/PHPCI/ProcessControl/ProcessControlInterface.php b/PHPCI/ProcessControl/ProcessControlInterface.php deleted file mode 100644 index 709e0bee..00000000 --- a/PHPCI/ProcessControl/ProcessControlInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -interface ProcessControlInterface -{ - /** Checks if a process exists. - * - * @param int $pid The process identifier. - * - * @return boolean true is the process is running, else false. - */ - public function isRunning($pid); - - /** Terminate a running process. - * - * @param int $pid The process identifier. - * @param bool $forcefully Whether to gently (false) or forcefully (true) terminate the process. - */ - public function kill($pid, $forcefully = false); -} diff --git a/PHPCI/ProcessControl/UnixProcessControl.php b/PHPCI/ProcessControl/UnixProcessControl.php deleted file mode 100644 index 8b638073..00000000 --- a/PHPCI/ProcessControl/UnixProcessControl.php +++ /dev/null @@ -1,54 +0,0 @@ - - */ -class UnixProcessControl implements ProcessControlInterface -{ - /** - * Check process using the "ps" command. - * - * @param int $pid - * @return boolean - */ - public function isRunning($pid) - { - $output = $exitCode = null; - exec(sprintf("ps %d", $pid), $output, $exitCode); - return $exitCode === 0; - } - - /** - * Sends a signal using the "kill" command. - * - * @param int $pid - * @param bool $forcefully - */ - public function kill($pid, $forcefully = false) - { - exec(sprintf("kill -%d %d", $forcefully ? 9 : 15, $pid)); - } - - /** - * Check whether the commands "ps" and "kill" are available. - * - * @return bool - * - * @internal - */ - public static function isAvailable() - { - return DIRECTORY_SEPARATOR === '/' && exec("which ps") && exec("which kill"); - } -} diff --git a/PHPCI/ProcessControl/WindowsProcessControl.php b/PHPCI/ProcessControl/WindowsProcessControl.php deleted file mode 100644 index e750d321..00000000 --- a/PHPCI/ProcessControl/WindowsProcessControl.php +++ /dev/null @@ -1,54 +0,0 @@ - - */ -class WindowsProcessControl implements ProcessControlInterface -{ - /** - * Check if the process is running using the "tasklist" command. - * - * @param type $pid - * @return bool - */ - public function isRunning($pid) - { - $lastLine = exec(sprintf('tasklist /fi "PID eq %d" /nh /fo csv 2>nul:', $pid)); - $record = str_getcsv($lastLine); - return isset($record[1]) && intval($record[1]) === $pid; - } - - /** - * Terminate the process using the "taskkill" command. - * - * @param type $pid - * @param bool $forcefully - */ - public function kill($pid, $forcefully = false) - { - exec(sprintf("taskkill /t /pid %d %s 2>nul:", $pid, $forcefully ? '/f' : '')); - } - - /** - * Check whether the commands "tasklist" and "taskkill" are available. - * - * @return bool - * - * @internal - */ - public static function isAvailable() - { - return DIRECTORY_SEPARATOR === '\\' && exec("where tasklist") && exec("where taskkill"); - } -} diff --git a/PHPCI/Service/BuildService.php b/PHPCI/Service/BuildService.php index a120a64e..300df728 100644 --- a/PHPCI/Service/BuildService.php +++ b/PHPCI/Service/BuildService.php @@ -9,20 +9,10 @@ namespace PHPCI\Service; -use b8\Config; -use Pheanstalk\Pheanstalk; -use Pheanstalk\PheanstalkInterface; -use PHPCI\BuildFactory; -use PHPCI\Helper\Lang; use PHPCI\Model\Build; use PHPCI\Model\Project; use PHPCI\Store\BuildStore; -/** - * The build service handles the creation, duplication and deletion of builds. - * Class BuildService - * @package PHPCI\Service - */ class BuildService { /** @@ -30,11 +20,6 @@ class BuildService */ protected $buildStore; - /** - * @var bool - */ - public $queueError = false; - /** * @param BuildStore $buildStore */ @@ -69,7 +54,6 @@ class BuildService $build->setCommitId($commitId); } else { $build->setCommitId('Manual'); - $build->setCommitMessage(Lang::get('manual_build')); } if (!is_null($branch)) { @@ -90,17 +74,7 @@ class BuildService $build->setExtra(json_encode($extra)); } - $build = $this->buildStore->save($build); - - $buildId = $build->getId(); - - if (!empty($buildId)) { - $build = BuildFactory::getBuild($build); - $build->sendStatusPostback(); - $this->addBuildToQueue($build); - } - - return $build; + return $this->buildStore->save($build); } /** @@ -121,19 +95,8 @@ class BuildService $build = new Build(); $build->setValues($data); $build->setCreated(new \DateTime()); - $build->setStatus(0); - $build = $this->buildStore->save($build); - - $buildId = $build->getId(); - - if (!empty($buildId)) { - $build = BuildFactory::getBuild($build); - $build->sendStatusPostback(); - $this->addBuildToQueue($build); - } - - return $build; + return $this->buildStore->save($build); } /** @@ -143,47 +106,6 @@ class BuildService */ public function deleteBuild(Build $build) { - $build->removeBuildDirectory(); return $this->buildStore->delete($build); } - - /** - * Takes a build and puts it into the queue to be run (if using a queue) - * @param Build $build - */ - public function addBuildToQueue(Build $build) - { - $buildId = $build->getId(); - - if (empty($buildId)) { - return; - } - - $config = Config::getInstance(); - $settings = $config->get('phpci.worker', []); - - if (!empty($settings['host']) && !empty($settings['queue'])) { - try { - $jobData = array( - 'type' => 'phpci.build', - 'build_id' => $build->getId(), - ); - - if ($config->get('using_custom_file')) { - $jobData['config'] = $config->getArray(); - } - - $pheanstalk = new Pheanstalk($settings['host']); - $pheanstalk->useTube($settings['queue']); - $pheanstalk->put( - json_encode($jobData), - PheanstalkInterface::DEFAULT_PRIORITY, - PheanstalkInterface::DEFAULT_DELAY, - $config->get('phpci.worker.job_timeout', 600) - ); - } catch (\Exception $ex) { - $this->queueError = true; - } - } - } } diff --git a/PHPCI/Service/BuildStatusService.php b/PHPCI/Service/BuildStatusService.php deleted file mode 100644 index b4f3c009..00000000 --- a/PHPCI/Service/BuildStatusService.php +++ /dev/null @@ -1,222 +0,0 @@ -project = $project; - $this->branch = $branch; - $this->build = $build; - if ($this->build) { - $this->loadParentBuild($isParent); - } - if (defined('PHPCI_URL')) { - $this->setUrl(PHPCI_URL); - } - } - - /** - * @param $url - */ - public function setUrl($url) - { - $this->url = $url; - } - - /** - * @return Build - */ - public function getBuild() - { - return $this->build; - } - - /** - * @param bool $isParent - * @throws \Exception - */ - protected function loadParentBuild($isParent = true) - { - if ($isParent === false && !$this->isFinished()) { - $lastFinishedBuild = $this->project->getLatestBuild($this->branch, $this->finishedStatusIds); - - if ($lastFinishedBuild) { - $this->prevService = new BuildStatusService( - $this->branch, - $this->project, - $lastFinishedBuild, - true - ); - } - } - } - - /** - * @return string - */ - public function getActivity() - { - if (in_array($this->build->getStatus(), $this->finishedStatusIds)) { - return 'Sleeping'; - } elseif ($this->build->getStatus() == Build::STATUS_NEW) { - return 'Pending'; - } elseif ($this->build->getStatus() == Build::STATUS_RUNNING) { - return 'Building'; - } - return 'Unknown'; - } - - /** - * @return string - */ - public function getName() - { - return $this->project->getTitle() . ' / ' . $this->branch; - } - - /** - * @return bool - */ - public function isFinished() - { - if (in_array($this->build->getStatus(), $this->finishedStatusIds)) { - return true; - } - return false; - } - - /** - * @return null|Build - */ - public function getFinishedBuildInfo() - { - if ($this->isFinished()) { - return $this->build; - } elseif ($this->prevService) { - return $this->prevService->getBuild(); - } - return null; - } - - /** - * @return int|string - */ - public function getLastBuildLabel() - { - if ($buildInfo = $this->getFinishedBuildInfo()) { - return $buildInfo->getId(); - } - return ''; - } - - /** - * @return string - */ - public function getLastBuildTime() - { - $dateFormat = 'Y-m-d\\TH:i:sO'; - if ($buildInfo = $this->getFinishedBuildInfo()) { - return ($buildInfo->getFinished()) ? $buildInfo->getFinished()->format($dateFormat) : ''; - } - return ''; - } - - /** - * @param Build $build - * @return string - */ - public function getBuildStatus(Build $build) - { - switch ($build->getStatus()) { - case Build::STATUS_SUCCESS: - return 'Success'; - case Build::STATUS_FAILED: - return 'Failure'; - } - return 'Unknown'; - } - - /** - * @return string - */ - public function getLastBuildStatus() - { - if ($build = $this->getFinishedBuildInfo()) { - return $this->getBuildStatus($build); - } - return ''; - } - - /** - * @return string - */ - public function getBuildUrl() - { - return $this->url . 'build/view/' . $this->build->getId(); - } - - /** - * @return array - */ - public function toArray() - { - if (!$this->build) { - return array(); - } - return array( - 'name' => $this->getName(), - 'activity' => $this->getActivity(), - 'lastBuildLabel' => $this->getLastBuildLabel(), - 'lastBuildStatus' => $this->getLastBuildStatus(), - 'lastBuildTime' => $this->getLastBuildTime(), - 'webUrl' => $this->getBuildUrl(), - ); - } -} diff --git a/PHPCI/Service/ProjectService.php b/PHPCI/Service/ProjectService.php index 8b07b0a9..1bc1b248 100644 --- a/PHPCI/Service/ProjectService.php +++ b/PHPCI/Service/ProjectService.php @@ -12,11 +12,6 @@ namespace PHPCI\Service; use PHPCI\Model\Project; use PHPCI\Store\ProjectStore; -/** - * The project service handles the creation, modification and deletion of projects. - * Class ProjectService - * @package PHPCI\Service - */ class ProjectService { /** @@ -81,18 +76,10 @@ class ProjectService $project->setAllowPublicStatus((int)$options['allow_public_status']); } - if (array_key_exists('archived', $options)) { - $project->setArchived((bool)$options['archived']); - } - if (array_key_exists('branch', $options)) { $project->setBranch($options['branch']); } - if (array_key_exists('group', $options)) { - $project->setGroup($options['group']); - } - // Allow certain project types to set access information: $this->processAccessInformation($project); @@ -123,12 +110,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]); + $project->setReference($matches[4] . '/' . $matches[5]); } $project->setAccessInformation($info); diff --git a/PHPCI/Service/UserService.php b/PHPCI/Service/UserService.php index 2d9b070d..8f20044f 100644 --- a/PHPCI/Service/UserService.php +++ b/PHPCI/Service/UserService.php @@ -12,11 +12,6 @@ namespace PHPCI\Service; use PHPCI\Model\User; use PHPCI\Store\UserStore; -/** - * The user service handles the creation, modification and deletion of users. - * Class UserService - * @package PHPCI\Service - */ class UserService { /** @@ -32,14 +27,6 @@ class UserService $this->store = $store; } - /** - * Create a new user within PHPCI. - * @param $name - * @param $emailAddress - * @param $password - * @param bool $isAdmin - * @return \PHPCI\Model\User - */ public function createUser($name, $emailAddress, $password, $isAdmin = false) { $user = new User(); @@ -51,15 +38,6 @@ class UserService return $this->store->save($user); } - /** - * Update a user. - * @param User $user - * @param $name - * @param $emailAddress - * @param null $password - * @param null $isAdmin - * @return \PHPCI\Model\User - */ public function updateUser(User $user, $name, $emailAddress, $password = null, $isAdmin = null) { $user->setName($name); @@ -76,11 +54,6 @@ class UserService return $this->store->save($user); } - /** - * Delete a user. - * @param User $user - * @return bool - */ public function deleteUser(User $user) { return $this->store->delete($user); diff --git a/PHPCI/Store.php b/PHPCI/Store.php index 71522638..bb8e4a21 100644 --- a/PHPCI/Store.php +++ b/PHPCI/Store.php @@ -9,10 +9,6 @@ namespace PHPCI; -/** - * PHPCI Base Store - * @package PHPCI - */ abstract class Store extends \b8\Store { diff --git a/PHPCI/Store/Base/BuildErrorStoreBase.php b/PHPCI/Store/Base/BuildErrorStoreBase.php deleted file mode 100644 index 627b9d54..00000000 --- a/PHPCI/Store/Base/BuildErrorStoreBase.php +++ /dev/null @@ -1,85 +0,0 @@ -getById($value, $useConnection); - } - - /** - * Get a single BuildError by Id. - * @return null|BuildError - */ - public function getById($value, $useConnection = 'read') - { - if (is_null($value)) { - throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); - } - - $query = 'SELECT * FROM `build_error` WHERE `id` = :id LIMIT 1'; - $stmt = Database::getConnection($useConnection)->prepare($query); - $stmt->bindValue(':id', $value); - - if ($stmt->execute()) { - if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) { - return new BuildError($data); - } - } - - return null; - } - - /** - * Get multiple BuildError by BuildId. - * @return array - */ - public function getByBuildId($value, $limit = 1000, $useConnection = 'read') - { - if (is_null($value)) { - throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); - } - - - $query = 'SELECT * FROM `build_error` WHERE `build_id` = :build_id LIMIT :limit'; - $stmt = Database::getConnection($useConnection)->prepare($query); - $stmt->bindValue(':build_id', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); - - if ($stmt->execute()) { - $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - $map = function ($item) { - return new BuildError($item); - }; - $rtn = array_map($map, $res); - - $count = count($rtn); - - return array('items' => $rtn, 'count' => $count); - } else { - return array('items' => array(), 'count' => 0); - } - } -} diff --git a/PHPCI/Store/Base/BuildMetaStoreBase.php b/PHPCI/Store/Base/BuildMetaStoreBase.php index 52665d79..f6158c13 100644 --- a/PHPCI/Store/Base/BuildMetaStoreBase.php +++ b/PHPCI/Store/Base/BuildMetaStoreBase.php @@ -20,18 +20,11 @@ class BuildMetaStoreBase extends Store protected $modelName = '\PHPCI\Model\BuildMeta'; protected $primaryKey = 'id'; - /** - * Get a BuildMeta by primary key (Id) - */ public function getByPrimaryKey($value, $useConnection = 'read') { return $this->getById($value, $useConnection); } - /** - * Get a single BuildMeta by Id. - * @return null|BuildMeta - */ public function getById($value, $useConnection = 'read') { if (is_null($value)) { @@ -51,21 +44,22 @@ class BuildMetaStoreBase extends Store return null; } - /** - * Get multiple BuildMeta by ProjectId. - * @return array - */ - public function getByProjectId($value, $limit = 1000, $useConnection = 'read') + public function getByProjectId($value, $limit = null, $useConnection = 'read') { if (is_null($value)) { throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } + $add = ''; - $query = 'SELECT * FROM `build_meta` WHERE `project_id` = :project_id LIMIT :limit'; + if ($limit) { + $add .= ' LIMIT ' . $limit; + } + + + $query = 'SELECT * FROM `build_meta` WHERE `project_id` = :project_id' . $add; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':project_id', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); if ($stmt->execute()) { $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); @@ -77,27 +71,29 @@ class BuildMetaStoreBase extends Store $count = count($rtn); + return array('items' => $rtn, 'count' => $count); } else { return array('items' => array(), 'count' => 0); } } - /** - * Get multiple BuildMeta by BuildId. - * @return array - */ - public function getByBuildId($value, $limit = 1000, $useConnection = 'read') + public function getByBuildId($value, $limit = null, $useConnection = 'read') { if (is_null($value)) { throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } + $add = ''; - $query = 'SELECT * FROM `build_meta` WHERE `build_id` = :build_id LIMIT :limit'; + if ($limit) { + $add .= ' LIMIT ' . $limit; + } + + + $query = 'SELECT * FROM `build_meta` WHERE `build_id` = :build_id' . $add; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':build_id', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); if ($stmt->execute()) { $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); @@ -109,6 +105,7 @@ class BuildMetaStoreBase extends Store $count = count($rtn); + return array('items' => $rtn, 'count' => $count); } else { return array('items' => array(), 'count' => 0); diff --git a/PHPCI/Store/Base/BuildStoreBase.php b/PHPCI/Store/Base/BuildStoreBase.php index b8b49cb7..20927caa 100644 --- a/PHPCI/Store/Base/BuildStoreBase.php +++ b/PHPCI/Store/Base/BuildStoreBase.php @@ -20,18 +20,11 @@ class BuildStoreBase extends Store protected $modelName = '\PHPCI\Model\Build'; protected $primaryKey = 'id'; - /** - * Get a Build by primary key (Id) - */ public function getByPrimaryKey($value, $useConnection = 'read') { return $this->getById($value, $useConnection); } - /** - * Get a single Build by Id. - * @return null|Build - */ public function getById($value, $useConnection = 'read') { if (is_null($value)) { @@ -51,21 +44,22 @@ class BuildStoreBase extends Store return null; } - /** - * Get multiple Build by ProjectId. - * @return array - */ - public function getByProjectId($value, $limit = 1000, $useConnection = 'read') + public function getByProjectId($value, $limit = null, $useConnection = 'read') { if (is_null($value)) { throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } + $add = ''; - $query = 'SELECT * FROM `build` WHERE `project_id` = :project_id LIMIT :limit'; + if ($limit) { + $add .= ' LIMIT ' . $limit; + } + + + $query = 'SELECT * FROM `build` WHERE `project_id` = :project_id' . $add; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':project_id', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); if ($stmt->execute()) { $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); @@ -77,27 +71,29 @@ class BuildStoreBase extends Store $count = count($rtn); + return array('items' => $rtn, 'count' => $count); } else { return array('items' => array(), 'count' => 0); } } - /** - * Get multiple Build by Status. - * @return array - */ - public function getByStatus($value, $limit = 1000, $useConnection = 'read') + public function getByStatus($value, $limit = null, $useConnection = 'read') { if (is_null($value)) { throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } + $add = ''; - $query = 'SELECT * FROM `build` WHERE `status` = :status LIMIT :limit'; + if ($limit) { + $add .= ' LIMIT ' . $limit; + } + + + $query = 'SELECT * FROM `build` WHERE `status` = :status' . $add; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':status', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); if ($stmt->execute()) { $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); @@ -109,6 +105,7 @@ class BuildStoreBase extends Store $count = count($rtn); + return array('items' => $rtn, 'count' => $count); } else { return array('items' => array(), 'count' => 0); diff --git a/PHPCI/Store/Base/ProjectGroupStoreBase.php b/PHPCI/Store/Base/ProjectGroupStoreBase.php deleted file mode 100644 index c7cd8772..00000000 --- a/PHPCI/Store/Base/ProjectGroupStoreBase.php +++ /dev/null @@ -1,53 +0,0 @@ -getById($value, $useConnection); - } - - /** - * Get a single ProjectGroup by Id. - * @return null|ProjectGroup - */ - public function getById($value, $useConnection = 'read') - { - if (is_null($value)) { - throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); - } - - $query = 'SELECT * FROM `project_group` WHERE `id` = :id LIMIT 1'; - $stmt = Database::getConnection($useConnection)->prepare($query); - $stmt->bindValue(':id', $value); - - if ($stmt->execute()) { - if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) { - return new ProjectGroup($data); - } - } - - return null; - } -} diff --git a/PHPCI/Store/Base/ProjectStoreBase.php b/PHPCI/Store/Base/ProjectStoreBase.php index 1e2bf65b..dda946a5 100644 --- a/PHPCI/Store/Base/ProjectStoreBase.php +++ b/PHPCI/Store/Base/ProjectStoreBase.php @@ -20,18 +20,11 @@ class ProjectStoreBase extends Store protected $modelName = '\PHPCI\Model\Project'; protected $primaryKey = 'id'; - /** - * Get a Project by primary key (Id) - */ public function getByPrimaryKey($value, $useConnection = 'read') { return $this->getById($value, $useConnection); } - /** - * Get a single Project by Id. - * @return null|Project - */ public function getById($value, $useConnection = 'read') { if (is_null($value)) { @@ -51,21 +44,22 @@ class ProjectStoreBase extends Store return null; } - /** - * Get multiple Project by Title. - * @return array - */ - public function getByTitle($value, $limit = 1000, $useConnection = 'read') + public function getByTitle($value, $limit = null, $useConnection = 'read') { if (is_null($value)) { throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } + $add = ''; - $query = 'SELECT * FROM `project` WHERE `title` = :title LIMIT :limit'; + if ($limit) { + $add .= ' LIMIT ' . $limit; + } + + + $query = 'SELECT * FROM `project` WHERE `title` = :title' . $add; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':title', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); if ($stmt->execute()) { $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); @@ -77,37 +71,6 @@ class ProjectStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); - } else { - return array('items' => array(), 'count' => 0); - } - } - - /** - * Get multiple Project by GroupId. - * @return array - */ - public function getByGroupId($value, $limit = 1000, $useConnection = 'read') - { - if (is_null($value)) { - throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); - } - - - $query = 'SELECT * FROM `project` WHERE `group_id` = :group_id LIMIT :limit'; - $stmt = Database::getConnection($useConnection)->prepare($query); - $stmt->bindValue(':group_id', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); - - if ($stmt->execute()) { - $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - $map = function ($item) { - return new Project($item); - }; - $rtn = array_map($map, $res); - - $count = count($rtn); return array('items' => $rtn, 'count' => $count); } else { diff --git a/PHPCI/Store/Base/UserStoreBase.php b/PHPCI/Store/Base/UserStoreBase.php index 105ccd3e..fd903d8e 100644 --- a/PHPCI/Store/Base/UserStoreBase.php +++ b/PHPCI/Store/Base/UserStoreBase.php @@ -20,18 +20,11 @@ class UserStoreBase extends Store protected $modelName = '\PHPCI\Model\User'; protected $primaryKey = 'id'; - /** - * Get a User by primary key (Id) - */ public function getByPrimaryKey($value, $useConnection = 'read') { return $this->getById($value, $useConnection); } - /** - * Get a single User by Id. - * @return null|User - */ public function getById($value, $useConnection = 'read') { if (is_null($value)) { @@ -51,10 +44,6 @@ class UserStoreBase extends Store return null; } - /** - * Get a single User by Email. - * @return null|User - */ public function getByEmail($value, $useConnection = 'read') { if (is_null($value)) { @@ -73,36 +62,4 @@ class UserStoreBase extends Store return null; } - - /** - * Get multiple User by Name. - * @return array - */ - public function getByName($value, $limit = 1000, $useConnection = 'read') - { - if (is_null($value)) { - throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); - } - - - $query = 'SELECT * FROM `user` WHERE `name` = :name LIMIT :limit'; - $stmt = Database::getConnection($useConnection)->prepare($query); - $stmt->bindValue(':name', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); - - if ($stmt->execute()) { - $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - $map = function ($item) { - return new User($item); - }; - $rtn = array_map($map, $res); - - $count = count($rtn); - - return array('items' => $rtn, 'count' => $count); - } else { - return array('items' => array(), 'count' => 0); - } - } } diff --git a/PHPCI/Store/BuildErrorStore.php b/PHPCI/Store/BuildErrorStore.php deleted file mode 100644 index c2d32468..00000000 --- a/PHPCI/Store/BuildErrorStore.php +++ /dev/null @@ -1,80 +0,0 @@ - :since'; - } - - $query .= ' LIMIT 15000'; - - $stmt = Database::getConnection('read')->prepare($query); - - $stmt->bindValue(':build', $buildId, \PDO::PARAM_INT); - - if (!is_null($since)) { - $stmt->bindValue(':since', $since); - } - - if ($stmt->execute()) { - $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - $map = function ($item) { - return new BuildError($item); - }; - $rtn = array_map($map, $res); - - return $rtn; - } else { - return array(); - } - } - - /** - * Gets the total number of errors for a given build. - * @param $buildId - * @param string $since date string - * @return array - */ - public function getErrorTotalForBuild($buildId) - { - $query = 'SELECT COUNT(*) AS total FROM build_error - WHERE build_id = :build'; - - $stmt = Database::getConnection('read')->prepare($query); - - $stmt->bindValue(':build', $buildId, \PDO::PARAM_INT); - - if ($stmt->execute()) { - $res = $stmt->fetch(\PDO::FETCH_ASSOC); - return $res['total']; - } else { - return array(); - } - } -} diff --git a/PHPCI/Store/BuildMetaStore.php b/PHPCI/Store/BuildMetaStore.php index f932bc11..9800dcad 100644 --- a/PHPCI/Store/BuildMetaStore.php +++ b/PHPCI/Store/BuildMetaStore.php @@ -10,8 +10,6 @@ namespace PHPCI\Store; use PHPCI\Store\Base\BuildMetaStoreBase; -use b8\Database; -use PHPCI\Model\BuildMeta; /** * BuildMeta Store @@ -19,33 +17,5 @@ use PHPCI\Model\BuildMeta; */ class BuildMetaStore extends BuildMetaStoreBase { - /** - * Only used by an upgrade migration to move errors from build_meta to build_error - * @param $start - * @param $limit - * @return array - */ - public function getErrorsForUpgrade($limit) - { - $query = 'SELECT * FROM build_meta - WHERE meta_key IN (\'phpmd-data\', \'phpcs-data\', \'phpdoccheck-data\') - ORDER BY id ASC LIMIT :limit'; - - $stmt = Database::getConnection('read')->prepare($query); - - $stmt->bindValue(':limit', $limit, \PDO::PARAM_INT); - - if ($stmt->execute()) { - $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - $map = function ($item) { - return new BuildMeta($item); - }; - $rtn = array_map($map, $res); - - return $rtn; - } else { - return array(); - } - } + // This class has been left blank so that you can modify it - changes in this file will not be overwritten. } diff --git a/PHPCI/Store/BuildStore.php b/PHPCI/Store/BuildStore.php index d6feb084..b28142a7 100644 --- a/PHPCI/Store/BuildStore.php +++ b/PHPCI/Store/BuildStore.php @@ -10,6 +10,7 @@ namespace PHPCI\Store; use b8\Database; +use PHPCI\BuildFactory; use PHPCI\Model\Build; use PHPCI\Store\Base\BuildStoreBase; @@ -21,20 +22,15 @@ use PHPCI\Store\Base\BuildStoreBase; */ class BuildStore extends BuildStoreBase { - /** - * Return an array of the latest builds for a given project. - * @param null $projectId - * @param int $limit - * @return array - */ public function getLatestBuilds($projectId = null, $limit = 5) { + $where = ''; + if (!is_null($projectId)) { - $query = 'SELECT * FROM build WHERE `project_id` = :pid ORDER BY id DESC LIMIT :limit'; - } else { - $query = 'SELECT * FROM build ORDER BY id DESC LIMIT :limit'; + $where = ' WHERE `project_id` = :pid '; } + $query = 'SELECT * FROM build '.$where.' ORDER BY id DESC LIMIT :limit'; $stmt = Database::getConnection('read')->prepare($query); if (!is_null($projectId)) { @@ -57,12 +53,6 @@ class BuildStore extends BuildStoreBase } } - /** - * Return the latest build for a specific project, of a specific build status. - * @param null $projectId - * @param int $status - * @return array|Build - */ public function getLastBuildByStatus($projectId = null, $status = Build::STATUS_SUCCESS) { $query = 'SELECT * FROM build WHERE project_id = :pid AND status = :status ORDER BY id DESC LIMIT 1'; @@ -71,20 +61,13 @@ class BuildStore extends BuildStoreBase $stmt->bindValue(':status', $status); if ($stmt->execute()) { - if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) { - return new Build($data); - } + $res = $stmt->fetch(\PDO::FETCH_ASSOC); + return new Build($res); } else { return array(); } } - /** - * Return an array of builds for a given project and commit ID. - * @param $projectId - * @param $commitId - * @return array - */ public function getByProjectAndCommit($projectId, $commitId) { $query = 'SELECT * FROM `build` WHERE `project_id` = :project_id AND `commit_id` = :commit_id'; @@ -107,58 +90,12 @@ class BuildStore extends BuildStoreBase } } - /** - * Returns all registered branches for project - * - * @param $projectId - * @return array - * @throws \Exception - */ - public function getBuildBranches($projectId) + public function getMeta($key, $projectId, $buildId = null, $numResults = 1) { - $query = 'SELECT DISTINCT `branch` FROM `build` WHERE `project_id` = :project_id'; - $stmt = Database::getConnection('read')->prepare($query); - $stmt->bindValue(':project_id', $projectId); - - if ($stmt->execute()) { - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return $res; - } else { - return array(); - } - } - - /** - * Return build metadata by key, project and optionally build id. - * @param $key - * @param $projectId - * @param null $buildId - * @param null $branch - * @param int $numResults - * @return array|null - */ - public function getMeta($key, $projectId, $buildId = null, $branch = null, $numResults = 1) - { - $query = 'SELECT bm.build_id, bm.meta_key, bm.meta_value - FROM build_meta AS bm - LEFT JOIN build b ON b.id = bm.build_id - WHERE bm.meta_key = :key - AND bm.project_id = :projectId'; - - // If we're getting comparative meta data, include previous builds - // otherwise just include the specified build ID: - if ($numResults > 1) { - $query .= ' AND bm.build_id <= :buildId '; - } else { - $query .= ' AND bm.build_id = :buildId '; - } - - // Include specific branch information if required: - if (!is_null($branch)) { - $query .= ' AND b.branch = :branch '; - } - - $query .= ' ORDER BY bm.id DESC LIMIT :numResults'; + $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'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bindValue(':key', $key, \PDO::PARAM_STR); @@ -166,10 +103,6 @@ class BuildStore extends BuildStoreBase $stmt->bindValue(':buildId', (int)$buildId, \PDO::PARAM_INT); $stmt->bindValue(':numResults', (int)$numResults, \PDO::PARAM_INT); - if (!is_null($branch)) { - $stmt->bindValue(':branch', $branch, \PDO::PARAM_STR); - } - if ($stmt->execute()) { $rtn = $stmt->fetchAll(\PDO::FETCH_ASSOC); @@ -184,19 +117,12 @@ class BuildStore extends BuildStoreBase } else { return $rtn; } + } else { return null; } } - /** - * Set a metadata value for a given project and build ID. - * @param $projectId - * @param $buildId - * @param $key - * @param $value - * @return bool - */ public function setMeta($projectId, $buildId, $key, $value) { $cols = '`project_id`, `build_id`, `meta_key`, `meta_value`'; diff --git a/PHPCI/Store/ProjectGroupStore.php b/PHPCI/Store/ProjectGroupStore.php deleted file mode 100644 index fa254e3e..00000000 --- a/PHPCI/Store/ProjectGroupStore.php +++ /dev/null @@ -1,18 +0,0 @@ - $rtn, 'count' => $count); - } else { - return array('items' => array(), 'count' => 0); - } - } - - /** - * Get multiple Project by GroupId. - * @param int $value - * @param int $limit - * @param string $useConnection - * @return array - * @throws \Exception - */ - public function getByGroupId($value, $limit = 1000, $useConnection = 'read') - { - if (is_null($value)) { - throw new \Exception('Value passed to ' . __FUNCTION__ . ' cannot be null.'); - } - - $query = 'SELECT * FROM `project` WHERE `group_id` = :group_id ORDER BY title LIMIT :limit'; - $stmt = Database::getConnection($useConnection)->prepare($query); - $stmt->bindValue(':group_id', $value); - $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); - - if ($stmt->execute()) { - $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - $map = function ($item) { - return new Project($item); - }; - $rtn = array_map($map, $res); - - $count = count($rtn); - return array('items' => $rtn, 'count' => $count); } else { return array('items' => array(), 'count' => 0); diff --git a/PHPCI/View/Build/errors.phtml b/PHPCI/View/Build/errors.phtml deleted file mode 100644 index 04ab9c25..00000000 --- a/PHPCI/View/Build/errors.phtml +++ /dev/null @@ -1,37 +0,0 @@ -getFileLinkTemplate(); - -/** @var \PHPCI\Model\BuildError $error */ -foreach ($errors as $error): - - $link = str_replace('{FILE}', $error->getFile(), $linkTemplate); - $link = str_replace('{LINE}', $error->getLineStart(), $link); - $link = str_replace('{LINE_END}', $error->getLineEnd(), $link); -?> - - - - - getSeverityString()); ?> - - - getPlugin()); ?> - getFile(); ?> - - - getLineStart() == $error->getLineEnd() || !$error->getLineEnd()) { - print $error->getLineStart(); - } else { - print $error->getLineStart() . ' - ' . $error->getLineEnd(); - } - ?> - - - getMessage(); ?> - - - - \ No newline at end of file diff --git a/PHPCI/View/Build/header-row.phtml b/PHPCI/View/Build/header-row.phtml index b0559da0..83bd4524 100644 --- a/PHPCI/View/Build/header-row.phtml +++ b/PHPCI/View/Build/header-row.phtml @@ -1,4 +1,3 @@ -
  • getCommitterEmail()): ?> @@ -11,11 +10,11 @@ getProject()->getTitle(); ?> getStatus() == \PHPCI\Model\Build::STATUS_NEW): ?> - getCreated()->format('H:i')); ?> + Created getCreated()->format('g:ia'); ?> getStatus() == \PHPCI\Model\Build::STATUS_RUNNING): ?> - getStarted()->format('H:i')); ?> + Started getStarted()->format('g:ia'); ?> -

    getBranch()); ?>

    +

    Branch: getBranch(); ?>

  • \ No newline at end of file diff --git a/PHPCI/View/Build/view.phtml b/PHPCI/View/Build/view.phtml index 61fafd33..a6ecc6db 100644 --- a/PHPCI/View/Build/view.phtml +++ b/PHPCI/View/Build/view.phtml @@ -1,161 +1,35 @@ - +
    -
    -
    -
    -
    -

    - Build Details -

    -
    - -
    - - - - - - - - - - - - - - - -
    Project - - - getProject()->getTitle(); ?> - -
    Branch - - getBranch(); ?> - -
    Duration - -
    -
    -
    +
    +

    + Committed by getCommitterEmail(); ?> + +

    -
    -
    -
    -

    - Commit Details -

    -
    +
    + -
    - - - - - +
    + getCommitMessage()): ?> +
    + getCommitMessage(); ?> +
    + -
    - - - + Branch: getBranch(); ?> - - - -
    Commit - - getCommitId(), 0, 7); ?> - -
    Committer - getCommitterEmail(); ?> -
    - getCommitMessage(); ?> -
    -
    + getCommitId() != 'Manual'): ?> +
    Commit ID: getCommitId(); ?>
    +
    - -
    -
    -
    -

    - Timing -

    -
    - -
    - - - - - - - - - - - - - - - -
    Created -
    Started -
    Finished - -
    -
    -
    -
    -
    -