X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FUserImport.php;h=fdacd2b2bf484bb8bb52128d0f906e549ee7dcf7;hb=b8f85f0484fbb1f37e9cae2f4cf98f9349fda099;hp=07119873d97a371d14dec7d3d46d40d44a19d192;hpb=b2edb8558852b08aa412d21fe96221d572c7bacd;p=friendica.git diff --git a/src/Core/UserImport.php b/src/Core/UserImport.php index 07119873d9..fdacd2b2bf 100644 --- a/src/Core/UserImport.php +++ b/src/Core/UserImport.php @@ -7,9 +7,11 @@ namespace Friendica\Core; use Friendica\App; use Friendica\Database\DBA; use Friendica\Database\DBStructure; +use Friendica\DI; use Friendica\Model\Photo; use Friendica\Object\Image; use Friendica\Util\Strings; +use Friendica\Worker\Delivery; /** * @brief UserImport class @@ -36,17 +38,24 @@ class UserImport */ private static function checkCols($table, &$arr) { - $r = DBStructure::getColumns($table); + $tableColumns = DBStructure::getColumns($table); $tcols = []; + $ttype = []; // get a plain array of column names - foreach ($r as $tcol) { + 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] = $ival ?? DBA::NULL_DATETIME; } } } @@ -77,12 +86,11 @@ class UserImport /** * @brief Import account file exported from mod/uexport * - * @param App $a Friendica App Class * @param array $file array from $_FILES * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ - public static function importAccount(App $a, $file) + public static function importAccount($file) { Logger::log("Start user import from " . $file['tmp_name']); /* @@ -115,7 +123,7 @@ class UserImport } $oldbaseurl = $account['baseurl']; - $newbaseurl = System::baseUrl(); + $newbaseurl = DI::baseUrl(); $oldaddr = str_replace('http://', '@', Strings::normaliseLink($oldbaseurl)); $newaddr = str_replace('http://', '@', Strings::normaliseLink($newbaseurl)); @@ -271,9 +279,9 @@ class UserImport } // send relocate messages - Worker::add(PRIORITY_HIGH, 'Notifier', 'relocate', $newuid); + Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid); info(L10n::t("Done. You can now login with your username and password")); - $a->internalRedirect('login'); + DI::baseUrl()->redirect('login'); } }