Error in database when trying to download any activity

We have a Moodle platform in version 3.1.1 (Build: 20160711). The 2017031300 version of the H5P plugin has been installed. It is a very powerful plugin to which you can draw a lot of performance to the activities within the courses of the platform. We have detected an error that occurs over any type of content that has been created. The problem is when you want to download that activity created in the Moodle platform to take it to other courses, it gives the following error in Moodle debug mode:

Debug info: ERROR: invalid input syntax for integer: "4.h5p"
SELECT hc.id
, Hc.name
, Hc.intro
, Hc.introformat
, Hc.json_content
, Hc.filtered
, Hc.slug
, Hc.embed_type
, Hc.disable
, Hl.id AS library_id
, Hl.machine_name
, Hl.major_version
, Hl.minor_version
, Hl.embed_types
, Hl.fullscreen
FROM mdl_hvp hc
JOIN mdl_hvp_libraries hl ON hl.id = hc.main_library_id
WHERE hc.id = $ 1
[Array (
0 => '4.h5p',
)]
Error code: dmlreadexception
× Stack trace:
Line 474 of /lib/dml/moodle_database.php dml_read_exception thrown
Line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database-> query_end ()
Line 794 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database-> query_end ()
Line 1527 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database-> get_records_sql ()
Line 912 of /mod/hvp/classes/framework.php: call to moodle_database-> get_record_sql ()
Line 288 of /mod/hvp/lib.php: call to mod_hvp \ framework-> loadContent ()
Line 4609 of /lib/filelib.php: call to hvp_pluginfile ()
Line 37 of /pluginfile.php: call to file_pluginfile ()

 

I attached screen shots so that they know exactly where the error occurs.

Thank you very much first of all and congratulations for this wonderful module.

thomasmars's picture

Thank you for the detailed bug report, the issue was resolved in: https://github.com/h5p/h5p-moodle-plugin/commit/b0686c2744d66230729b31604e4475b753989621 and should be included in the next Moodle release.

Thank you very much for the quick answer.

I was looking at the code to change it and exactly it was these lines that I modified so that it worked before you sent me the answer.

Now I check that the activity is downloaded well, but for other activities, the action of "Download" does nothing. I do not download the activity nor give me an error. It is as if for that activity the "Download" action does nothing.

Is it possible to download any type of activity, or are there activities for which you can not download in h5p file? I did the test with the conference room and the memory game.

Regards

thomasmars's picture

It should be possible to download any H5Ps as long as the "download" button is showing. Could you check your console and your server error log for any errors when no download file is produced ?

Solved!!! Great job!!! ;)