diff --git a/extension/Documentation/Manual.rst b/extension/Documentation/Manual.rst index 43ace6634d30c8c402b52e7af22c5ba3cf50527f..91669c271992871be33dea0553b720f21c7874e8 100644 --- a/extension/Documentation/Manual.rst +++ b/extension/Documentation/Manual.rst @@ -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. | diff --git a/extension/Documentation/Release.rst b/extension/Documentation/Release.rst index 6f36c390e8cf0f4756e6009590d3b01c11b3c823..4c9f8d4905eda7c6e84299c5de30df8b15f30bd7 100644 --- a/extension/Documentation/Release.rst +++ b/extension/Documentation/Release.rst @@ -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 ^^^^^^^^ diff --git a/extension/ext_conf_template.txt b/extension/ext_conf_template.txt index e24ae39c490f07b148d0fe0350cfaa7531835282..633f060af21f62c2dfa94061efa7fe7d1e94619a 100644 --- a/extension/ext_conf_template.txt +++ b/extension/ext_conf_template.txt @@ -1,6 +1,9 @@ # 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 = diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php index 88bf4f58c7f2c15709b3fa79ab7215798a75d8f1..f198921bdb643323717380b1b4e7aa3f75a1eb2a 100644 --- a/extension/qfq/qfq/Constants.php +++ b/extension/qfq/qfq/Constants.php @@ -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'; diff --git a/extension/qfq/qfq/exceptions/ErrorHandler.php b/extension/qfq/qfq/exceptions/ErrorHandler.php index 65c371cd1ced45cf60a2aa56e682053a1e64ff34..e213a9bf3de503a2b3970afd69b63a57dca4314d 100644 --- a/extension/qfq/qfq/exceptions/ErrorHandler.php +++ b/extension/qfq/qfq/exceptions/ErrorHandler.php @@ -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 diff --git a/extension/qfq/qfq/store/Config.php b/extension/qfq/qfq/store/Config.php index e3cb801c7ba8bc0e59aec035b85595e23766f0f5..1c63ce3196915b9904d0594558a487bf87983c47 100644 --- a/extension/qfq/qfq/store/Config.php +++ b/extension/qfq/qfq/store/Config.php @@ -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 diff --git a/extension/qfq/qfq/store/Store.php b/extension/qfq/qfq/store/Store.php index e40f70c6c1adde1d5934507a54725d2f7c4d3551..4e287d54f212f5e08f242579de9eb2ffda1230c4 100644 --- a/extension/qfq/qfq/store/Store.php +++ b/extension/qfq/qfq/store/Store.php @@ -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; }