Removing commented code from the installer
This commit is contained in:
parent
9849d31a0e
commit
2b791b1f3b
|
@ -103,18 +103,6 @@ class InstallCommand extends Command
|
|||
$this->writeConfigFile($conf);
|
||||
$this->setupDatabase($output);
|
||||
$this->createAdminUser($output, $dialog);
|
||||
|
||||
/*
|
||||
$conf['phpci']['email_settings']['smtp_address'] = $this->ask('(Optional) Smtp server address: ', true);
|
||||
$conf['phpci']['email_settings']['smtp_port'] = $this->ask('(Optional) Smtp port: ', true);
|
||||
$conf['phpci']['email_settings']['smtp_encryption'] = $this->ask('(Optional) Smtp encryption: ', true);
|
||||
$conf['phpci']['email_settings']['smtp_username'] = $this->ask('(Optional) Smtp Username: ', true);
|
||||
$conf['phpci']['email_settings']['smtp_password'] = $this->ask('(Optional) Smtp Password: ', true);
|
||||
$conf['phpci']['email_settings']['from_address'] = $this->ask('(Optional) Email address to send from: ', true);
|
||||
|
||||
$ask = '(Optional) Default address to email notifications to: ';
|
||||
$conf['phpci']['email_settings']['default_mailto_address'] = $this->ask($ask, true);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,15 @@ class SettingsController extends Controller
|
|||
public function index()
|
||||
{
|
||||
$this->view->settings = $this->settings;
|
||||
|
||||
$emailSettings = array();
|
||||
|
||||
if (isset($this->settings['phpci']['email_settings'])) {
|
||||
$emailSettings = $this->settings['phpci']['email_settings'];
|
||||
}
|
||||
|
||||
$this->view->github = $this->getGithubForm();
|
||||
$this->view->emailSettings = $this->getEmailForm($emailSettings);
|
||||
|
||||
if (!empty($this->settings['phpci']['github']['token'])) {
|
||||
$this->view->githubUser = $this->getGithubUser($this->settings['phpci']['github']['token']);
|
||||
|
@ -52,17 +60,28 @@ class SettingsController extends Controller
|
|||
{
|
||||
$this->settings['phpci']['github']['id'] = $this->getParam('githubid', '');
|
||||
$this->settings['phpci']['github']['secret'] = $this->getParam('githubsecret', '');
|
||||
|
||||
$error = $this->storeSettings();
|
||||
|
||||
if($error)
|
||||
{
|
||||
if($error) {
|
||||
header('Location: ' . PHPCI_URL . 'settings?saved=2');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
header('Location: ' . PHPCI_URL . 'settings?saved=1');
|
||||
}
|
||||
|
||||
die;
|
||||
}
|
||||
|
||||
public function email()
|
||||
{
|
||||
$this->settings['phpci']['email_settings'] = $this->getParams();
|
||||
$error = $this->storeSettings();
|
||||
|
||||
if ($error) {
|
||||
header('Location: ' . PHPCI_URL . 'settings?saved=2');
|
||||
} else {
|
||||
header('Location: ' . PHPCI_URL . 'settings?saved=1');
|
||||
}
|
||||
|
||||
die;
|
||||
}
|
||||
|
||||
|
@ -120,18 +139,23 @@ class SettingsController extends Controller
|
|||
$field->setLabel('Application ID');
|
||||
$field->setClass('form-control');
|
||||
$field->setContainerClass('form-group');
|
||||
$field->setValue($this->settings['phpci']['github']['id']);
|
||||
$form->addField($field);
|
||||
|
||||
if (isset($this->settings['phpci']['github']['id'])) {
|
||||
$field->setValue($this->settings['phpci']['github']['id']);
|
||||
}
|
||||
|
||||
$field = new Form\Element\Text('githubsecret');
|
||||
$field->setRequired(true);
|
||||
$field->setPattern('[a-zA-Z0-9]+');
|
||||
$field->setLabel('Application Secret');
|
||||
$field->setClass('form-control');
|
||||
$field->setContainerClass('form-group');
|
||||
$field->setValue($this->settings['phpci']['github']['secret']);
|
||||
$form->addField($field);
|
||||
|
||||
if (isset($this->settings['phpci']['github']['secret'])) {
|
||||
$field->setValue($this->settings['phpci']['github']['secret']);
|
||||
}
|
||||
|
||||
$field = new Form\Element\Submit();
|
||||
$field->setValue('Save »');
|
||||
|
@ -141,6 +165,76 @@ class SettingsController extends Controller
|
|||
return $form;
|
||||
}
|
||||
|
||||
protected function getEmailForm($values = array())
|
||||
{
|
||||
$form = new Form();
|
||||
$form->setMethod('POST');
|
||||
$form->setAction(PHPCI_URL . 'settings/email');
|
||||
$form->addField(new Form\Element\Csrf('csrf'));
|
||||
|
||||
$field = new Form\Element\Text('smtp_address');
|
||||
$field->setRequired(false);
|
||||
$field->setLabel('SMTP Server');
|
||||
$field->setClass('form-control');
|
||||
$field->setContainerClass('form-group');
|
||||
$field->setValue('localhost');
|
||||
$form->addField($field);
|
||||
|
||||
$field = new Form\Element\Text('smtp_port');
|
||||
$field->setRequired(false);
|
||||
$field->setPattern('[0-9]+');
|
||||
$field->setLabel('SMTP Port');
|
||||
$field->setClass('form-control');
|
||||
$field->setContainerClass('form-group');
|
||||
$field->setValue(25);
|
||||
$form->addField($field);
|
||||
|
||||
$field = new Form\Element\Text('smtp_username');
|
||||
$field->setRequired(false);
|
||||
$field->setLabel('SMTP Username');
|
||||
$field->setClass('form-control');
|
||||
$field->setContainerClass('form-group');
|
||||
$form->addField($field);
|
||||
|
||||
$field = new Form\Element\Text('smtp_password');
|
||||
$field->setRequired(false);
|
||||
$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('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('Default Notification Address');
|
||||
$field->setClass('form-control');
|
||||
$field->setContainerClass('form-group');
|
||||
$form->addField($field);
|
||||
|
||||
$field = new Form\Element\Checkbox('smtp_encryption');
|
||||
$field->setCheckedValue(1);
|
||||
$field->setRequired(false);
|
||||
$field->setLabel('Use SMTP encryption?');
|
||||
$field->setContainerClass('form-group');
|
||||
$field->setValue(1);
|
||||
$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');
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
<h3 class="title">Github Application</h3>
|
||||
|
||||
<?php
|
||||
$id = $settings['phpci']['github']['id'];
|
||||
$id = null;
|
||||
|
||||
if (isset($settings['phpci']['github']['id'])) {
|
||||
$id = $settings['phpci']['github']['id'];
|
||||
}
|
||||
|
||||
$returnTo = PHPCI_URL . 'settings/github-callback';
|
||||
$githubUri = 'https://github.com/login/oauth/authorize?client_id='.$id.'&scope=repo&redirect_uri=' . $returnTo;
|
||||
?>
|
||||
|
@ -66,3 +71,27 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="title">Email Settings</h3>
|
||||
|
||||
|
||||
<?php if (!isset($settings['phpci']['email_settings'])): ?>
|
||||
<p class="alert alert-warning clearfix">
|
||||
Before PHPCI can send build status emails, you need to configure your SMTP settings below.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-8">
|
||||
<?php print $emailSettings; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<!-- nothing -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in a new issue