Commit dc4271bf authored by Carsten  Rose's avatar Carsten Rose
Browse files

Refs #11998 - By theory, getBodyText() should now be MultiDB aware.

parent 1c09b4e2
Pipeline #5054 passed with stages
in 3 minutes and 51 seconds
......@@ -320,8 +320,8 @@ In :ref:`config-qfq-php` mutliple database credentials can be prepared. Mandator
`DB_1_USER`, `DB_1_SERVER`, `DB_1_PASSWORD`, `DB_1_NAME`. The number '1' indicates the `dbIndex`. Increment the number
to specify further database credential setups.
Typically the credentials for `DB_1` also have access to the T3 database.
By convention, it's necessary that `DB_1` is the one who also have access to the Typo3 database. E.q. `QFQ Function`_ or
download links (based on QFQ functions) needs access to the T3 database to directly fetch tt-content records.
Different QFQ versions, shared database
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
......@@ -490,9 +490,6 @@ const SYSTEM_DB_INIT = 'init';
const SYSTEM_DB_INDEX_DATA = "indexData";
const SYSTEM_DB_INDEX_QFQ = "indexQfq";
//const SYSTEM_DB_INDEX_DATA_DEPRECATED = "DB_INDEX_DATA";
//const SYSTEM_DB_INDEX_QFQ_DEPRECATED = "DB_INDEX_QFQ";
// Automatically filled by QFQ
const SYSTEM_DB_NAME_DATA = 'dbNameData';
const SYSTEM_DB_NAME_QFQ = 'dbNameQfq';
......@@ -1010,6 +1007,7 @@ const F_PARAMETER = 'parameter'; // valid for F_ and FE_
// Form columns: via parameter field
const F_DB_INDEX = 'dbIndex';
const DB_INDEX_DEFAULT = "1";
const DB_INDEX_T3 = DB_INDEX_DEFAULT;
const PARAM_DB_INDEX_DATA = '__dbIndexData'; // Submitted via SIP to make record locking DB aware.
const F_FORM_SUBMIT_LOG_MODE = 'formSubmitLogMode';
......
......@@ -54,7 +54,8 @@ class Database {
*/
private $sqlLogModePrio = [SQL_LOG_MODE_NONE => 1, SQL_LOG_MODE_ERROR => 2, SQL_LOG_MODE_MODIFY => 3, SQL_LOG_MODE_ALL => 4];
private $dbName = '';
private $dbName = null;
private $dbIndex = null;
/**
* Returns current data base handle from Store[System][SYSTEM_DBH].
......@@ -72,6 +73,7 @@ class Database {
if (empty($dbIndex)) {
$dbIndex = DB_INDEX_DEFAULT;
}
$this->dbIndex = $dbIndex;
$this->store = Store::getInstance();
$storeSystem = $this->store->getStore(STORE_SYSTEM);
......@@ -98,6 +100,13 @@ class Database {
}
}
/**
* @return mixed|string
*/
public function getDbIndex() {
return $this->dbIndex;
}
/**
* @return mixed|string
*/
......
......@@ -463,7 +463,13 @@ class Report {
if (isset($functionCache[$rcFunctionName])) {
$bodytextArr = $functionCache[$rcFunctionName];
} else {
$bodytextArr = $this->db->getBodyText($rcFunctionName);
if (DB_INDEX_T3 != $this->db->getDbIndex()) {
$db = new Database(DB_INDEX_T3);
} else {
$db = $this->db;
}
$bodytextArr = $db->getBodyText($rcFunctionName);
$btp = new BodytextParser();
$bodytextArr[T3DATA_BODYTEXT] = $btp->process($bodytextArr[T3DATA_BODYTEXT]);
......
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