Use the new view script to show INI configuration in case of failures

This commit is contained in:
Johannes Meyer 2014-09-09 09:46:57 +02:00
parent 6525d6933a
commit c947ba3b18
2 changed files with 4 additions and 35 deletions

View File

@ -96,7 +96,7 @@ class DashboardController extends ActionController
if ($this->writeConfiguration(new Zend_Config($dashboard->toArray()), $configFile)) { if ($this->writeConfiguration(new Zend_Config($dashboard->toArray()), $configFile)) {
$this->redirectNow(Url::fromPath('dashboard', array('pane' => $form->getValue('pane')))); $this->redirectNow(Url::fromPath('dashboard', array('pane' => $form->getValue('pane'))));
} else { } else {
$this->render('show-configuration'); $this->render('showConfiguration');
return; return;
} }
} }
@ -164,9 +164,9 @@ class DashboardController extends ActionController
$writer->write(); $writer->write();
} catch (Exception $e) { } catch (Exception $e) {
Logger::error(new ConfiguationError("Cannot write dashboard to $target", 0, $e)); Logger::error(new ConfiguationError("Cannot write dashboard to $target", 0, $e));
$this->view->iniConfigurationString = $writer->render(); $this->view->configString = $writer->render();
$this->view->exceptionMessage = $e->getMessage(); $this->view->errorMessage = $e->getMessage();
$this->view->file = $target; $this->view->filePath = $target;
return false; return false;
} }

View File

@ -1,31 +0,0 @@
<?= $this->tabs->render($this); ?>
<br/>
<div>
<h4><i>WARNING ICON</i>Saving "<?= $this->escape($this->file); ?>.ini" Failed</h4>
<br/>
<p>
Your <?= $this->escape($this->file); ?> configuration couldn't be stored (error: "<?= $this->exceptionMessage; ?>").<br/>
This could have one or more of the following reasons:
</p>
<ul>
<li>You don't have file-system permissions to write to the <?= $this->escape($this->file); ?>.ini file</li>
<li>Something went wrong while writing the file</li>
<li>There's an application error preventing you from persisting the configuration</li>
</ul>
</div>
<p>
Details can be seen in your application log (if you don't have access to this file, call your administrator in this case).
<br/>
In case you can access the configuration file (config/<?= $this->escape($this->file); ?>.ini) by yourself, you can open it and
insert the config manually:
</p>
<p>
<pre>
<code>
<?= $this->escape($this->iniConfigurationString); ?>
</code>
</pre>
</p>