catching permission error
This commit is contained in:
parent
2b9302f9fc
commit
8c127d692c
|
@ -53,9 +53,16 @@ class SettingsController extends Controller
|
|||
$this->settings['phpci']['github']['id'] = $this->getParam('githubid', '');
|
||||
$this->settings['phpci']['github']['secret'] = $this->getParam('githubsecret', '');
|
||||
|
||||
$this->storeSettings();
|
||||
$error = $this->storeSettings();
|
||||
|
||||
header('Location: ' . PHPCI_URL . 'settings?saved=1');
|
||||
if($error)
|
||||
{
|
||||
header('Location: ' . PHPCI_URL . 'settings?saved=2');
|
||||
}
|
||||
else
|
||||
{
|
||||
header('Location: ' . PHPCI_URL . 'settings?saved=1');
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
|
@ -94,6 +101,7 @@ class SettingsController extends Controller
|
|||
$dumper = new Dumper();
|
||||
$yaml = $dumper->dump($this->settings);
|
||||
file_put_contents(APPLICATION_PATH . 'PHPCI/config.yml', $yaml);
|
||||
if(error_get_last()) return error_get_last()['message'];
|
||||
}
|
||||
|
||||
protected function getGithubForm()
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
<?php if (isset($_GET['saved'])): ?>
|
||||
<?php if (isset($_GET['saved']) && $_GET['saved'] == 1): ?>
|
||||
<p class="alert alert-success" style="margin-bottom: 20px;">
|
||||
Your settings have been saved.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($_GET['saved']) && $_GET['saved'] == 2): ?>
|
||||
<p class="alert alert-danger" style="margin-bottom: 20px;">
|
||||
Your settings could not be saved, maybe check the permissions of config.yml?
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($_GET['linked']) && $_GET['linked'] == 1): ?>
|
||||
<p class="alert alert-success" style="margin-bottom: 20px;">
|
||||
Your Github account has been linked.
|
||||
|
|
Loading…
Reference in a new issue