Commit 5958125c authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1722132: Video mimetype not set correctly due to fetch by assoc"

parents a1d3a1dc e978112e
......@@ -467,5 +467,21 @@ function xmldb_artefact_file_upgrade($oldversion=0) {
}
}
if ($oldversion < 2017100900) {
log_debug('Update video files that may have wrong artefacttype');
// For video/mp4 files added after commit a5cf7d59ebbd17193efaa38661eafe7b370095ee
// They can get wrong artefact filetype if last selected was not the one with 'mp4' description
$fromsql = " FROM (SELECT a.id FROM {artefact} a
JOIN {artefact_file_files} aff ON aff.artefact = a.id
WHERE aff.filetype = ?
AND a.artefacttype != ?) AS foo";
if (count_records_sql("SELECT COUNT(*) " . $fromsql, array('video/mp4', 'video'))) {
execute_sql("UPDATE {artefact} SET artefacttype = ?
WHERE id IN (
SELECT id " . $fromsql . "
)", array('video', 'video/mp4', 'video'));
}
}
return $status;
}
......@@ -247,7 +247,7 @@ class PluginArtefactFile extends PluginArtefact {
static $allmimetypes = null;
if (is_null($allmimetypes)) {
$allmimetypes = get_records_assoc('artefact_file_mime_types');
$allmimetypes = get_records_array('artefact_file_mime_types');
}
if (is_string($description)) {
......
......@@ -12,6 +12,6 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2016082901;
$config->release = '1.2.7';
$config->version = 2017100900;
$config->release = '1.2.8';
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment