diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2020-06-16 08:44:52 +0100 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2020-06-16 08:44:52 +0100 |
| commit | 573931b38bdfde36812438d3370811c40fcca13c (patch) | |
| tree | df50dc9a958108da88e39b4765b6772fe3b0572d | |
| parent | dfd7362b5e90e1073a8eeb1484576d68147f2457 (diff) | |
| download | webtrees-573931b38bdfde36812438d3370811c40fcca13c.tar.gz webtrees-573931b38bdfde36812438d3370811c40fcca13c.tar.bz2 webtrees-573931b38bdfde36812438d3370811c40fcca13c.zip | |
Fix: keep-media option was broken by recent performance fixes
| -rw-r--r-- | app/Functions/FunctionsImport.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/Functions/FunctionsImport.php b/app/Functions/FunctionsImport.php index 6efaa3f893..d732631d24 100644 --- a/app/Functions/FunctionsImport.php +++ b/app/Functions/FunctionsImport.php @@ -286,13 +286,20 @@ class FunctionsImport // If the user has downloaded their GEDCOM data (containing media objects) and edited it // using an application which does not support (and deletes) media objects, then add them // back in. - if ($tree->getPreference('keep_media') && $xref) { + if ($tree->getPreference('keep_media')) { $old_linked_media = DB::table('link') ->where('l_from', '=', $xref) ->where('l_file', '=', $tree_id) ->where('l_type', '=', 'OBJE') ->pluck('l_to'); + // Delete these links - so that we do not insert them again in updateLinks() + DB::table('link') + ->where('l_from', '=', $xref) + ->where('l_file', '=', $tree_id) + ->where('l_type', '=', 'OBJE') + ->delete(); + foreach ($old_linked_media as $media_id) { $gedrec .= "\n1 OBJE @" . $media_id . '@'; } |
