Added config params github.comments.(commit|pull_request) for allow or deny for PHP Censor to commenting on Github
This commit is contained in:
parent
d77f0e8474
commit
d209482cda
|
@ -13,6 +13,15 @@ php-censor:
|
||||||
url: 'http://php-censor.local'
|
url: 'http://php-censor.local'
|
||||||
email_settings:
|
email_settings:
|
||||||
from_address: 'no-reply@php-censor.local'
|
from_address: 'no-reply@php-censor.local'
|
||||||
|
smtp_address:
|
||||||
worker:
|
worker:
|
||||||
host: localhost
|
host: localhost
|
||||||
queue: php-censor-queue
|
queue: php-censor-queue
|
||||||
|
github:
|
||||||
|
token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
||||||
|
comments:
|
||||||
|
commit: false
|
||||||
|
pull_request: false
|
||||||
|
authentication_settings:
|
||||||
|
state: false
|
||||||
|
user_id: 1
|
|
@ -1,13 +1,18 @@
|
||||||
Configuring PHP Censor
|
Configuring PHP Censor
|
||||||
======================
|
======================
|
||||||
|
|
||||||
The PHP Censor configuration on the server is automatically generated into the `config.yml` file during installation. One might need to also edit the file manually.
|
The PHP Censor configuration on the server is automatically generated into the `config.yml` file during installation.
|
||||||
|
One might need to also edit the file manually.
|
||||||
|
|
||||||
For example, one could log into PHP Censor and go into the settings to disable it. But if you have already set up a username/password pair and have forgotten the password, and if the server is on a local network, and it's not sending the `forgot password` email, then editing the config file manually would be handy. To do so, just edit the `php-censor` section in the config file (which is in [yaml format](https://en.wikipedia.org/wiki/YAML)), and add
|
For example, one could log into PHP Censor and go into the settings to disable it. But if you have already set up a
|
||||||
|
username/password pair and have forgotten the password, and if the server is on a local network, and it's not sending
|
||||||
|
the `forgot password` email, then editing the config file manually would be handy. To do so, just edit the `php-censor`
|
||||||
|
section in the config file (which is in [yaml format](https://en.wikipedia.org/wiki/YAML)), and add
|
||||||
|
|
||||||
php-censor:
|
php-censor:
|
||||||
authentication_settings:
|
authentication_settings:
|
||||||
state: 1
|
state: 1
|
||||||
user_id: 1
|
user_id: 1
|
||||||
|
|
||||||
where you can get the user_id by logging into the mysql database and selecting your user ID from the `users` table in the PHP Censor database.
|
where you can get the user_id by logging into the mysql database and selecting your user ID from the `users` table in
|
||||||
|
the PHP Censor database.
|
||||||
|
|
|
@ -159,8 +159,8 @@ class Application extends b8\Application
|
||||||
protected function shouldSkipAuth()
|
protected function shouldSkipAuth()
|
||||||
{
|
{
|
||||||
$config = b8\Config::getInstance();
|
$config = b8\Config::getInstance();
|
||||||
$state = (bool)$config->get('php-censor.authentication_settings.state', false);
|
$state = (bool)$config->get('php-censor.authentication_settings.state', false);
|
||||||
$userId = $config->get('php-censor.authentication_settings.user_id', 0);
|
$userId = $config->get('php-censor.authentication_settings.user_id', 0);
|
||||||
|
|
||||||
if (false !== $state && 0 != (int)$userId) {
|
if (false !== $state && 0 != (int)$userId) {
|
||||||
$user = b8\Store\Factory::getStore('User')
|
$user = b8\Store\Factory::getStore('User')
|
||||||
|
|
|
@ -20,9 +20,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create build command - creates a build for a project
|
* Create build command - creates a build for a project
|
||||||
* @author Jérémy DECOOL (@jdecool)
|
*
|
||||||
* @package PHPCI
|
* @author Jérémy DECOOL (@jdecool)
|
||||||
* @subpackage Console
|
* @package PHPCI
|
||||||
|
* @subpackage Console
|
||||||
*/
|
*/
|
||||||
class CreateBuildCommand extends Command
|
class CreateBuildCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,9 +27,10 @@ use Symfony\Component\Yaml\Dumper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install console command - Installs PHPCI.
|
* Install console command - Installs PHPCI.
|
||||||
* @author Dan Cryer <dan@block8.co.uk>
|
*
|
||||||
* @package PHPCI
|
* @author Dan Cryer <dan@block8.co.uk>
|
||||||
* @subpackage Console
|
* @package PHPCI
|
||||||
|
* @subpackage Console
|
||||||
*/
|
*/
|
||||||
class InstallCommand extends Command
|
class InstallCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,11 +18,12 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-runs the last run build.
|
* Re-runs the last run build.
|
||||||
* @author Dan Cryer <dan@block8.co.uk>
|
*
|
||||||
* @package PHPCI
|
* @author Dan Cryer <dan@block8.co.uk>
|
||||||
* @subpackage Console
|
* @package PHPCI
|
||||||
*/
|
* @subpackage Console
|
||||||
|
*/
|
||||||
class RebuildCommand extends Command
|
class RebuildCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,10 +21,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Dan Cryer <dan@block8.co.uk>
|
* @author Dan Cryer <dan@block8.co.uk>
|
||||||
* @package PHPCI
|
* @package PHPCI
|
||||||
* @subpackage Console
|
* @subpackage Console
|
||||||
*/
|
*/
|
||||||
class RebuildQueueCommand extends Command
|
class RebuildQueueCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,11 +19,12 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Worker Command - Starts the BuildWorker, which pulls jobs from beanstalkd
|
* Worker Command - Starts the BuildWorker, which pulls jobs from beanstalkd
|
||||||
* @author Dan Cryer <dan@block8.co.uk>
|
*
|
||||||
* @package PHPCI
|
* @author Dan Cryer <dan@block8.co.uk>
|
||||||
* @subpackage Console
|
* @package PHPCI
|
||||||
*/
|
* @subpackage Console
|
||||||
|
*/
|
||||||
class WorkerCommand extends Command
|
class WorkerCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -211,10 +211,17 @@ class GithubBuild extends RemoteGitBuild
|
||||||
$prNumber = $this->getExtra('pull_request_number');
|
$prNumber = $this->getExtra('pull_request_number');
|
||||||
$commit = $this->getCommitId();
|
$commit = $this->getCommitId();
|
||||||
|
|
||||||
|
$allowCommentCommit = Config::getInstance()->get('php-censor.github.comments.commit');
|
||||||
|
$allowCommentPullRequest = Config::getInstance()->get('php-censor.github.comments.pull_request');
|
||||||
|
|
||||||
if (!empty($prNumber)) {
|
if (!empty($prNumber)) {
|
||||||
$helper->createPullRequestComment($repo, $prNumber, $commit, $file, $diffLineNumber, $message);
|
if ($allowCommentPullRequest) {
|
||||||
|
$helper->createPullRequestComment($repo, $prNumber, $commit, $file, $diffLineNumber, $message);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$helper->createCommitComment($repo, $commit, $file, $diffLineNumber, $message);
|
if ($allowCommentCommit) {
|
||||||
|
$helper->createCommitComment($repo, $commit, $file, $diffLineNumber, $message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue