When I synchronize content that includes images/files from GatherContent these files are reuploaded to the Drupal file system every time.
For example: I have a pdf file that is attached to a upload field in GatherContent. Let's say I will update the rest of the content except for the pdf and synchronize everything to Drupal multiple times. What this does is it updates all fields in Drupal, including the file field that contains the pdf even if the pdf has been the same from the beginning. Now I will have multiple pdf files (they will be named file.pdf, file_1.pdf, file_2.pdf etc.) on my server and this amount will go up every time I synchronize content from GatherContent. So if I have a page with 5 attachments in GatherContent and synchronize it 10 times to Drupal I will have 50 files in my file system, even if the attachments have been unchanged.
Comments
Comment #2
gaards commentedI do notice that I get the following notice in watchdog when updating content from GatherContent:
Notice: Trying to get property of non-object in gc_gc_process_files_field() (line 500 of gathercontent/gathercontent.module).Looking at the code there is some kind of check going on with the files, could the above error be related to the issue I'm having?
Comment #3
mate.kozma commentedComment #4
gaards commentedHmm.... the patch only seems to work for the content in the first tab in GatherContent. I have two tabs in GatherContent, English and Swedish, with identical fields. On the English tab I upload a file called test_en.pdf and on the Swedish tab I upload a file called test_sv.pdf. Now when I sync the content to Drupal multiple times the English version of the file works fine (I won't have multiple versions of the file in the filesystem), but the file I uploaded in the Swedish tab is still reuploaded (test_sv.pdf, test_sv_0.pdf etc..).
Comment #5
mate.kozma commentedComment #6
gaards commentedI tried the patch, but I get the following error:
InvalidArgumentException: Invalid translation language (und) specified. in Drupal\Core\Entity\ContentEntityBase->getTranslation() (line 745 of /core/lib/Drupal/Core/Entity/ContentEntityBase.php).This error also seems to stop the content import/update from completing, now I only get the information from the first tab and nothing from the second tab.
Comment #7
mate.kozma commentedComment #8
glynnr commented@mate.kozma
Thanks for patch which I need right now. However, I am curious to know why you don't just use referencedEntities() ?
I had to patch this and generated my own patch before I found this. It's somewhat shorter, but perhaps it's missing something.
Comment #9
glynnr commentedHere it is for the latest dev release.
Comment #10
sweetchuckWe are going to change the way of the file entity lookup, because the subject file can be exists on the Drupal side in the same node, but in another field if the mapping changed between 2 import process. You can check it in patch #7
Comment #11
mate.kozma commentedComment #13
mirom commentedNeeds to be backported to Drupal 7.
Comment #14
mirom commentedComment #15
mirom commentedThis seems to be fixed in the latest head. Feel free to reopen if the problem occurs again.