Commit 79b1a217 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fix readConfig to understand again old style of database credentials definition.

parent 2e0b9af9
......@@ -345,7 +345,7 @@ const TYPO3_DEBUG_SHOW_BODY_TEXT = 'debugShowBodyText';
const TYPO3_SQL_LOG = 'sqlLog';
const TYPO3_SQL_LOG_MODE = 'sqlLogMode';
// System
// System: old style - still used to read old configuration file.
const SYSTEM_DB_USER = 'DB_USER';
const SYSTEM_DB_SERVER = 'DB_SERVER';
const SYSTEM_DB_PASSWORD = 'DB_PASSWORD';
......
......@@ -11,6 +11,7 @@ namespace qfq;
use qfq;
require_once(__DIR__ . '/../store/Session.php');
require_once(__DIR__ . '/../store/Store.php');
require_once(__DIR__ . '/../Constants.php');
require_once(__DIR__ . '/../database/Database.php');
require_once(__DIR__ . '/../../qfq/store/Client.php');
......@@ -41,6 +42,11 @@ class Dirty {
*/
private $session = null;
/**
* @var Store
*/
private $store = null;
/**
* Init class
*/
......@@ -51,6 +57,9 @@ class Dirty {
if (!isset($this->client[DIRTY_RECORD_HASH_MD5])) {
$this->client[DIRTY_RECORD_HASH_MD5] = '';
}
// $this->store = Store::getInstance();
// $dbIndexQfq = $this->store->getVar(SYSTEM_DB_INDEX_QFQ, STORE_SYSTEM);
// $this->db = new Database($dbIndexQfq);
$this->db = new Database();
}
......
......@@ -54,6 +54,7 @@ class Config {
*/
private static function checkForAttack(array $config) {
$attack = false;
$key = '';
// Iterate over all fake vars
$arr = explode(',', $config[SYSTEM_SECURITY_VARS_HONEYPOT]);
......
......@@ -247,6 +247,14 @@ class Store {
$config[SYSTEM_SQL_LOG] = $config[SYSTEM_PATH_EXT] . '/' . $config[SYSTEM_SQL_LOG];
}
// In case the database credentials are given in the old style: copy them to the new style
if (!isset($config[SYSTEM_DB_1_USER]) && isset($config[SYSTEM_DB_USER])) {
$config[SYSTEM_DB_1_USER] = $config[SYSTEM_DB_USER];
$config[SYSTEM_DB_1_SERVER] = $config[SYSTEM_DB_SERVER];
$config[SYSTEM_DB_1_PASSWORD] = $config[SYSTEM_DB_PASSWORD];
$config[SYSTEM_DB_1_NAME] = $config[SYSTEM_DB_NAME];
}
return $config;
}
......
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