From 9992ee729e8cb7dbbc8191087776c97d9d91df10 Mon Sep 17 00:00:00 2001 From: Matteo Scaramuccia Date: Thu, 14 Mar 2013 22:41:34 +0100 Subject: [PATCH] MDL-38468 Files API: fixed the support for MTHML (MIME HTML: web page archive) files --- lib/db/upgrade.php | 16 ++++++++++++++++ lib/filelib.php | 2 ++ version.php | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 5355b206eb63b..9c2d2b5611a70 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1671,5 +1671,21 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2012120302.01); } + if ($oldversion < 2012120303.02) { + // Fixing possible wrong MIME type for MIME HTML (MHTML) files. + $extensions = array('%.mht', '%.mhtml'); + $select = $DB->sql_like('filename', '?', false); + foreach ($extensions as $extension) { + $DB->set_field_select( + 'files', + 'mimetype', + 'message/rfc822', + $select, + array($extension) + ); + } + upgrade_main_savepoint(true, 2012120303.02); + } + return true; } diff --git a/lib/filelib.php b/lib/filelib.php index 6753568bbf37e..0b2ef374bae88 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -1500,6 +1500,8 @@ function &get_mimetypes_array() { 'mp4' => array ('type'=>'video/mp4', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'), 'm4v' => array ('type'=>'video/mp4', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'), 'm4a' => array ('type'=>'audio/mp4', 'icon'=>'mp3', 'groups'=>array('audio'), 'string'=>'audio'), + 'mht' => array ('type'=>'message/rfc822', 'icon'=>'archive'), + 'mhtml'=> array ('type'=>'message/rfc822', 'icon'=>'archive'), 'mpeg' => array ('type'=>'video/mpeg', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'), 'mpe' => array ('type'=>'video/mpeg', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'), 'mpg' => array ('type'=>'video/mpeg', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'), diff --git a/version.php b/version.php index a628eaa367fca..a3964f5691279 100644 --- a/version.php +++ b/version.php @@ -30,7 +30,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2012120303.01; // 20121203 = branching date YYYYMMDD - do not modify! +$version = 2012120303.02; // 20121203 = branching date YYYYMMDD - do not modify! // RR = release increments - 00 in DEV branches // .XX = incremental changes