Commit 193bb2e9 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes #7494: Exception 'General Error': disable/enable per config.

parent bb32a6a3
Pipeline #1147 passed with stage
in 1 minute and 58 seconds
......@@ -358,6 +358,8 @@ Extension Manager: QFQ Configuration
| documentation | http://docs.typo3.org... | Link to the online documentation of QFQ. Every QFQ installation also |
| | | contains a local copy: typo3conf/ext/qfq/Documentation/html/Manual.html |
+-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| flagProduction | yes | yes|no: might be used to differentiate the installation |
+-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| thumbnailDirSecure | fileadmin/protected/qfqThumbnail | Important: secure directory 'protected' (recursive) against direct access. |
+-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| thumbnailDirPublic | typo3temp/qfqThumbnail | Both thumbnail directories will be created if not existing. |
......@@ -384,6 +386,10 @@ Extension Manager: QFQ Configuration
+-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| Debug |
+-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| throwExceptionGeneralError | auto | | *yes*: 'general errors' in QFQ (PHP) will throw an exception. |
| | | | *auto*: becomes 'yes', if 'flagProduction'!='yes', else 'no'. |
| | | | *no*: 'general errors' in QFQ (PHP) will be silently ignored. |
+-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| sqlLogMode | modify | | *all*: every statement will be logged - this might a lot. |
| | | | *modify*: log only statements who change data. *error*: log only |
| | | DB errors. |
......
......@@ -32,6 +32,11 @@ Notes
* Existing installations: update QFQ extension config form-layout.formBsColumns/formBsLabelColumns/formBsInputColumns,formBsNoteColumns.
old: 12, new: 'col-md-12 col-lg10' resp. smaller values for individual columnns.
* New config values:
* Config/flagProduction: yes/now - differentiate between development und production system. Will be used for
'throwExceptionGeneralError' too.
* Debug/throwExceptionGeneralError - shows/hide exception of general errors.
Features
^^^^^^^^
......
# cat=config/config; type=string; label=URL QFQ Documentation:Default is 'https://docs.typo3.org/typo3cms/drafts/github/T3DocumentationStarter/Public-Info-053/Manual.html'. Might be changed to a local repo. Every QFQ installation contains a local copy: <site path>/typo3conf/ext/qfq/Documentation/html/Manual.html (corresponds always to the QFQ version).
documentation = https://docs.typo3.org/typo3cms/drafts/github/T3DocumentationStarter/Public-Info-053/Manual.html
# cat=config/config; type=string; label=Marks a production installation:Possible values: 'yes', 'no'. Default is 'yes'. Used to differentiate between development & production systems.
flagProduction = yes
# cat=config/config; type=string; label=Thumbnail directory 'secure':Default is 'fileadmin/protected/qfqThumbnail'. Important: secure the directory (recursive) against direct access. Will be used by a special columnname '_thumbnail'.
thumbnailDirSecure = fileadmin/protected/qfqThumbnail
......@@ -45,6 +48,10 @@ fillStoreSystemBySql3 =
fillStoreSystemBySqlErrorMsg3 =
# cat=debug/debug; type=string; label=Throw exception General Error:Possible values: 'yes', 'no', 'auto'. Default is 'auto'. If a) 'yes' or b) 'auto' and 'flagProduction!=yes', throw an exception in case of a 'General Error'.
throwExceptionGeneralError = auto
# cat=debug/mail; type=string; label=Redirect all mail to ...:Default is empty. If set, redirect all QFQ generated mails (Form, Report) to the specified email address.
redirectAllMailTo =
......
......@@ -454,6 +454,9 @@ const SYSTEM_REDIRECT_ALL_MAIL_TO = 'redirectAllMailTo';
const SYSTEM_MAIL_LOG = 'mailLog';
const SYSTEM_MAIL_LOG_FILE = 'fileadmin/protected/log/mail.log';
const SYSTEM_THROW_GENERAL_ERROR = 'throwExceptionGeneralError';
const SYSTEM_FLAG_PRODUCTION = 'flagProduction';
const SYSTEM_SHOW_DEBUG_INFO = 'showDebugInfo';
const SYSTEM_SHOW_DEBUG_INFO_YES = 'yes';
const SYSTEM_SHOW_DEBUG_INFO_NO = 'no';
......
......@@ -8,6 +8,7 @@
namespace qfq;
require_once(__DIR__ . '/../store/Store.php');
/**
* Class ErrorHandler
......@@ -23,6 +24,8 @@ class ErrorHandler {
* @param $line
* @return bool|string
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
public static function exception_error_handler($severity, $message, $file, $line) {
......@@ -31,11 +34,18 @@ class ErrorHandler {
return false;
}
// Do not show too much to the user. E.g. 'ldap_bind()' might have problems, but the user should not see the
// file and line number. Often the filename is part of the message >> don't show the message to the user.
throw new CodeException(json_encode(
[ERROR_MESSAGE_TO_USER => 'General error - please report.',
ERROR_MESSAGE_SUPPORT => "File: $file / Line: $line / $message"]), $severity, null);
$store = Store::getInstance();
if($store->getVar(SYSTEM_THROW_GENERAL_ERROR, STORE_SYSTEM) == 'yes'){
// Do not show too much to the user. E.g. 'ldap_bind()' might have problems, but the user should not see the
// file and line number. Often the filename is part of the message >> don't show the message to the user.
throw new CodeException(json_encode(
[ERROR_MESSAGE_TO_USER => 'General error - please report.',
ERROR_MESSAGE_SUPPORT => "File: $file / Line: $line / $message"]), $severity, null);
}
return true;
}
}
\ No newline at end of file
......@@ -351,6 +351,9 @@ class Config {
F_FE_DATA_REQUIRED_ERROR => F_FE_DATA_REQUIRED_ERROR_DEFAULT,
F_FE_DATA_MATCH_ERROR => F_FE_DATA_MATCH_ERROR_DEFAULT,
F_FE_DATA_ERROR => 'error',
SYSTEM_FLAG_PRODUCTION => 'yes',
SYSTEM_THROW_GENERAL_ERROR => 'auto',
];
// To let run legacy code
......
......@@ -300,6 +300,10 @@ class Store {
$config[SYSTEM_DB_1_NAME] = $config[SYSTEM_DB_NAME];
}
if ($config[SYSTEM_THROW_GENERAL_ERROR] == 'auto') {
$config[SYSTEM_THROW_GENERAL_ERROR] = $config[SYSTEM_FLAG_PRODUCTION] == 'yes' ? 'no' : 'yes';
}
return $config;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment