- Issue created by @Grevil
- Status changed to Needs review
about 1 year ago 11:32am 21 September 2023 - last update
about 1 year ago 11 pass - @grevil opened merge request.
- Status changed to Needs work
about 1 year ago 1:15pm 21 September 2023 - 🇩🇪Germany Grevil
Ok, as discussed with @Anybody, instead of clearing the config, we should use the old paths, create file entities using their path and save their entity IDs instead.
Note, we have to make sure, to only save files saved inside the public file directory. Icons stored inside the private file directory are not supported! - last update
about 1 year ago 11 pass - last update
about 1 year ago 11 pass - last update
about 1 year ago 1 pass, 2 fail - 🇩🇪Germany Grevil
I have zero idea, why this isn't working... after the update hook, all variables are set to NULL. It is very hard to debug inside an update hook, but it seems, that the $image->id() is NULL, and therefore, we always run into the else statement.
Using the same code on the configuration form, leads to the correct output... this doesn't make any sense...
See Gitlab comments.
- Assigned to Grevil
- 🇩🇪Germany Anybody Porta Westfalica
@Grevil: The code is looking pretty good! :)
I guess we need to use an post update hook, see https://www.specbee.com/blogs/update-and-post-update-hooks-for-successfu..."Executes an update which is intended to update data, like entities."
"These hooks are executed after all the hook_update_N() hooks are run. At this stage, Drupal is already fully repaired so you can use any API within the site."If it shouldn't work, please ask me for help.
One last question: Are we using the same "fileUsage->add()" call in the settings form save? I guess we need to do that, if not (otherwise the files might be treated as orphaned on crons)
- last update
about 1 year ago 1 pass, 2 fail - 🇩🇪Germany Grevil
Yea no idea... using a post update hook now... executes as expected, but still NULL, so $image seems to still resolve to NULL...
- last update
about 1 year ago 11 pass - last update
about 1 year ago 11 pass - Status changed to Needs review
about 1 year ago 9:37am 22 September 2023 - 🇩🇪Germany Grevil
Alright, all should be fixed now! The problem was that because of the schema type change of image, the path was ovewritten with '0' straight away, even before running "drush updb", that lead to the configs not containing the paths to the images as expected and nothing was set. Instead, we change the name now, so that the old configs containing the paths still exist until we manually clear them.
Update works as expected! 🙂👍
- Issue was unassigned.
- Status changed to RTBC
about 1 year ago 9:55am 22 September 2023 - Status changed to Fixed
about 1 year ago 9:57am 22 September 2023 Automatically closed - issue fixed for 2 weeks with no activity.