Currently all library and content files exist outside Drupal's managed file system. This means H5P can't be easily integrated with other modules via hooks or stream wrappers like s3.

I'm only superficially knowledgeable of how H5Ps PHP library interacts with Drupal. I know that we can't change the code in the h5p-php-library, but would it be possible to extend the H5PDefaultStorage to use Drupal's built-in file handlers and treat H5P files as actual managed file entities?

This would also possibly solve the s3fs issue. I'm open to working on this, but I would need some direction and hopefully help. What do you guys think?

Norman

Comments

kenianbei created an issue. See original summary.

icc’s picture

You are indeed correct, but it's important for the structure (content//images, libraries/H5P.Library etc.) to be preserved as it's used in the URLs. Here's an example of how Moodle has implemented it: classes/file_storage.php.

I think this should be possible, but to keep it simple, start with only using the API for the permanently stored files, i.e. just leave the temporary files that are extracted as they are.

rex.barkdoll’s picture

Version: 8.x-1.0-rc6 » 2.0.0-alpha3

I just wanted to add support for anyone who might pick up this issue. It's an ongoing problem and is still relevant in the latest version of H5P. I wish I had the coding ability to try to figure this out, but I just don't. It needs a better coder than me.

Here are some links about the issue to catch anyone up on the latest goings-on for the issue:

The other H5P Drupal issue:
https://www.drupal.org/project/h5p/issues/2856947

H5P Thread on this issue:
https://h5p.org/node/1189#comment-48933

Here's the Jira ticket related to this issue:
https://h5ptechnology.atlassian.net/browse/HFP-801

frob’s picture

I don't think this module working with s3fs and managed files are, necessarily, related. My guess would be more that s3fs isn't 100% compatible with a standard file system. I do think there is work that could be done to make the h5p's integrate better with stream wrappers or even private files.

It looks like https://git.drupalcode.org/project/h5p/-/blob/2.0.x/src/H5PDrupal/H5PDru... we are hard coding the h5p's to use the public file system and there is no way to change to private files or anything else. I am looking into if we should implement our own Drupal file storage to implement the H5P file storage interface https://github.com/h5p/h5p-php-library/blob/master/h5p-file-storage.inte...