diff --git a/lib/classes/filetypes.php b/lib/classes/filetypes.php index cea82ed1973..f4d09c6bd15 100644 --- a/lib/classes/filetypes.php +++ b/lib/classes/filetypes.php @@ -313,6 +313,9 @@ abstract class core_filetypes { 'xml' => array('type' => 'application/xml', 'icon' => 'markup'), 'xsl' => array('type' => 'text/xml', 'icon' => 'markup'), + 'yaml' => array('type' => 'application/yaml', 'icon' => 'markup'), + 'yml' => array('type' => 'application/yaml', 'icon' => 'markup'), + 'zip' => array('type' => 'application/zip', 'icon' => 'archive', 'groups' => array('archive'), 'string' => 'archive') ); } diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index e8bfaf584a3..0405aa1d0a6 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3064,5 +3064,27 @@ privatefiles,moodle|/user/files.php'; upgrade_main_savepoint(true, 2022112803.03); } + if ($oldversion < 2022112804.08) { + // Upgrade yaml mime type for existing yaml and yml files. + $filetypes = array( + '%.yaml' => 'application/yaml', + '%.yml' => 'application/yaml,' + ); + + $select = $DB->sql_like('filename', '?', false); + foreach ($filetypes as $extension => $mimetype) { + $DB->set_field_select( + 'files', + 'mimetype', + $mimetype, + $select, + array($extension) + ); + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2022112804.08); + } + return true; }