diff --git a/composer.json b/composer.json
index 7b72c92a..aadb06ba 100644
--- a/composer.json
+++ b/composer.json
@@ -49,7 +49,7 @@
"shlinkio/shlink-common": "dev-main#554e370 as 3.7",
"shlinkio/shlink-config": "^1.0",
"shlinkio/shlink-event-dispatcher": "^2.1",
- "shlinkio/shlink-importer": "^2.2",
+ "shlinkio/shlink-importer": "dev-main#d7e2762 as 2.3",
"shlinkio/shlink-installer": "dev-develop#aa50ea9 as 5.5",
"shlinkio/shlink-ip-geolocation": "^1.5",
"symfony/console": "^5.1",
diff --git a/module/Core/src/Entity/ShortUrl.php b/module/Core/src/Entity/ShortUrl.php
index 84f215de..b25b90e5 100644
--- a/module/Core/src/Entity/ShortUrl.php
+++ b/module/Core/src/Entity/ShortUrl.php
@@ -86,17 +86,29 @@ class ShortUrl extends AbstractEntity
?ShortUrlRelationResolverInterface $relationResolver = null
): self {
$meta = [
+ ShortUrlInputFilter::VALIDATE_URL => false,
ShortUrlInputFilter::LONG_URL => $url->longUrl(),
ShortUrlInputFilter::DOMAIN => $url->domain(),
ShortUrlInputFilter::TAGS => $url->tags(),
ShortUrlInputFilter::TITLE => $url->title(),
- ShortUrlInputFilter::VALIDATE_URL => false,
+ ShortUrlInputFilter::MAX_VISITS => $url->meta()->maxVisits(),
];
if ($importShortCode) {
$meta[ShortUrlInputFilter::CUSTOM_SLUG] = $url->shortCode();
}
$instance = self::fromMeta(ShortUrlMeta::fromRawData($meta), $relationResolver);
+
+ $validSince = $url->meta()->validSince();
+ if ($validSince !== null) {
+ $instance->validSince = Chronos::instance($validSince);
+ }
+
+ $validUntil = $url->meta()->validUntil();
+ if ($validUntil !== null) {
+ $instance->validUntil = Chronos::instance($validUntil);
+ }
+
$instance->importSource = $url->source();
$instance->importOriginalShortCode = $url->shortCode();
$instance->dateCreated = Chronos::instance($url->createdAt());
diff --git a/module/Core/src/Importer/ImportedLinksProcessor.php b/module/Core/src/Importer/ImportedLinksProcessor.php
index 2b5cde17..e88020c7 100644
--- a/module/Core/src/Importer/ImportedLinksProcessor.php
+++ b/module/Core/src/Importer/ImportedLinksProcessor.php
@@ -51,17 +51,24 @@ class ImportedLinksProcessor implements ImportedLinksProcessorInterface
// Skip already imported URLs
if ($shortUrlRepo->importedUrlExists($url)) {
+ // TODO If the URL exists, allow to merge visits instead of just skipping completely
$io->text(sprintf('%s: Skipped', $longUrl));
continue;
}
$shortUrl = ShortUrl::fromImport($url, $importShortCodes, $this->relationResolver);
if (! $this->handleShortCodeUniqueness($url, $shortUrl, $io, $importShortCodes)) {
+ $io->text(sprintf('%s: Skipped', $longUrl));
continue;
}
$this->em->persist($shortUrl);
$io->text(sprintf('%s: Imported', $longUrl));
+
+ // Process only missing visits when possible
+ if ($url->visitsCount() !== null) {
+
+ }
}
}
@@ -84,7 +91,6 @@ class ImportedLinksProcessor implements ImportedLinksProcessorInterface
), ['Generate new short-code', 'Skip'], 1);
if ($action === 'Skip') {
- $io->text(sprintf('%s: Skipped', $longUrl));
return false;
}