soderlind/vmfa-migrate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

soderlind/vmfa-migrate

Composer 安装命令:

composer require soderlind/vmfa-migrate

包简介

Migration add-on for Virtual Media Folders. Import folders from Enhanced Media Library, FileBird, Real Media Library, and more.

README 文档

README

Migration add-on for Virtual Media Folders. Import folders and file assignments from other media folder plugins.

Screenshot 2026-04-06 at 16 17 01

Supported Plugins

Plugin Storage Status
Enhanced Media Library Taxonomy media_category ✅ Supported
FileBird Custom tables fbv ✅ Supported
Real Media Library Custom tables realmedialibrary ✅ Supported
HappyFiles Taxonomy happyfiles_category ✅ Supported
WP Media Folder Taxonomy wpmf-category ✅ Supported
Media Library Assistant Taxonomy attachment_category ✅ Supported
CatFolders Custom tables catfolders ✅ Supported

Requirements

Installation

Recommended: Use the Add-On Manager to install the add-on.

Manual installation:

  1. Download vmfa-migrate.zip
  2. Upload via Plugins → Add New → Upload Plugin
  3. Activate via WordPress Admin → Plugins

Plugin updates are handled automatically via GitHub. No need to manually download and install updates.

How It Works

  1. Detection — The plugin automatically detects which supported media folder plugins have data in your database (works even if the source plugin has been deactivated).
  2. Preview — See which folders will be created and how many assignments will be migrated before committing.
  3. Migration — Folders are created as VMF taxonomy terms (vmfo_folder). Attachment assignments are batched via Action Scheduler for large libraries.
  4. Non-destructive — Source plugin data is never modified or deleted. Existing VMF folder assignments are preserved.

Conflict Strategies

When a VMF folder with the same name and parent already exists:

  • Skip (default) — Reuse the existing folder.
  • Merge — Same as skip, logged for review.
  • Overwrite — Create a new folder with a deduplicated name.

Usage

Admin UI

Navigate to Media → Folder Settings → Migration to detect sources, preview, and start migrations.

WP-CLI

# List detected migration sources
wp vmfa-migrate list-sources

# Preview what will be migrated
wp vmfa-migrate preview enhanced-media-library

# Preview as a tree
wp vmfa-migrate preview enhanced-media-library --format=tree

# Run the migration
wp vmfa-migrate run enhanced-media-library

# Dry run
wp vmfa-migrate run enhanced-media-library --dry-run

# With options
wp vmfa-migrate run filebird --batch-size=200 --conflict=merge

# Include additional taxonomies (EML / MLA only)
wp vmfa-migrate run enhanced-media-library --include-taxonomies

Taxonomy Migration

Enhanced Media Library and Media Library Assistant support additional taxonomies (e.g. media tags) beyond their primary folder taxonomy. When you enable Include taxonomies (UI checkbox or --include-taxonomies in WP-CLI), these are migrated as standard WordPress taxonomies on each attachment.

Virtual Media Folders does not display these taxonomies in its sidebar. They are stored so the data is not lost. You can access them with native WordPress functions.

Register the taxonomy (e.g. in your theme's functions.php or a custom plugin):

add_action( 'init', function () {
    register_taxonomy( 'media_tag', 'attachment', [
        'label'        => __( 'Media Tags' ),
        'public'       => true,
        'hierarchical' => false,
        'show_ui'      => true,
        'show_in_rest' => true,
    ] );
} );

Get terms for an attachment:

$terms = get_the_terms( $attachment_id, 'media_tag' );
if ( $terms && ! is_wp_error( $terms ) ) {
    foreach ( $terms as $term ) {
        echo esc_html( $term->name );
    }
}

Query attachments by term:

$attachments = get_posts( [
    'post_type'   => 'attachment',
    'post_status' => 'inherit',
    'tax_query'   => [
        [
            'taxonomy' => 'media_tag',
            'field'    => 'slug',
            'terms'    => 'nature',
        ],
    ],
] );

Replace media_tag with the actual taxonomy slug shown during migration (e.g. attachment_tag for Media Library Assistant).

REST API

All endpoints require manage_options capability.

Method Endpoint Description
GET /wp-json/vmfa-migrate/v1/sources List detected sources
GET /wp-json/vmfa-migrate/v1/sources/{slug}/preview Preview migration
POST /wp-json/vmfa-migrate/v1/sources/{slug}/migrate Start migration
GET /wp-json/vmfa-migrate/v1/jobs/{id} Get job progress
DELETE /wp-json/vmfa-migrate/v1/jobs/{id} Cancel a job

Extending

Add custom drivers by filtering vmfa_migrate_drivers:

add_filter( 'vmfa_migrate_drivers', function( array $drivers ): array {
    $drivers[] = MyCustomDriver::class;
    return $drivers;
} );

Your driver must implement VmfaMigrate\Drivers\DriverInterface.

Development

composer install
npm install
npm run build
composer test
npm test

License

GPL-2.0-or-later

soderlind/vmfa-migrate 适用场景与选型建议

soderlind/vmfa-migrate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 soderlind/vmfa-migrate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 soderlind/vmfa-migrate 我们能提供哪些服务?
定制开发 / 二次开发

基于 soderlind/vmfa-migrate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 40
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-04-20