Closed alxp closed 2 years ago
Tackling the white screen first, this looks like a pretty simple thing,
In AbstractGenerateDerivativeMediaFile.php
protected function generateData(EntityInterface $entity) {
$data = parent::generateData($entity);
if (get_class($entity) != 'Drupal\media\Entity\Media') {
return;
}
The event is emitted on the parent node called in islandora_file_update() hook. Since the Generate Thumbnail File event doesn't apply to nodes, it's bailing. But it's returning NULL, but the calling code keeps going and tries to construct a Stomp Header with "NULL" for data, which causes the type mismatch error.
How has this not come up before?
I think I need some help to understand what is supposed to be going on in the logic to generate derivatives:
Here is the call stack that leads up to the error:
The islandora_file_update() hook grabs a Media's parent and generates derivatives, passing the $node and the $media along:
oreach ($utils->getReferencingMedia($file->id()) as $media) {
$node = $utils->getParentNode($media);
if ($node) {
$utils->executeDerivativeReactions(
'\Drupal\islandora\Plugin\ContextReaction\DerivativeReaction',
$node,
$media
);
}
In IslandoraUtils::executeDerivativeReactions, it evaluates the contexts and then executes the active reactions, but only passes the $node entity along:
// Fire off index reactions.
foreach ($this->contextManager->getActiveReactions($reaction_type) as $reaction) {
$reaction->execute($node);
}
SO: How are the media derivatives supposed to be executed?
In that mess of hook_insert()s and hook_updates (for nodes, media, and files) there are a few places where DerivativeFileReaction
gets called:
drupal_register_shutdown_function('_islandora_fire_media_file_derivative_reaction', $media);
It doesn't run on file update - but i am not sure if 'file update' is really a thing (in the UI), since the workflow appears to always include deleting a file and replacing it with a different file. Maybe it's possible for a file to be updated in place programmatically (like running a new derivative on top of an old derivative, if they have the same filename?? and drupal doesn't stop them? )
Video docs - https://www.youtube.com/watch?v=3U6tBvD8oJY
There are a couple of Actions that ship with Islandora Defaults built to show Islandora's Multi-file Media approach.
They seem to not be functional at the moment.
Test results on fresh Playbook run which has working thumbnail and extracted text generation using the actions that create new Media entities:
Hypercube log after "Generate Extracted Text for Media Attachment" action invokes Crayfish:
When adding an Generate "generate_image_derivative_file" action to an image context, saving the image produces a white screen. The error in the Apache log is:
I tried to run the same test on latest ISLE-DC, after running 'make local' and then upgrading to Drupal 9 and installing Islandora Defaults, but then the standard Text Extraction action did not seem to be able to invoke Hypercube so something else is going on there that I may report as a separate bug.
What steps does it take to reproduce the issue?
On Fresh Islandora Playbook instance:
To test Image inline thumbnail field generation:
Wait a minute or two and click Edit again.
Expected: You should see a thumbnail in the field you added.
To test the inline Text Extraction functionality:
Expected
The two fields that hold extracted text should get populated. You may need to either configure the entity view display for the media or click Edit to see the fields.
See above
Adding Media
The derivatives do not get generated.
Editor, Administrator
Derivatives get generated and added to the specified fields.
Which version of Islandora are you using?
2.4
Any related open or closed issues to this bug report?
Screenshots: