Make WordPress Core

Changeset 58400


Ignore:
Timestamp:
06/13/2024 09:58:11 AM (4 months ago)
Author:
adamsilverstein
Message:

Networks and sites: use get_allowed_mime_types to populate multisite’s upload_filetypes.

Ensure new multisite installs are up to date with the current mime types supported in core.

Note that this will only affect newly created networks, since this is only used to populate the schema for new networks, not change the allowed mime types for existing networks

Props spacedmonkey, costdev, pavanpatil1, joemcgill, rajinsharwar, tb1909.
Fixes #53167.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/schema.php

    r58105 r58400  
    12441244    );
    12451245
    1246     $misc_exts        = array(
    1247         // Images.
    1248         'jpg',
    1249         'jpeg',
    1250         'png',
    1251         'gif',
    1252         'webp',
    1253         'avif',
    1254         // Video.
    1255         'mov',
    1256         'avi',
    1257         'mpg',
    1258         '3gp',
    1259         '3g2',
    1260         // "audio".
    1261         'midi',
    1262         'mid',
    1263         // Miscellaneous.
    1264         'pdf',
    1265         'doc',
    1266         'ppt',
    1267         'odt',
    1268         'pptx',
    1269         'docx',
    1270         'pps',
    1271         'ppsx',
    1272         'xls',
    1273         'xlsx',
    1274         'key',
    1275     );
    1276     $audio_exts       = wp_get_audio_extensions();
    1277     $video_exts       = wp_get_video_extensions();
    1278     $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) );
     1246    $allowed_file_types = array();
     1247    $all_mime_types     = get_allowed_mime_types();
     1248
     1249    foreach ( $all_mime_types as $ext => $mime ) {
     1250        array_push( $allowed_file_types, ...explode( '|', $ext ) );
     1251    }
     1252    $upload_filetypes = array_unique( $allowed_file_types );
    12791253
    12801254    $sitemeta = array(
  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r58326 r58400  
    240240            'image',
    241241            'audio',
    242         );
    243         if ( ! is_multisite() ) {
    244             $media_types[] = 'text';
    245         }
     242            'text',
     243        );
    246244        $this->assertSameSets( $media_types, $data['endpoints'][0]['args']['media_type']['enum'] );
    247245    }
Note: See TracChangeset for help on using the changeset viewer.