X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FNetscapeBookmarkUtils.php;h=dd7057f80e5bd25e1d5fce7bb984644b7c9e2689;hb=a3f83c15f4296530d3ceb70adde7c1cfb3f6312e;hp=8a939adbff68ec995870140ca2ccfd66030a0cd8;hpb=01878a75b93b9966f7366ea2937c118bbc3e459e;p=github%2Fshaarli%2FShaarli.git diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index 8a939adb..dd7057f8 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php @@ -1,7 +1,13 @@ get('resource.data_dir') // log path, will be overridden ); + $logger = new Logger( + $conf->get('resource.data_dir'), + ! $conf->get('dev.debug') ? LogLevel::INFO : LogLevel::DEBUG, + [ + 'prefix' => 'import.', + 'extension' => 'log', + ] + ); + $parser->setLogger($logger); $bookmarks = $parser->parseString($data); $importCount = 0; @@ -163,6 +183,7 @@ class NetscapeBookmarkUtils $newLink['id'] = $existingLink['id']; $newLink['created'] = $existingLink['created']; $newLink['updated'] = new DateTime(); + $newLink['shorturl'] = $existingLink['shorturl']; $linkDb[$existingLink['id']] = $newLink; $importCount++; $overwriteCount++; @@ -174,17 +195,22 @@ class NetscapeBookmarkUtils $newLinkDate->setTimezone(new DateTimeZone(date_default_timezone_get())); $newLink['created'] = $newLinkDate; $newLink['id'] = $linkDb->getNextId(); + $newLink['shorturl'] = link_small_hash($newLink['created'], $newLink['id']); $linkDb[$newLink['id']] = $newLink; $importCount++; } - $linkDb->save($pagecache); + $linkDb->save($conf->get('resource.page_cache')); + $history->importLinks(); + + $duration = time() - $start; return self::importStatus( $filename, $filesize, $importCount, $overwriteCount, - $skipCount + $skipCount, + $duration ); } }