-
Sub-task
-
Resolution: Fixed
-
Minor
-
2.1, 2.2
-
MOODLE_21_STABLE, MOODLE_22_STABLE
-
wip-
MDL-32247-files23 -
I have discovered recently that there are two separate mimetype-related features in Moodle. One is several mimetype functions that use get_mimetypes_array() as the source, another one is filetype_parser class that is using file_types.mm mindmap file as a data source.
In my opinion, having two data sources may cause inconsistencies and dissimilarities in mime data we work with, thus I suggest to remove one of them (likely the mindmap one) and design a function for deriving the list of file extensions from existing mimetypes array (i.e. replicate filetype_parser functionality and refactor few bits where it is used).
Andrew provided a quick proof of concept for this:
function get_mimetype_matches($match) {
|
if (!is_array($match)) {
|
$match = array($match);
|
}
|
$mimetypes = get_mimetypes_array();
|
$results = array();
|
foreach($mimetypes as $key => $data) {
|
if (in_array($data['type'], $match)) {
|
$results[$key] = $data;
|
}
|
}
|
return $results;
|
}
|
Would be good to know people's opinion about this change.
- has a non-specific relationship to
-
MDL-32134 image/png missing language string
- Closed
-
MDL-32831 Docx and xlsx and pptx files not showing their filetype in Moodle 2.3
- Closed
- has been marked as being related by
-
MDL-32900 Replace file type icons in moodle
- Closed
- will be (partly) resolved by
-
MDL-33032 META: Files UI Stage 1 integrate branch into core
- Closed
- will help resolve
-
MDL-28084 Undefined mimetype strings
- Closed
-
MDL-28085 File picker error when selecting an alternative image
- Closed