From 034013dd177f5b816b1063e89409ea81cbd596ab Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Sun, 16 Oct 2022 22:11:32 +0100 Subject: [PATCH 1/4] Modify entries import to defer import of entries with origin --- src/Commands/ImportEntries.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Commands/ImportEntries.php b/src/Commands/ImportEntries.php index c6a5726b..0ce0d6bc 100644 --- a/src/Commands/ImportEntries.php +++ b/src/Commands/ImportEntries.php @@ -56,11 +56,28 @@ private function importEntries() { $entries = Entry::all(); - $this->withProgressBar($entries, function ($entry) { + $entriesWithOrigin = $entries->filter->hasOrigin(); + $entriesWithoutOrigin = $entries->filter(function($entry) { return ! $entry->hasOrigin(); }); + + if ($entriesWithOrigin->count() > 0) { + $this->info('Importing origin entries'); + } + + $this->withProgressBar($entriesWithoutOrigin, function ($entry) { $lastModified = $entry->fileLastModified(); $entry->toModel()->fill(['created_at' => $lastModified, 'updated_at' => $lastModified])->save(); }); + if ($entriesWithOrigin->count() > 0) { + $this->newLine(); + $this->info('Importing multi-site entries'); + + $this->withProgressBar($entriesWithOrigin, function ($entry) { + $lastModified = $entry->fileLastModified(); + $entry->toModel()->fill(['created_at' => $lastModified, 'updated_at' => $lastModified])->save(); + }); + } + $this->newLine(); $this->info('Entries imported'); } From 74106c1f4e2c445013279cfa46a7f3091a42b02e Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Sun, 16 Oct 2022 22:13:10 +0100 Subject: [PATCH 2/4] StyleCI --- src/Commands/ImportEntries.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Commands/ImportEntries.php b/src/Commands/ImportEntries.php index 0ce0d6bc..90b9dac0 100644 --- a/src/Commands/ImportEntries.php +++ b/src/Commands/ImportEntries.php @@ -57,7 +57,9 @@ private function importEntries() $entries = Entry::all(); $entriesWithOrigin = $entries->filter->hasOrigin(); - $entriesWithoutOrigin = $entries->filter(function($entry) { return ! $entry->hasOrigin(); }); + $entriesWithoutOrigin = $entries->filter(function($entry) { + return ! $entry->hasOrigin(); + }); if ($entriesWithOrigin->count() > 0) { $this->info('Importing origin entries'); From 0b20588ecc6c98c7f5ffc20749fe3a6620adb256 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Sun, 16 Oct 2022 22:13:35 +0100 Subject: [PATCH 3/4] More StyleCI --- src/Commands/ImportEntries.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/ImportEntries.php b/src/Commands/ImportEntries.php index 90b9dac0..9a34e265 100644 --- a/src/Commands/ImportEntries.php +++ b/src/Commands/ImportEntries.php @@ -57,7 +57,7 @@ private function importEntries() $entries = Entry::all(); $entriesWithOrigin = $entries->filter->hasOrigin(); - $entriesWithoutOrigin = $entries->filter(function($entry) { + $entriesWithoutOrigin = $entries->filter(function ($entry) { return ! $entry->hasOrigin(); }); From 8c6365b8aa8873afc52c0a8a860c6d46598f5b5a Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 26 Oct 2022 14:41:25 -0400 Subject: [PATCH 4/4] Update ImportEntries.php --- src/Commands/ImportEntries.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/ImportEntries.php b/src/Commands/ImportEntries.php index 9a34e265..88088c7f 100644 --- a/src/Commands/ImportEntries.php +++ b/src/Commands/ImportEntries.php @@ -72,7 +72,7 @@ private function importEntries() if ($entriesWithOrigin->count() > 0) { $this->newLine(); - $this->info('Importing multi-site entries'); + $this->info('Importing localized entries'); $this->withProgressBar($entriesWithOrigin, function ($entry) { $lastModified = $entry->fileLastModified();