Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
930881d2
Commit
930881d2
authored
Dec 10, 2018
by
Marc Egger
Browse files
Config.php: make 'reading dbname' Typo3 version dependent.
parent
8064321f
Changes
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/store/Config.php
View file @
930881d2
...
...
@@ -99,7 +99,7 @@ class Config {
# Read 'LocalConfiguration.php'
if
(
isset
(
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'EXT'
][
'extConf'
][
EXT_KEY
]))
{
$configT3qfq
=
unserialize
(
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'EXT'
][
'extConf'
][
EXT_KEY
]);
$configT3qfq
[
SYSTEM_DB_NAME_T3
]
=
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'DB'
]
[
'database'
]
;
$configT3qfq
[
SYSTEM_DB_NAME_T3
]
=
self
::
getDbName
(
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'DB'
]
)
;
}
else
{
$all
=
include
(
$pathTypo3Conf
.
'/'
.
CONFIG_T3
);
...
...
@@ -112,11 +112,13 @@ class Config {
throw
new
qfq\UserFormException
(
"Error read file: "
.
$pathTypo3Conf
.
'/'
.
CONFIG_T3
,
ERROR_IO_READ_FILE
);
}
$configT3qfq
[
SYSTEM_DB_NAME_T3
]
=
$all
[
'DB'
][
'database'
]
;
$configT3qfq
[
SYSTEM_DB_NAME_T3
]
=
self
::
getDbName
(
$all
[
'DB'
])
;
unset
(
$all
);
}
$configIni
=
$pathTypo3Conf
.
'/'
.
CONFIG_QFQ_INI
;
$configPhp
=
$pathTypo3Conf
.
'/'
.
CONFIG_QFQ_PHP
;
}
// Migrate legacy config file.
...
...
@@ -147,6 +149,18 @@ class Config {
return
$config
;
}
/**
* Returns T3 DB-Name, depending on T3 version
*
* @param array $db
* @return mixed
*/
private
static
function
getDbName
(
array
$db
){
// T3 7.x: $GLOBALS['TYPO3_CONF_VARS']['DB']['database'], T3 8.x: $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']
return
isset
(
$db
[
'database'
])
?
$db
[
'database'
]
:
$db
[
'Connections'
][
'Default'
][
'dbname'
];
}
/**
* Checks for deprecated options.
* @param array $config
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment