Skip to content

Commit

Permalink
MDL-78884 pix: Reduce MIME type icons, replacing them
Browse files Browse the repository at this point in the history
In order to reduce the number of icons for the MIME types, a few
icons have been removed and replaced with their generic from
the existing ones:
- avi -> video
- base -> database
- bmp -> image
- html -> markup
- jpeg -> image
- mov -> video
- mp3 -> audio
- mpeg -> video
- png -> image
- quicktime -> video
- tiff -> image
- wav -> audio
- wmv -> video
  • Loading branch information
sarjona committed Aug 23, 2023
1 parent dd354b5 commit 07736ae
Show file tree
Hide file tree
Showing 125 changed files with 98 additions and 37 deletions.
70 changes: 35 additions & 35 deletions lib/classes/filetypes.php

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3383,5 +3383,51 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2023081800.01);
}

if ($oldversion < 2023082200.01) {
// Some MIME icons have been removed and replaced with existing icons. They need to be upgraded for custom MIME types.
$replacedicons = [
'avi' => 'video',
'base' => 'database',
'bmp' => 'image',
'html' => 'markup',
'jpeg' => 'image',
'mov' => 'video',
'mp3' => 'audio',
'mpeg' => 'video',
'png' => 'image',
'quicktime' => 'video',
'tiff' => 'image',
'wav' => 'audio',
'wmv' => 'video',
];

$custom = [];
if (!empty($CFG->customfiletypes)) {
if (array_key_exists('customfiletypes', $CFG->config_php_settings)) {
// It's set in config.php, so the MIME icons can't be upgraded automatically.
echo("\nYou need to manually check customfiletypes in config.php because some MIME icons have been removed!\n");
} else {
// It's a JSON string in the config table.
$custom = json_decode($CFG->customfiletypes);
}
}

$changed = false;
foreach ($custom as $customentry) {
if (!empty($customentry->icon) && array_key_exists($customentry->icon, $replacedicons)) {
$customentry->icon = $replacedicons[$customentry->icon];
$changed = true;
}
}

if ($changed) {
// Save the new customfiletypes.
set_config('customfiletypes', json_encode($custom));
}

// Main savepoint reached.
upgrade_main_savepoint(true, 2023082200.01);
}

return true;
}
15 changes: 15 additions & 0 deletions lib/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@ being forced open in all behat tests.
- mimeinfo_from_type
- url_guess_icon
* The xxxxxxx-yyy.png MIME icons placed in pix/f have been removed and replaced with new SVG files.
In order to reduce the number of icons for the MIME types, a few MIME icons have been removed and
replaced with their generic from the existing ones:
- avi -> video
- base -> database
- bmp -> image
- html -> markup
- jpeg -> image
- mov -> video
- mp3 -> audio
- mpeg -> video
- png -> image
- quicktime -> video
- tiff -> image
- wav -> audio
- wmv -> video

=== 4.2 ===

Expand Down
2 changes: 1 addition & 1 deletion mod/book/tool/importhtml/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ function toolbook_importhtml_get_chapter_files($package, $type) {

} else {
$mime = mimeinfo('icon', $file->pathname);
if ($mime !== 'html') {
if ($mime !== 'markup') {
continue;
}
$level = substr_count($file->pathname, '/');
Expand Down
Binary file removed pix/f/avi-128.png
Binary file not shown.
Binary file removed pix/f/avi-24.png
Binary file not shown.
Binary file removed pix/f/avi-256.png
Binary file not shown.
Binary file removed pix/f/avi-32.png
Binary file not shown.
Binary file removed pix/f/avi-48.png
Binary file not shown.
Binary file removed pix/f/avi-64.png
Binary file not shown.
Binary file removed pix/f/avi-72.png
Binary file not shown.
Binary file removed pix/f/avi-80.png
Binary file not shown.
Binary file removed pix/f/avi-96.png
Binary file not shown.
Binary file removed pix/f/avi.png
Binary file not shown.
Binary file removed pix/f/base-128.png
Binary file not shown.
Binary file removed pix/f/base-24.png
Binary file not shown.
Binary file removed pix/f/base-32.png
Binary file not shown.
Binary file removed pix/f/base-48.png
Binary file not shown.
Binary file removed pix/f/base-64.png
Binary file not shown.
Binary file removed pix/f/base-72.png
Binary file not shown.
Binary file removed pix/f/base-80.png
Binary file not shown.
Binary file removed pix/f/base-96.png
Binary file not shown.
Binary file removed pix/f/base.png
Binary file not shown.
Binary file removed pix/f/bmp-128.png
Binary file not shown.
Binary file removed pix/f/bmp-24.png
Binary file not shown.
Binary file removed pix/f/bmp-256.png
Binary file not shown.
Binary file removed pix/f/bmp-32.png
Binary file not shown.
Binary file removed pix/f/bmp-48.png
Binary file not shown.
Binary file removed pix/f/bmp-64.png
Binary file not shown.
Binary file removed pix/f/bmp-72.png
Diff not rendered.
Binary file removed pix/f/bmp-80.png
Diff not rendered.
Binary file removed pix/f/bmp-96.png
Diff not rendered.
Binary file removed pix/f/bmp.png
Diff not rendered.
Binary file removed pix/f/html-128.png
Diff not rendered.
Binary file removed pix/f/html-24.png
Diff not rendered.
Binary file removed pix/f/html-256.png
Diff not rendered.
Binary file removed pix/f/html-32.png
Diff not rendered.
Binary file removed pix/f/html-48.png
Diff not rendered.
Binary file removed pix/f/html-64.png
Diff not rendered.
Binary file removed pix/f/html-72.png
Diff not rendered.
Binary file removed pix/f/html-80.png
Diff not rendered.
Binary file removed pix/f/html-96.png
Diff not rendered.
Binary file removed pix/f/html.gif
Diff not rendered.
Binary file removed pix/f/jpeg-128.png
Diff not rendered.
Binary file removed pix/f/jpeg-24.png
Diff not rendered.
Binary file removed pix/f/jpeg-256.png
Diff not rendered.
Binary file removed pix/f/jpeg-32.png
Diff not rendered.
Binary file removed pix/f/jpeg-48.png
Diff not rendered.
Binary file removed pix/f/jpeg-64.png
Diff not rendered.
Binary file removed pix/f/jpeg-72.png
Diff not rendered.
Binary file removed pix/f/jpeg-80.png
Diff not rendered.
Binary file removed pix/f/jpeg-96.png
Diff not rendered.
Binary file removed pix/f/jpeg.png
Diff not rendered.
Binary file removed pix/f/mov.png
Diff not rendered.
Binary file removed pix/f/mp3-128.png
Diff not rendered.
Binary file removed pix/f/mp3-24.png
Diff not rendered.
Binary file removed pix/f/mp3-256.png
Diff not rendered.
Binary file removed pix/f/mp3-32.png
Diff not rendered.
Binary file removed pix/f/mp3-48.png
Diff not rendered.
Binary file removed pix/f/mp3-64.png
Diff not rendered.
Binary file removed pix/f/mp3-72.png
Diff not rendered.
Binary file removed pix/f/mp3-80.png
Diff not rendered.
Binary file removed pix/f/mp3-96.png
Diff not rendered.
Binary file removed pix/f/mp3.png
Diff not rendered.
Binary file removed pix/f/mpeg-128.png
Diff not rendered.
Binary file removed pix/f/mpeg-24.png
Diff not rendered.
Binary file removed pix/f/mpeg-256.png
Diff not rendered.
Binary file removed pix/f/mpeg-32.png
Diff not rendered.
Binary file removed pix/f/mpeg-48.png
Diff not rendered.
Binary file removed pix/f/mpeg-64.png
Diff not rendered.
Binary file removed pix/f/mpeg-72.png
Diff not rendered.
Binary file removed pix/f/mpeg-80.png
Diff not rendered.
Binary file removed pix/f/mpeg-96.png
Diff not rendered.
Binary file removed pix/f/mpeg.png
Diff not rendered.
Binary file removed pix/f/png-128.png
Diff not rendered.
Binary file removed pix/f/png-24.png
Diff not rendered.
Binary file removed pix/f/png-256.png
Diff not rendered.
Binary file removed pix/f/png-32.png
Diff not rendered.
Binary file removed pix/f/png-48.png
Diff not rendered.
Binary file removed pix/f/png-64.png
Diff not rendered.
Binary file removed pix/f/png-72.png
Diff not rendered.
Binary file removed pix/f/png-80.png
Diff not rendered.
Binary file removed pix/f/png-96.png
Diff not rendered.
Binary file removed pix/f/png.png
Diff not rendered.
Binary file removed pix/f/quicktime-128.png
Diff not rendered.
Binary file removed pix/f/quicktime-24.png
Diff not rendered.
Binary file removed pix/f/quicktime-256.png
Diff not rendered.
Binary file removed pix/f/quicktime-32.png
Diff not rendered.
Binary file removed pix/f/quicktime-48.png
Diff not rendered.
Binary file removed pix/f/quicktime-64.png
Diff not rendered.
Binary file removed pix/f/quicktime-72.png
Diff not rendered.
Binary file removed pix/f/quicktime-80.png
Diff not rendered.
Binary file removed pix/f/quicktime-96.png
Diff not rendered.
Binary file removed pix/f/quicktime.png
Diff not rendered.
Binary file removed pix/f/tiff-128.png
Diff not rendered.
Binary file removed pix/f/tiff-24.png
Diff not rendered.
Binary file removed pix/f/tiff-256.png
Diff not rendered.
Binary file removed pix/f/tiff-32.png
Diff not rendered.
Binary file removed pix/f/tiff-48.png
Diff not rendered.
Binary file removed pix/f/tiff-64.png
Diff not rendered.
Binary file removed pix/f/tiff-72.png
Diff not rendered.
Binary file removed pix/f/tiff-80.png
Diff not rendered.
Binary file removed pix/f/tiff-96.png
Diff not rendered.
Binary file removed pix/f/tiff.png
Diff not rendered.
Binary file removed pix/f/wav-128.png
Diff not rendered.
Binary file removed pix/f/wav-24.png
Diff not rendered.
Binary file removed pix/f/wav-256.png
Diff not rendered.
Binary file removed pix/f/wav-32.png
Diff not rendered.
Binary file removed pix/f/wav-48.png
Diff not rendered.
Binary file removed pix/f/wav-64.png
Diff not rendered.
Binary file removed pix/f/wav-72.png
Diff not rendered.
Binary file removed pix/f/wav-80.png
Diff not rendered.
Binary file removed pix/f/wav-96.png
Diff not rendered.
Binary file removed pix/f/wav.png
Diff not rendered.
Binary file removed pix/f/wmv-128.png
Diff not rendered.
Binary file removed pix/f/wmv-24.png
Diff not rendered.
Binary file removed pix/f/wmv-256.png
Diff not rendered.
Binary file removed pix/f/wmv-32.png
Diff not rendered.
Binary file removed pix/f/wmv-48.png
Diff not rendered.
Binary file removed pix/f/wmv-64.png
Diff not rendered.
Binary file removed pix/f/wmv-72.png
Diff not rendered.
Binary file removed pix/f/wmv-80.png
Diff not rendered.
Binary file removed pix/f/wmv-96.png
Diff not rendered.
Binary file removed pix/f/wmv.png
Diff not rendered.
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2023082200.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2023082200.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.3dev+ (Build: 20230822)'; // Human-friendly version name
Expand Down

0 comments on commit 07736ae

Please sign in to comment.