diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-03-07 12:08:10 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-03-09 08:54:01 +0000 |
| commit | 5cd281f4f76e660b2e033b96db47543fa16f7748 (patch) | |
| tree | de4a83a0954bd9ca0d7fb2fad236f994ed7c9050 /app/Http/RequestHandlers/GedcomLoad.php | |
| parent | 4a81005e3a2026c16456c19677a9a528af00a3a3 (diff) | |
| download | webtrees-5cd281f4f76e660b2e033b96db47543fa16f7748.tar.gz webtrees-5cd281f4f76e660b2e033b96db47543fa16f7748.tar.bz2 webtrees-5cd281f4f76e660b2e033b96db47543fa16f7748.zip | |
Refactor Tree / TreeService to improve the import of large GEDCOM files.
Diffstat (limited to 'app/Http/RequestHandlers/GedcomLoad.php')
| -rw-r--r-- | app/Http/RequestHandlers/GedcomLoad.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/Http/RequestHandlers/GedcomLoad.php b/app/Http/RequestHandlers/GedcomLoad.php index 3dfd987a11..0997131a00 100644 --- a/app/Http/RequestHandlers/GedcomLoad.php +++ b/app/Http/RequestHandlers/GedcomLoad.php @@ -26,6 +26,7 @@ use Fisharebest\Webtrees\Gedcom; use Fisharebest\Webtrees\Http\ViewResponseTrait; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Services\TimeoutService; +use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\Tree; use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Query\Expression; @@ -55,14 +56,19 @@ class GedcomLoad implements RequestHandlerInterface /** @var TimeoutService */ private $timeout_service; + /** @var TreeService */ + private $tree_service; + /** * GedcomLoad constructor. * * @param TimeoutService $timeout_service + * @param TreeService $tree_service */ - public function __construct(TimeoutService $timeout_service) + public function __construct(TimeoutService $timeout_service, TreeService $tree_service) { $this->timeout_service = $timeout_service; + $this->tree_service = $tree_service; } /** @@ -122,6 +128,8 @@ class GedcomLoad implements RequestHandlerInterface // If we are loading the first (header) record, make sure the encoding is UTF-8. if ($first_time) { + $this->tree_service->deleteGenealogyData($tree, (bool) $tree->getPreference('keep_media')); + // Remove any byte-order-mark if (str_starts_with($data->chunk_data, Gedcom::UTF8_BOM)) { $data->chunk_data = substr($data->chunk_data, strlen(Gedcom::UTF8_BOM)); |
