Commit 40adc7c9 authored by Carsten  Rose's avatar Carsten Rose

Fixes #9959. Implement checkT3QfqConfig, updateT3QfqConfig

parent 1cee991c
Pipeline #3207 failed with stages
in 1 minute and 30 seconds
......@@ -517,8 +517,8 @@ const SYSTEM_REDIRECT_ALL_MAIL_TO = 'redirectAllMailTo';
const SYSTEM_THROW_GENERAL_ERROR = 'throwExceptionGeneralError';
const SYSTEM_FLAG_PRODUCTION = 'flagProduction';
const SYSTEM_RENDER = 'render';
const SYSTEM_RENDER_FORM_OR_REPORT = 'formOrReport';
const SYSTEM_RENDER_FORM_AND_REPORT = 'formAndReport';
const SYSTEM_RENDER_SINGLE = 'single';
const SYSTEM_RENDER_BOTH = 'both';
const SYSTEM_RENDER_API = 'api';
const SYSTEM_SHOW_DEBUG_INFO = 'showDebugInfo';
......
......@@ -10,6 +10,7 @@ namespace IMATHUZH\Qfq\Core\Database;
use IMATHUZH\Qfq\Core\Helper\Logger;
use IMATHUZH\Qfq\Core\Store\Store;
use IMATHUZH\Qfq\Core\Typo3\T3Handler;
/*
......@@ -129,14 +130,17 @@ class DatabaseUpdate {
*/
public function checkNupdate($dbUpdate) {
if ($dbUpdate === SYSTEM_DB_UPDATE_NEVER) {
return;
}
$new = $this->getExtensionVersion();
$versionInfo = $this->getDatabaseVersion();
$old = $versionInfo[QFQ_VERSION_KEY] ?? false;
$this->checkT3QfqConfig($old, $new);
if ($dbUpdate === SYSTEM_DB_UPDATE_NEVER) {
return;
}
if ($dbUpdate === SYSTEM_DB_UPDATE_ALWAYS || ($dbUpdate === SYSTEM_DB_UPDATE_AUTO && $new != $old)) {
$newFunctionHash = $this->updateSqlFunctions($versionInfo[QFQ_VERSION_KEY_FUNCTION_HASH] ?? '');
......@@ -167,6 +171,23 @@ class DatabaseUpdate {
}
/**
* Check Typo3 config if values needs to be updated.
* This is typically necessary if default config values change, to guarantee existing installations behave in legacy mode.
*
* @param $old
* @param $new
*/
private function checkT3QfqConfig($old, $new) {
if ($new == $old) {
return;
}
if (version_compare($old, '20.2.0') == -1) {
T3Handler::updateT3QfqConfig(SYSTEM_RENDER, SYSTEM_RENDER_BOTH); //Legacy behaviour.
}
}
/**
* Check if there are special columns without prepended underscore in the QFQ application. If yes, then throw an error.
* A link is provided to automatically prepend all found special columns. And another link to skip the auto-replacement.
......
......@@ -244,8 +244,6 @@ class QuickFormQuery {
public function process() {
$html = '';
T3Handler::getT3QfqConfig();
if ($this->store->getVar(TYPO3_DEBUG_SHOW_BODY_TEXT, STORE_TYPO3) === 'yes') {
$htmlId = HelperFormElement::buildFormElementId($this->formSpec[F_ID], 0, 0, 0);
$html .= Support::doTooltip($htmlId . HTML_ID_EXTENSION_TOOLTIP, $this->t3data['bodytext']);
......
......@@ -189,7 +189,6 @@ class Config {
}
}
/**
* Check for attack
*
......
......@@ -130,13 +130,13 @@ class T3Handler {
// Same as $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['qfq']
$configT3 = $configurationManager->getLocalConfiguration();
$configQfq = unserialize($configT3['EXT']['extConf']['qfq']);
$configQfq = unserialize($configT3['EXT']['extConf'][EXT_KEY]);
// Set new value
$configQfq[$key] = $value;
// Prepare
$configT3['EXT']['extConf']['qfq'] = serialize($configQfq);
$configT3['EXT']['extConf'][EXT_KEY] = serialize($configQfq);
// Write new config to typo3conf/LocalConfiguration.php
$configurationManager->writeLocalConfiguration($configT3);
......
# cat=config/config; type=string; label=Flag Production:Possible values: 'yes', 'no'. Retrieve via '{{flagProduction:Y}}''. Default is 'yes'. Used to differentiate between development & production systems.
flagProduction = yes
# cat=config/config; type=string; label=Either 'formOrReport' (default) or 'formAndReport'. Decide if both will be rendered or only one at a time (prefer 'form' over report).
render = formOrReport
# cat=config/config; type=string; label=QFQ will show form and/or report. In most cases only one at a time is needed. Options: 'single' (default) or 'both' (legacy). In 'single' prefer 'form' over 'report'.
render = single
# cat=config/config; type=string; label=Max file size for file uploads:If empty, take minimum of 'post_max_size' and 'upload_max_filesize' (PHP.INI).
maxFileSize =
......
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