Commit 501ca6e1 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge remote-tracking branch 'origin/master'

parents 1e630d06 0b1f7192
Pipeline #1945 passed with stages
in 2 minutes and 50 seconds
......@@ -502,7 +502,7 @@ Extension Manager: QFQ Configuration
+-----------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| saveButtonClass | btn btn-default navbar-btn | Bootstrap CSS class for save button on top of the form. |
+-----------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| saveButtonClassOnChange | alert-info btn-info | Bootstrap CSS class for save button showing 'data changed'. |
| buttonOnChangeClass | alert-info btn-info | Bootstrap CSS class for save button showing 'data changed'. |
+-----------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
| saveButtonGlyphIcon | glyphicon-ok | Icon for the form save button. |
+-----------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
......
......@@ -121,7 +121,6 @@ phpunit_snapshot: snapshot phpunit
phpunit_release: release phpunit
doc-local:
# test
source docker/_helper_functions.sh; makePathExecutable "${PWD}/../"
docker pull t3docs/render-documentation
source <(docker run --rm t3docs/render-documentation show-shell-commands); dockrun_t3rd makehtml
......
......@@ -140,6 +140,7 @@ const KVP_VALUE_GIVEN = 'value_given';
// JSON encoded messages thrown through an exception:
const ERROR_MESSAGE_TO_USER = 'toUser'; // always shown to the user.
const ERROR_MESSAGE_TO_DEVELOPER = 'support'; // Message to help the developer to understand the problem.
const ERROR_MESSAGE_TO_DEVELOPER_SANITIZE = 'support_sanitize'; // Typically 'true' or missing. If 'false' then content of 'support' won't be html encoded.
const ERROR_MESSAGE_OS = 'os'; // Error message from the OS - like 'file not found' or specific SQL problem
const ERROR_MESSAGE_HTTP_STATUS = 'httpStatus'; // HTTP Status Code to report
......@@ -1789,4 +1790,10 @@ const HTTP_401_UNAUTHORIZED = '401 Unauthorized';
const HTTP_403_FORBIDDEN = '403 Forbidden';
const HTTP_403_METHOD_NOT_ALLOWED = '405 Method Not Allowed';
const HTTP_404_NOT_FOUND = '404 Not Found';
const HTTP_409_CONFLICT = '409 Conflict';
\ No newline at end of file
const HTTP_409_CONFLICT = '409 Conflict';
// update sql functions
const ACTION_FUNCTION_UPDATE = '_fupdate'; // get parameter to set the update behaviour of functions.sql
const ACTION_FUNCTION_UPDATE_NEXT_UPDATE = 'nextUpdate'; // functions.sql is updated at next qfq update
const ACTION_FUNCTION_UPDATE_NEVER = 'never'; // functions.sql is never updated
const ACTION_FUNCTION_UPDATE_NOT_PERFORMED = 'notUpdated'; // functions.sql update was skipped during last qfq update
\ No newline at end of file
......@@ -165,10 +165,16 @@ class DatabaseUpdate {
* @throws UserFormException
*/
private function updateSqlFunctions($oldFunctionsHash) {
if ('no' === $oldFunctionsHash) {
if (ACTION_FUNCTION_UPDATE_NEVER === $oldFunctionsHash) {
return null;
}
if ($_GET[ACTION_FUNCTION_UPDATE] === ACTION_FUNCTION_UPDATE_NEXT_UPDATE) {
return ACTION_FUNCTION_UPDATE_NOT_PERFORMED;
} elseif ($_GET[ACTION_FUNCTION_UPDATE] === ACTION_FUNCTION_UPDATE_NEVER) {
return ACTION_FUNCTION_UPDATE_NEVER;
}
$functionsSql = file_get_contents(__DIR__ . '/../../sql/functions.sql');
$functionsHash = hash('md5', $functionsSql);
......@@ -193,11 +199,17 @@ class DatabaseUpdate {
return $functionsHash;
} else {
$errorMsg[ERROR_MESSAGE_TO_USER] = 'Error while updating qfq.';
$errorMsg[ERROR_MESSAGE_TO_DEVELOPER] = "Error while updating qfq: " .
"Could not properly execute the file 'functions.sql' on the QFQ MYSQL database. " .
"Please do so manually or set the parameter 'functionsHash' in the table comments of the table" .
" 'Form' to 'no' i.e. 'Version=x.y.z&functionHash=no' to disable updating of the qfq mysql functions." .
" You may also try giving the mysql user the 'SUPER' privilege temporarily.";
$errorMsg[ERROR_MESSAGE_TO_DEVELOPER] =
"Failed to play functions.sql, probably not enough permissions for the qfq mysql user. " .
"Possible solutions: <ul>" .
'<li>Grant Super privilages to qfq mysql user temporarily.</li>' .
'<li>Play the following file manually on the database: ' .
'<a href="http://webwork16.math.uzh.ch/megger/qfq/typo3conf/ext/qfq/Source/sql/functions.sql">typo3conf/ext/qfq/Source/sql/functions.sql</a></li>' .
'<li><a href="?' . http_build_query(array_merge($_GET, array(ACTION_FUNCTION_UPDATE=>ACTION_FUNCTION_UPDATE_NEXT_UPDATE))) . '">Click here</a> to skip the sql functions update until next qfq release update</li>' .
'<li><a href="?' . http_build_query(array_merge($_GET, array(ACTION_FUNCTION_UPDATE=>ACTION_FUNCTION_UPDATE_NEVER))) . '">Click here</a> to skip the sql functions update forever</li>' .
'</ul>' .
"To enable the sql functions update again you can delete the parameter 'functionsHash' in the table comments of the table 'Form'.";
$errorMsg[ERROR_MESSAGE_TO_DEVELOPER_SANITIZE] = false;
throw new DbException(json_encode($errorMsg), ERROR_PLAY_SQL_FILE);
}
}
......
......@@ -144,7 +144,18 @@ class AbstractException extends \Exception {
$arrForm['FE column'] = Store::getVar(SYSTEM_FORM_ELEMENT_COLUMN, STORE_SYSTEM);
}
// Check if the 'developer message shouldn't be sanitized
$developerRaw=null;
if(($arrMsg[ERROR_MESSAGE_TO_DEVELOPER_SANITIZE]??true)==false){
$developerRaw=$arrMsg[ERROR_MESSAGE_TO_DEVELOPER]??'';
}
unset($arrMsg[ERROR_MESSAGE_TO_DEVELOPER_SANITIZE]);
$arrMerged = OnArray::htmlentitiesOnArray(array_merge($arrMsg, $arrDebugShow));
// Restore raw developer message
if($developerRaw!==null){
$arrMerged[ERROR_MESSAGE_TO_DEVELOPER]=$developerRaw;
}
if (!empty($os = $arrMerged[ERROR_MESSAGE_OS] ?? '')) {
// [ mysqli: 1146 ] Table 'qfq_db.UNKNOWN_TABLE' doesn't exist
......
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