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 ...@@ -358,6 +358,8 @@ Extension Manager: QFQ Configuration
| documentation | http://docs.typo3.org... | Link to the online documentation of QFQ. Every QFQ installation also | | 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 | | | | 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. | | thumbnailDirSecure | fileadmin/protected/qfqThumbnail | Important: secure directory 'protected' (recursive) against direct access. |
+-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+ +-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| thumbnailDirPublic | typo3temp/qfqThumbnail | Both thumbnail directories will be created if not existing. | | thumbnailDirPublic | typo3temp/qfqThumbnail | Both thumbnail directories will be created if not existing. |
...@@ -384,6 +386,10 @@ Extension Manager: QFQ Configuration ...@@ -384,6 +386,10 @@ Extension Manager: QFQ Configuration
+-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+ +-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| Debug | | 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. | | sqlLogMode | modify | | *all*: every statement will be logged - this might a lot. |
| | | | *modify*: log only statements who change data. *error*: log only | | | | | *modify*: log only statements who change data. *error*: log only |
| | | DB errors. | | | | DB errors. |
......
...@@ -32,6 +32,11 @@ Notes ...@@ -32,6 +32,11 @@ Notes
* Existing installations: update QFQ extension config form-layout.formBsColumns/formBsLabelColumns/formBsInputColumns,formBsNoteColumns. * 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. 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 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). # 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 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'. # 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 thumbnailDirSecure = fileadmin/protected/qfqThumbnail
...@@ -45,6 +48,10 @@ fillStoreSystemBySql3 = ...@@ -45,6 +48,10 @@ fillStoreSystemBySql3 =
fillStoreSystemBySqlErrorMsg3 = 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. # 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 = redirectAllMailTo =
......
...@@ -454,6 +454,9 @@ const SYSTEM_REDIRECT_ALL_MAIL_TO = 'redirectAllMailTo'; ...@@ -454,6 +454,9 @@ const SYSTEM_REDIRECT_ALL_MAIL_TO = 'redirectAllMailTo';
const SYSTEM_MAIL_LOG = 'mailLog'; const SYSTEM_MAIL_LOG = 'mailLog';
const SYSTEM_MAIL_LOG_FILE = 'fileadmin/protected/log/mail.log'; 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 = 'showDebugInfo';
const SYSTEM_SHOW_DEBUG_INFO_YES = 'yes'; const SYSTEM_SHOW_DEBUG_INFO_YES = 'yes';
const SYSTEM_SHOW_DEBUG_INFO_NO = 'no'; const SYSTEM_SHOW_DEBUG_INFO_NO = 'no';
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace qfq; namespace qfq;
require_once(__DIR__ . '/../store/Store.php');
/** /**
* Class ErrorHandler * Class ErrorHandler
...@@ -23,6 +24,8 @@ class ErrorHandler { ...@@ -23,6 +24,8 @@ class ErrorHandler {
* @param $line * @param $line
* @return bool|string * @return bool|string
* @throws CodeException * @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/ */
public static function exception_error_handler($severity, $message, $file, $line) { public static function exception_error_handler($severity, $message, $file, $line) {
...@@ -31,11 +34,18 @@ class ErrorHandler { ...@@ -31,11 +34,18 @@ class ErrorHandler {
return false; return false;
} }
// Do not show too much to the user. E.g. 'ldap_bind()' might have problems, but the user should not see the $store = Store::getInstance();
// file and line number. Often the filename is part of the message >> don't show the message to the user. if($store->getVar(SYSTEM_THROW_GENERAL_ERROR, STORE_SYSTEM) == 'yes'){
throw new CodeException(json_encode(
[ERROR_MESSAGE_TO_USER => 'General error - please report.', // Do not show too much to the user. E.g. 'ldap_bind()' might have problems, but the user should not see the
ERROR_MESSAGE_SUPPORT => "File: $file / Line: $line / $message"]), $severity, null); // 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 { ...@@ -351,6 +351,9 @@ class Config {
F_FE_DATA_REQUIRED_ERROR => F_FE_DATA_REQUIRED_ERROR_DEFAULT, 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_MATCH_ERROR => F_FE_DATA_MATCH_ERROR_DEFAULT,
F_FE_DATA_ERROR => 'error', F_FE_DATA_ERROR => 'error',
SYSTEM_FLAG_PRODUCTION => 'yes',
SYSTEM_THROW_GENERAL_ERROR => 'auto',
]; ];
// To let run legacy code // To let run legacy code
......
...@@ -300,6 +300,10 @@ class Store { ...@@ -300,6 +300,10 @@ class Store {
$config[SYSTEM_DB_1_NAME] = $config[SYSTEM_DB_NAME]; $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; return $config;
} }
......
Supports Markdown
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