check which settings are imported

This commit is contained in:
Roland Gruber 2020-04-12 14:00:23 +02:00
parent 9ed53f51de
commit 38293656b6
2 changed files with 5 additions and 0 deletions

View File

@ -2701,6 +2701,10 @@ class LAMCfgMain {
*/
public function importData($data) {
foreach ($data as $dataKey => $dataValue) {
if (!in_array($dataKey, $this->settings)) {
logNewMessage(LOG_WARNING, 'Ignored setting during import: ' . $dataKey);
continue;
}
if (!(is_array($dataValue) || is_string($dataValue) || is_int($dataValue) || is_bool($dataValue))) {
throw new LAMException('Invalid import data type for ' . htmlspecialchars($dataKey) . ': ' . gettype($dataValue));
}

View File

@ -146,6 +146,7 @@ class LAMCfgMainTest extends TestCase {
$importData['sessionTimeout'] = 240;
$importData['logLevel'] = LOG_ERR;
$importData['mailServer'] = 'mailserver';
$importData['IGNORE_ME'] = 'ignore';
$this->conf->importData($importData);