We are currently running D8.7.8 and Embed version 8.x-1.1, trying to update to Embed 1.2 is throwing an error with the update:
-------- ----------- --------------- ----------------------------------------------------------------------------
Module Update ID Type Description
-------- ----------- --------------- ----------------------------------------------------------------------------
embed 8101 hook_update_n Update embed button icons to use encoded data instead of file references.
-------- ----------- --------------- ----------------------------------------------------------------------------
Do you wish to run the specified pending updates? (yes/no) [yes]:
> y
[notice] Update started: embed_update_8101
[error] Call to a member function getFileUri() on bool
[error] Update failed: embed_update_8101
[error] Update aborted by: embed_update_8101
[error] Finished performing updates.
Comment | File | Size | Author |
---|---|---|---|
#11 | 3100972-cleanup-update-hook.patch | 3.45 KB | Dave Reid |
#10 | 3100972-cleanup-update-hook.patch | 2.5 KB | Dave Reid |
#9 | 3100972-cleanup-update-hook.patch | 2.78 KB | Dave Reid |
#7 | 3100972-7-fix-embed-update.patch | 1.89 KB | eric.chenchao |
#3 | interdiff_2-3.txt | 319 bytes | pnagornyak |
Comments
Comment #2
brtamas CreditAttribution: brtamas at Integral Vision Ltd commentedComment #3
pnagornyak CreditAttribution: pnagornyak commentedI have same issue, but I believe that we need some logging.
Comment #4
keboca CreditAttribution: keboca commented@pnagornyak your patch works perfectly! thanks man!
Comment #5
cameron prince CreditAttribution: cameron prince as a volunteer commentedI can confirm the patch in #3 resolves the errors applying updates.
Comment #6
damontgomery CreditAttribution: damontgomery at Palantir.net commentedI did some digging in the module and I think the behavior is a bit confusing, but #3 should work for now.
It looks like the module is assuming that all icons are stored in the file system, but if you don't set one, you get the default image.
See
I'm not sure why a UUID that doesn't point to anything is stored in these configuration files.
So, with #3
- File can't be loaded
- Config isn't updated
- Config still has the broken icon_uuid that doesn't point to anything
- Config doesn't have the icon value
- When the icon is fetched it falls back to the default
The error message is accurate, but a bit misleading. The most likely case for sites is that they are using the default, but I don't know of an easy way to distinguish between the default being used and a file that exists (maybe on prod) and cannot be loaded (maybe on local).
Thanks for #3 and hopefully this information is helpful if people want to take it in another direction.
Comment #7
eric.chenchao CreditAttribution: eric.chenchao commentedIn this patch if $file is empty, we assume default plugin icon is in use. So we will get base64 data from plugin default icon.
Comment #8
eric.chenchao CreditAttribution: eric.chenchao commentedComment #9
Dave ReidWe don't need to fetch the default button image data, that is handled for us as long as we save empty data to the 'icon' config key correctly. This should help clean up some of the data and adds a warning when an Embed button did have an uploaded file, but the file no longer exists.
Comment #10
Dave ReidSome more improvements and some better handling in case they have already have the embedded icon data, this will not overwrite that data.
Comment #11
Dave ReidBecause we're interacting with saving entities, we should move this to a post_update hook, and then we can get rid of the dependency calculation entirely since it gets handled for us by $button->save().
Comment #13
Dave ReidTested and committed #11 to 8.x-1.x. Will release 8.x-1.3 shortly.
Comment #14
pookmish CreditAttribution: pookmish commentedThis change is now producing an error for me during the button save method call.SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3ed72229-7529-4cf5-b679-1d7a86b1030a' for key 'file_field__uuid__value': INSERT INTO {file_managed} (uuid, langcode, uid, filename, uri, filemime, filesize, status, created, changed)
EDIT:
Nevermind. it was a presave hook on my side.