Adding a warning that PHPCI can't save your settings if the config.yml file is not writeable, fixes #369

This commit is contained in:
Dan Cryer 2014-05-12 18:37:48 +01:00
parent b616dad9a5
commit b4c0783f4d
2 changed files with 12 additions and 0 deletions

View file

@ -48,6 +48,7 @@ class SettingsController extends Controller
$this->view->github = $this->getGithubForm();
$this->view->emailSettings = $this->getEmailForm($emailSettings);
$this->view->isWriteable = $this->canWriteConfig();
if (!empty($this->settings['phpci']['github']['token'])) {
$this->view->githubUser = $this->getGithubUser($this->settings['phpci']['github']['token']);
@ -242,4 +243,9 @@ class SettingsController extends Controller
return $user['body'];
}
protected function canWriteConfig()
{
return is_writeable(APPLICATION_PATH . 'PHPCI/config.yml');
}
}

View file

@ -10,6 +10,12 @@
</p>
<?php endif; ?>
<?php if (!$isWriteable): ?>
<p class="alert alert-danger" style="margin-bottom: 20px;">
PHPCI cannot write to your config.yml file, settings may not be saved properly until this is rectified.
</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.