From 3f5e386db723bd87129b5729418ce277c9a6eaed Mon Sep 17 00:00:00 2001 From: cescobedo Date: Tue, 7 Apr 2020 10:37:03 +0200 Subject: [PATCH] MDL-68356 core_h5p: Fix h5p mimetype Add a correct mime type for h5p files and update existing mime type for stored h5p files. --- lib/classes/filetypes.php | 2 +- lib/db/upgrade.php | 15 +++++++++++++++ version.php | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/classes/filetypes.php b/lib/classes/filetypes.php index 1ed83a98017..e1e04168b9e 100644 --- a/lib/classes/filetypes.php +++ b/lib/classes/filetypes.php @@ -115,7 +115,7 @@ abstract class core_filetypes { 'gzip' => array('type' => 'application/g-zip', 'icon' => 'archive', 'groups' => array('archive'), 'string' => 'archive'), 'h' => array('type' => 'text/plain', 'icon' => 'sourcecode'), - 'h5p' => array('type' => 'application/zip', 'icon' => 'h5p', 'string' => 'archive'), + 'h5p' => array('type' => 'application/zip.h5p', 'icon' => 'h5p', 'string' => 'archive'), 'hpp' => array('type' => 'text/plain', 'icon' => 'sourcecode'), 'hqx' => array('type' => 'application/mac-binhex40', 'icon' => 'archive', 'groups' => array('archive'), 'string' => 'archive'), diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index e27a5411190..f71d4d488e8 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2291,5 +2291,20 @@ function xmldb_main_upgrade($oldversion) { // Main savepoint reached. upgrade_main_savepoint(true, 2020041500.00); } + + if ($oldversion < 2020041700.01) { + // Upgrade h5p MIME type for existing h5p files. + $select = $DB->sql_like('filename', '?', false); + $DB->set_field_select( + 'files', + 'mimetype', + 'application/zip.h5p', + $select, + array('%.h5p') + ); + + upgrade_main_savepoint(true, 2020041700.01); + } + return true; } diff --git a/version.php b/version.php index 69a1c24567e..9150a38f012 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2020041700.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2020041700.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '3.9dev (Build: 20200417)'; // Human-friendly version name