public static function set_enabled_plugins($list) {
        if (empty($list)) {
            $list = [];
        } else if (!is_array($list)) {
            $list = explode(',', $list);
        }
        if ($list) {
            $plugins = \core_plugin_manager::instance()->get_installed_plugins('media');
            $list = array_intersect($list, array_keys($plugins));
        }
        set_config('media_plugins_sortorder', join(',', $list));
        \core_plugin_manager::reset_caches();
        \core_media_manager::reset_caches();
    }