- minor code/performance improvements

This commit is contained in:
Mark Friedrich
2019-02-09 16:33:31 +01:00
parent e28fea9081
commit 8abd5cba6e
7 changed files with 137 additions and 92 deletions

View File

@@ -1408,12 +1408,13 @@ class Setup extends Controller {
return $this->databases;
}
/** check MySQL params
/**
* check MySQL params
* @param \Base $f3
* @param $db
* @param SQL $db
* @return array
*/
protected function checkDBConfig(\Base $f3, $db){
protected function checkDBConfig(\Base $f3, SQL $db){
// some db like "Maria DB" have some strange version strings....
$dbVersionString = $db->version();
@@ -1436,19 +1437,13 @@ class Setup extends Controller {
]
];
// get specific MySQL config Value
$getDBConfigValue = function($db, $param){
$result = $db->exec([
//"USE " . $db->name(),
"SHOW VARIABLES LIKE '" . strtolower($param) . "'"
]);
$tmpResult = reset($result);
return !empty($result)? end($tmpResult) : 'unknown';
};
$mySQLConfigParams = $f3->get('REQUIREMENTS.MYSQL.VARS');
$mySQLConfigParams = (array)$f3->get('REQUIREMENTS.MYSQL.VARS');
foreach($mySQLConfigParams as $param => $requiredValue){
$value = $getDBConfigValue($db, $param);
// get current MySQL config value for $param
$result = $db->exec("SHOW VARIABLES LIKE '" . strtolower($param) . "'");
$tmpResult = reset($result);
$value = !empty($result)? end($tmpResult) : 'unknown';
$dbConfig[] = [
'label' => strtolower($param),
'required' => $requiredValue,