friendica-6950 uimport doesn't support "pwdreset_time":null

This commit is contained in:
Philipp Holzer 2019-05-26 15:49:44 +02:00
parent ea218438d2
commit 220f8f0862
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
2 changed files with 40 additions and 2 deletions

View file

@ -39,14 +39,21 @@ class UserImport
$tableColumns = DBStructure::getColumns($table);
$tcols = [];
$ttype = [];
// get a plain array of column names
foreach ($tableColumns as $tcol) {
$tcols[] = $tcol['Field'];
$ttype[$tcol['Field']] = $tcol['Type'];
}
// remove inexistent columns
foreach ($arr as $icol => $ival) {
if (!in_array($icol, $tcols)) {
unset($arr[$icol]);
continue;
}
if ($ttype[$icol] === 'datetime') {
$arr[$icol] = !empty($ival) ? $ival : DBA::NULL_DATETIME;
}
}
}