Allow to disable stack traces globally

refs #9113
This commit is contained in:
Johannes Meyer 2015-08-24 14:44:54 +02:00
parent eb54c9875b
commit 0c47aececc
3 changed files with 22 additions and 1 deletions

View File

@ -25,6 +25,20 @@ class ApplicationConfigForm extends Form
*/ */
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement(
'checkbox',
'global_show_stacktraces',
array(
'required' => true,
'value' => true,
'label' => $this->translate('Show Stacktraces'),
'description' => $this->translate(
'Set whether to show an exception\'s stacktrace by default. This can also'
. ' be set in a user\'s preferences with the appropriate permission.'
)
)
);
$this->addElement( $this->addElement(
'text', 'text',
'global_module_path', 'global_module_path',

View File

@ -212,9 +212,12 @@ class Web extends EmbeddedWeb
$this->frontController = Zend_Controller_Front::getInstance(); $this->frontController = Zend_Controller_Front::getInstance();
$this->frontController->setRequest($this->getRequest()); $this->frontController->setRequest($this->getRequest());
$this->frontController->setControllerDirectory($this->getApplicationDir('/controllers')); $this->frontController->setControllerDirectory($this->getApplicationDir('/controllers'));
$displayExceptions = $this->config->get('global', 'show_stacktraces', true);
$this->frontController->setParams( $this->frontController->setParams(
array( array(
'displayExceptions' => true 'displayExceptions' => $displayExceptions
) )
); );
return $this; return $this;

View File

@ -53,6 +53,10 @@ class GeneralConfigStep extends Step
$generalHtml = '' $generalHtml = ''
. '<ul>' . '<ul>'
. '<li>' . ($this->data['generalConfig']['global_show_stacktraces']
? t('An exception\'s stacktrace is shown to every user by default.')
: t('An exception\'s stacktrace is hidden from every user by default.')
) . '</li>'
. '<li>' . sprintf( . '<li>' . sprintf(
$this->data['generalConfig']['global_config_backend'] === 'ini' ? sprintf( $this->data['generalConfig']['global_config_backend'] === 'ini' ? sprintf(
t('Preferences will be stored per user account in INI files at: %s'), t('Preferences will be stored per user account in INI files at: %s'),