Lots of cleanup.
This commit is contained in:
parent
5ca9d4606e
commit
c20ca7c8ff
|
@ -14,7 +14,6 @@ use b8\Exception\HttpException;
|
||||||
use b8\Http\Response;
|
use b8\Http\Response;
|
||||||
use b8\Http\Response\RedirectResponse;
|
use b8\Http\Response\RedirectResponse;
|
||||||
use b8\View;
|
use b8\View;
|
||||||
use PHPCI\Model\Build;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI Front Controller
|
* PHPCI Front Controller
|
||||||
|
@ -58,7 +57,7 @@ class Application extends b8\Application
|
||||||
$routeHandler = function (&$route, Response &$response) use (&$request, $validateSession, $skipAuth) {
|
$routeHandler = function (&$route, Response &$response) use (&$request, $validateSession, $skipAuth) {
|
||||||
$skipValidation = in_array($route['controller'], array('session', 'webhook', 'build-status'));
|
$skipValidation = in_array($route['controller'], array('session', 'webhook', 'build-status'));
|
||||||
|
|
||||||
if (!$skipValidation && !$validateSession() && !$skipAuth()) {
|
if (!$skipValidation && !$validateSession() && (!is_callable($skipAuth) || !$skipAuth())) {
|
||||||
if ($request->isAjax()) {
|
if ($request->isAjax()) {
|
||||||
$response->setResponseCode(401);
|
$response->setResponseCode(401);
|
||||||
$response->setContent('');
|
$response->setContent('');
|
||||||
|
|
|
@ -12,12 +12,9 @@ namespace PHPCI\Command;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use PHPCI\Service\UserService;
|
use PHPCI\Service\UserService;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use b8\Store\Factory;
|
use b8\Store\Factory;
|
||||||
use PHPCI\Builder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create admin command - creates an admin user
|
* Create admin command - creates an admin user
|
||||||
|
@ -77,7 +74,7 @@ class CreateAdminCommand extends Command
|
||||||
|
|
||||||
if (!$emptyOk && empty($rtn)) {
|
if (!$emptyOk && empty($rtn)) {
|
||||||
$rtn = $this->ask($question, $emptyOk, $validationFilter);
|
$rtn = $this->ask($question, $emptyOk, $validationFilter);
|
||||||
} elseif ($validationFilter != null && ! empty($rtn)) {
|
} elseif (!is_null($validationFilter) && ! empty($rtn)) {
|
||||||
if (! $this -> controlFormat($rtn, $validationFilter, $statusMessage)) {
|
if (! $this -> controlFormat($rtn, $validationFilter, $statusMessage)) {
|
||||||
print $statusMessage;
|
print $statusMessage;
|
||||||
$rtn = $this->ask($question, $emptyOk, $validationFilter);
|
$rtn = $this->ask($question, $emptyOk, $validationFilter);
|
||||||
|
|
|
@ -12,13 +12,8 @@ namespace PHPCI\Command;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputDefinition;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use b8\Store\Factory;
|
|
||||||
use PHPCI\Builder;
|
|
||||||
use PHPCI\BuildFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Daemon that loops and call the run-command.
|
* Daemon that loops and call the run-command.
|
||||||
|
|
|
@ -12,9 +12,7 @@ namespace PHPCI\Command;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +74,7 @@ class DaemoniseCommand extends Command
|
||||||
$this->sleep = 0;
|
$this->sleep = 0;
|
||||||
$runner = new RunCommand($this->logger);
|
$runner = new RunCommand($this->logger);
|
||||||
$runner->setMaxBuilds(1);
|
$runner->setMaxBuilds(1);
|
||||||
$runner->setIsDaemon(true);
|
$runner->setDaemon(true);
|
||||||
|
|
||||||
$emptyInput = new ArgvInput(array());
|
$emptyInput = new ArgvInput(array());
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,7 @@
|
||||||
namespace PHPCI\Command;
|
namespace PHPCI\Command;
|
||||||
|
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use b8\Database;
|
use b8\Database;
|
||||||
use b8\Database\CodeGenerator;
|
use b8\Database\CodeGenerator;
|
||||||
|
|
|
@ -17,11 +17,9 @@ use b8\Database;
|
||||||
use b8\Store\Factory;
|
use b8\Store\Factory;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Helper\DialogHelper;
|
|
||||||
use PHPCI\Service\UserService;
|
use PHPCI\Service\UserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,6 +296,8 @@ class InstallCommand extends Command
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
unset($pdo);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
|
|
|
@ -14,9 +14,7 @@ use b8\HttpClient;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Yaml\Parser;
|
use Symfony\Component\Yaml\Parser;
|
||||||
use PHPCI\Model\Build;
|
use PHPCI\Model\Build;
|
||||||
|
|
|
@ -15,11 +15,8 @@ use PHPCI\Helper\Lang;
|
||||||
use PHPCI\Logging\BuildDBLogHandler;
|
use PHPCI\Logging\BuildDBLogHandler;
|
||||||
use PHPCI\Logging\LoggedBuildContextTidier;
|
use PHPCI\Logging\LoggedBuildContextTidier;
|
||||||
use PHPCI\Logging\OutputLogHandler;
|
use PHPCI\Logging\OutputLogHandler;
|
||||||
use Psr\Log\LoggerAwareInterface;
|
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use b8\Store\Factory;
|
use b8\Store\Factory;
|
||||||
use PHPCI\Builder;
|
use PHPCI\Builder;
|
||||||
|
@ -143,7 +140,7 @@ class RunCommand extends Command
|
||||||
$this->maxBuilds = (int)$numBuilds;
|
$this->maxBuilds = (int)$numBuilds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setIsDaemon($fromDaemon)
|
public function setDaemon($fromDaemon)
|
||||||
{
|
{
|
||||||
$this->isFromDaemon = (bool)$fromDaemon;
|
$this->isFromDaemon = (bool)$fromDaemon;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,7 @@ namespace PHPCI\Command;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use Symfony\Component\Console\Command\Command;
|
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\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,6 @@ namespace PHPCI\Controller;
|
||||||
|
|
||||||
use b8;
|
use b8;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use PHPCI\Model\Build;
|
|
||||||
use PHPCI\Plugin\Util\ComposerPluginInformation;
|
use PHPCI\Plugin\Util\ComposerPluginInformation;
|
||||||
use PHPCI\Plugin\Util\FilesPluginInformation;
|
use PHPCI\Plugin\Util\FilesPluginInformation;
|
||||||
use PHPCI\Plugin\Util\PluginInformationCollection;
|
use PHPCI\Plugin\Util\PluginInformationCollection;
|
||||||
|
|
|
@ -10,17 +10,14 @@
|
||||||
namespace PHPCI\Controller;
|
namespace PHPCI\Controller;
|
||||||
|
|
||||||
use b8;
|
use b8;
|
||||||
use b8\Controller;
|
|
||||||
use b8\Form;
|
use b8\Form;
|
||||||
use b8\Exception\HttpException\ForbiddenException;
|
|
||||||
use b8\Exception\HttpException\NotFoundException;
|
use b8\Exception\HttpException\NotFoundException;
|
||||||
use b8\Store;
|
use b8\Store;
|
||||||
|
use PHPCI;
|
||||||
use PHPCI\BuildFactory;
|
use PHPCI\BuildFactory;
|
||||||
use PHPCI\Helper\Github;
|
use PHPCI\Helper\Github;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use PHPCI\Helper\SshKey;
|
use PHPCI\Helper\SshKey;
|
||||||
use PHPCI\Model\Build;
|
|
||||||
use PHPCI\Model\Project;
|
|
||||||
use PHPCI\Service\BuildService;
|
use PHPCI\Service\BuildService;
|
||||||
use PHPCI\Service\ProjectService;
|
use PHPCI\Service\ProjectService;
|
||||||
|
|
||||||
|
@ -30,7 +27,7 @@ use PHPCI\Service\ProjectService;
|
||||||
* @package PHPCI
|
* @package PHPCI
|
||||||
* @subpackage Web
|
* @subpackage Web
|
||||||
*/
|
*/
|
||||||
class ProjectController extends \PHPCI\Controller
|
class ProjectController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \PHPCI\Store\ProjectStore
|
* @var \PHPCI\Store\ProjectStore
|
||||||
|
|
|
@ -14,7 +14,6 @@ use b8\Form;
|
||||||
use b8\HttpClient;
|
use b8\HttpClient;
|
||||||
use PHPCI\Controller;
|
use PHPCI\Controller;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use PHPCI\Model\Build;
|
|
||||||
use Symfony\Component\Yaml\Dumper;
|
use Symfony\Component\Yaml\Dumper;
|
||||||
use Symfony\Component\Yaml\Parser;
|
use Symfony\Component\Yaml\Parser;
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,10 @@
|
||||||
namespace PHPCI\Controller;
|
namespace PHPCI\Controller;
|
||||||
|
|
||||||
use b8;
|
use b8;
|
||||||
use b8\Exception\HttpException\ForbiddenException;
|
|
||||||
use b8\Exception\HttpException\NotFoundException;
|
use b8\Exception\HttpException\NotFoundException;
|
||||||
use b8\Form;
|
use b8\Form;
|
||||||
use PHPCI\Controller;
|
use PHPCI\Controller;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use PHPCI\Model\User;
|
|
||||||
use PHPCI\Service\UserService;
|
use PHPCI\Service\UserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace PHPCI\Controller;
|
||||||
use b8;
|
use b8;
|
||||||
use b8\Store;
|
use b8\Store;
|
||||||
use PHPCI\BuildFactory;
|
use PHPCI\BuildFactory;
|
||||||
use PHPCI\Model\Build;
|
|
||||||
use PHPCI\Service\BuildService;
|
use PHPCI\Service\BuildService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -90,7 +90,7 @@ class Email
|
||||||
* @param bool $isHtml
|
* @param bool $isHtml
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setIsHtml($isHtml = false)
|
public function setHtml($isHtml = false)
|
||||||
{
|
{
|
||||||
$this->isHtml = $isHtml;
|
$this->isHtml = $isHtml;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
namespace PHPCI;
|
namespace PHPCI;
|
||||||
|
|
||||||
use PHPCI\Model\Build;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI Plugin Interface - Used by all build plugins.
|
* PHPCI Plugin Interface - Used by all build plugins.
|
||||||
* @author Dan Cryer <dan@block8.co.uk>
|
* @author Dan Cryer <dan@block8.co.uk>
|
||||||
|
|
|
@ -148,7 +148,6 @@ class Campfire implements \PHPCI\Plugin
|
||||||
return json_decode($output);
|
return json_decode($output);
|
||||||
}
|
}
|
||||||
// Simple 200 OK response (such as for joining a room)
|
// Simple 200 OK response (such as for joining a room)
|
||||||
// TODO: check for other result codes here
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ class CopyBuild implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
protected function wipeExistingDirectory()
|
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*"';
|
$cmd = 'rm -Rf "%s*"';
|
||||||
$success = $this->phpci->executeCommand($cmd, $this->directory);
|
$success = $this->phpci->executeCommand($cmd, $this->directory);
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,9 @@ use PHPCI\Model\Build;
|
||||||
*/
|
*/
|
||||||
class HipchatNotify implements \PHPCI\Plugin
|
class HipchatNotify implements \PHPCI\Plugin
|
||||||
{
|
{
|
||||||
private $authToken;
|
protected $authToken;
|
||||||
private $userAgent;
|
protected $color;
|
||||||
private $cookie;
|
protected $notify;
|
||||||
private $color;
|
|
||||||
private $notify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the plugin, configure options, etc.
|
* Set up the plugin, configure options, etc.
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Util;
|
namespace PHPCI\Plugin\Util;
|
||||||
|
|
||||||
|
use PHPCI\Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ComposerPluginInformation
|
* Class ComposerPluginInformation
|
||||||
* @package PHPCI\Plugin\Util
|
* @package PHPCI\Plugin\Util
|
||||||
|
@ -63,7 +65,7 @@ class ComposerPluginInformation implements InstalledPluginInformation
|
||||||
public function getPluginClasses()
|
public function getPluginClasses()
|
||||||
{
|
{
|
||||||
return array_map(
|
return array_map(
|
||||||
function ($plugin) {
|
function (Plugin $plugin) {
|
||||||
return $plugin->class;
|
return $plugin->class;
|
||||||
},
|
},
|
||||||
$this->getInstalledPlugins()
|
$this->getInstalledPlugins()
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Util;
|
namespace PHPCI\Plugin\Util;
|
||||||
|
|
||||||
|
use PHPCI\Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class FilesPluginInformation
|
* Class FilesPluginInformation
|
||||||
* @package PHPCI\Plugin\Util
|
* @package PHPCI\Plugin\Util
|
||||||
|
@ -66,7 +68,7 @@ class FilesPluginInformation implements InstalledPluginInformation
|
||||||
public function getPluginClasses()
|
public function getPluginClasses()
|
||||||
{
|
{
|
||||||
return array_map(
|
return array_map(
|
||||||
function ($plugin) {
|
function (Plugin $plugin) {
|
||||||
return $plugin->class;
|
return $plugin->class;
|
||||||
},
|
},
|
||||||
$this->getInstalledPlugins()
|
$this->getInstalledPlugins()
|
||||||
|
@ -114,8 +116,6 @@ class FilesPluginInformation implements InstalledPluginInformation
|
||||||
*/
|
*/
|
||||||
protected function getFullClassFromFile(\SplFileInfo $fileInfo)
|
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());
|
$contents = file_get_contents($fileInfo->getRealPath());
|
||||||
$matches = array();
|
$matches = array();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
namespace PHPCI\Store;
|
namespace PHPCI\Store;
|
||||||
|
|
||||||
use b8\Database;
|
use b8\Database;
|
||||||
use PHPCI\BuildFactory;
|
|
||||||
use PHPCI\Model\Build;
|
use PHPCI\Model\Build;
|
||||||
use PHPCI\Store\Base\BuildStoreBase;
|
use PHPCI\Store\Base\BuildStoreBase;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue